The Association of Model Submariners.

Would you like to react to this message? Create an account in a few clicks or log in to continue.

* THE FORUM FOR ALL THOSE INTERESTED IN BUILDING AND OPERATING MODEL SUBMARINES *


Flight controllers as sub levelers - Page 3 14212712

Just a reminder that this Forum will close for posts next November (2025) . It will continue to be available as a reference on the Wayback Machine https://web.archive.org/

Flight controllers as sub levelers - Page 3 14212712

For a guide to past events see the "Shows and Events" section.
B i
::::

S

P~~~

$$$

Who is online?

In total there are 3 users online :: 0 Registered, 0 Hidden and 3 Guests

None


Most users ever online was 180 on Tue Nov 05, 2019 6:03 am

Latest topics

» Microprocessor choices
Flight controllers as sub levelers - Page 3 EmptyWed Dec 04, 2024 7:26 am by geofrancis

» Robbe Seawolf V2
Flight controllers as sub levelers - Page 3 EmptyWed Dec 04, 2024 7:17 am by geofrancis

» Futaba -868/915mhz equipment
Flight controllers as sub levelers - Page 3 EmptyTue Oct 29, 2024 4:46 pm by tsenecal

» RC Drift Gyro for pitch control
Flight controllers as sub levelers - Page 3 EmptySun Oct 20, 2024 2:04 pm by geofrancis

» WW2 mini sub build
Flight controllers as sub levelers - Page 3 EmptyThu Oct 17, 2024 2:34 pm by geofrancis

» sonar data link
Flight controllers as sub levelers - Page 3 EmptyMon Oct 14, 2024 4:31 pm by geofrancis

» ExpressLRS - 868/915 Mhz equipment
Flight controllers as sub levelers - Page 3 EmptyFri Oct 11, 2024 8:58 pm by Marylandradiosailor

» Flight controllers as sub levelers
Flight controllers as sub levelers - Page 3 EmptyFri Oct 11, 2024 8:14 pm by geofrancis

» 868/915 Mhz as a viable frequency for submarines.
Flight controllers as sub levelers - Page 3 EmptyThu Oct 10, 2024 3:21 am by tsenecal

Statistics

Our users have posted a total of 12536 messages in 1992 subjects

We have 1021 registered users

The newest registered user is Mike Echo

4 posters

    Flight controllers as sub levelers

    avatar
    geofrancis


    Posts : 325
    Join date : 2021-09-24

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  geofrancis Sun Dec 31, 2023 7:33 pm

    well that was a fail, I started doing some basic tests but the barometer kept slowly moving indicating a leak, I gave it a coat of superglue but the leak remained. So I eventually just put the whole thing underwater to see where it was coming from, to my surprise the connector started bubbling. turns out the air was going though the wires insulation to the outside. so this time i have stripped it down and conformal coated the whole board apart from the sensor ports, this should also seal around the wires.

    david f likes this post

    avatar
    geofrancis


    Posts : 325
    Join date : 2021-09-24

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  geofrancis Tue Jan 02, 2024 3:39 pm

    Flight controllers as sub levelers - Page 3 20240110
    Flight controllers as sub levelers - Page 3 20240111
    Progress!

    I have rebuilt the barometer chamber. But this time I have used some high strength clear adhesive. And I packed it so there was only a tiny air gap around the  sensors so there is no way for the air to get to the wires.

    david f likes this post

    avatar
    17b


    Posts : 9
    Join date : 2023-06-19

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  17b Wed Jan 03, 2024 8:04 pm

    Does it work now as expected?

    geofrancis likes this post

    avatar
    geofrancis


    Posts : 325
    Join date : 2021-09-24

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  geofrancis Wed Jan 03, 2024 11:24 pm

    17b wrote:Does it work now as expected?

    I have been giving it some time for the glue to cure before I do any testing but it looks good when i give it a little pressure as its not changing over time. im going to try and get it installed in the sub and tested sometime this weekend. i still need to program the inav controller logic switches to operate the ballast pump. My plan is to have a 3 position switch that changes the output so it can switch between static and dynamic diving depth control, and I still need to install the depth sounder too.

    david f and SimonH like this post

    avatar
    17b


    Posts : 9
    Join date : 2023-06-19

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  17b Thu Jan 04, 2024 11:21 am

    Are you going to use telemetry as feedback?

    geofrancis likes this post

    avatar
    geofrancis


    Posts : 325
    Join date : 2021-09-24

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  geofrancis Thu Jan 04, 2024 11:55 am

    17b wrote:Are you going to use telemetry as feedback?

    yes im running a frsky r9 868mhz receiver with telemetry.
    avatar
    geofrancis


    Posts : 325
    Join date : 2021-09-24

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  geofrancis Wed Sep 18, 2024 2:08 pm

    Its been a while since i had a look at this. there has been a lot of progress with Inav recently, one of the things is VTOL aircraft support. It doesnt sound like much but it makes working a submarine much simpler.

    When you think about it a Submarine is basically a VTOL aircraft, it has control surfaces like a plane and a vertical lift system using ballast, what we want to do is to seamlessly go between the 2 modes. by setting it up as a VTOL with 2 different flight profiles we can transition between static and dynamic diving.

    another advancement is in telemetry support, Inav and Betaflight use telemetry called MSP that wasn't supported by anything up to now, thats why I was still using the less than ideal frsky R9 system but now mLRS has full telemetry support im switching it over, this lets me change settings and get live telemetry while the boat is in the water. mLRS runs on ExpressLRS hardware. so it shares a lot of features. the main difference is express LRS is a high-speed RC system that can send telemetry, mLRS is a high-speed telemetry system that can send RC. 30hz vs 100hz for RC makes no difference for surface vehicles.

    most of the parts have arrived so I want to get it tested soon.
    avatar
    geofrancis


    Posts : 325
    Join date : 2021-09-24

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  geofrancis Tue Oct 01, 2024 9:37 pm

    I have been thinking about what would be the best way to interface submarine sensors to the flight controller, hacking them over i2c isnt ideal so I have been looking at MSP telememtry as its the native protocal that Inav uses and it allows you to use MSP to send just about every sensor type over the serial link, so what i think is going to be the best approach is building a sensor interface with something like a ESP32 that can take water pressure, sonar depth, and water speed, scale them so sonar depth will match up with barometric sensor in water, and the speed sensor can be calibrated. with this setup it should just be a matter of connecting it to the flight controller and setting all the sensor types to MSP and it should fly underwater like a plane.

    I have been looking at different ways to try and hold depth and I havent ruled any of them out yet.

    the first is to set it up as a VTOL aircraft with the 2 ballast tanks setup as lift motors with the water jet pump for yaw when in static diving mode and when its in dynamic diving mode it would use the planes to hold its depth.

    the second method is to use the inav Programmable logic switches to control the depth, I have a test version setup, its very simple to get working, one way is to use the depth to trigger high and low depth limits that runs the pump, another would be to try and use the difference between the requested depth and actual depth and vertical speed to scale the pump speed but that gets very complicated to do with just logic conditions.

    the last way would be to just do it all on the arduino. essentially it would run a pid for depth, and get its inputs from the flight controller that would essentially always be in dynamic diving mode with the ballast tanks used to trim the planes level.

    https://github.com/yajo10/MSP-Arduino

    https://github.com/iNavFlight/inav/blob/master/src/main/msp/msp_protocol_v2_sensor_msg.h

    I have a rough draft that compiles but its not been tested yet


    Code:
    #include <Wire.h>
    #include <MSP.h>
    #include "MS5611.h"
    #include "ms4525do.h"


    bfs::Ms4525do pres;

    byte received;

    float diffPressurePa;
    int16_t temp;


    int distances = 0;
    int distance = 0;

    unsigned char buffer_RTT[4] = { 0 };
    uint8_t CS;
    #define COM 0x55
    int Distance = 0;

    MSP msp;

    MS5611 MS5611(0x77);

    void setup() {
      Serial.begin(115200);
      Serial1.begin(115200);
      Serial2.begin(115200);
      msp.begin(Serial2);
      Wire.begin(22, 23);  //  adjust ESP32 pins if needed
      pres.Config(&Wire, 0x28, 1.0f, -1.0f);
    }

    void loop() {

      MS5611.read();
      Serial.print("T:\t");
      Serial.print(MS5611.getTemperature(), 2);
      Serial.print("\tP:\t");
      Serial.print(MS5611.getPressure(), 2);
      Serial.println();





      Serial1.write(COM);
      if (Serial1.available() > 0) {
        delay(1000);
        if (Serial1.read() == 0xff) {
          buffer_RTT[0] = 0xff;
          for (int i = 1; i < 4; i++) {
            buffer_RTT[i] = Serial1.read();
          }
          CS = buffer_RTT[0] + buffer_RTT[1] + buffer_RTT[2];
          if (buffer_RTT[3] == CS) {
            distance = (buffer_RTT[1] << 8) + buffer_RTT[2];
            distances = (distance / 10);
          }
        }
      }


     if (pres.Read()) {
        Serial.print(pres.pres_pa(), 6);
        Serial.print("\t");
        Serial.print(pres.die_temp_c(), 6);
        Serial.print("\n");
     }

      uint8_t sonarrange[] = { 255, distances };
      uint8_t barorange[] = { 1, millis(), MS5611.getPressure(), (MS5611.getTemperature(), 2) };  
      uint8_t speed[] = { 1, millis(), pres.pres_pa(), pres.die_temp_c() };


      msp.send(0x1F01, &sonarrange, sizeof(sonarrange));
      msp.send(0x1F05, &barorange, sizeof(barorange));
      msp.send(0x1F06, &speed, sizeof(speed));
    }

    david f likes this post

    avatar
    geofrancis


    Posts : 325
    Join date : 2021-09-24

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  geofrancis Wed Oct 02, 2024 11:45 am

    I forgot all about this, If i cant get my modified ms5611 sensor to work im going to order one of these, with the MSP adapter im not restrained to just the sensors supported by inav.

    https://www.theassociationofmodelsubmariners.com/t1981-depth-sensor-lora-telemetry
    avatar
    geofrancis


    Posts : 325
    Join date : 2021-09-24

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  geofrancis Sun Oct 06, 2024 12:57 am

    good news! tests of the MSP sensor link looks good. Inav is recognising the input so now its just a matter of setting up the sensors on the esp32, I have just went and ordered the Adafruit MPRLS Ported Pressure Sensor Breakout for depth, its proven to work so its one less thing to worry about.

    Flight controllers as sub levelers - Page 3 Screen18

    Marylandradiosailor likes this post

    avatar
    geofrancis


    Posts : 325
    Join date : 2021-09-24

    Flight controllers as sub levelers - Page 3 Empty Re: Flight controllers as sub levelers

    Post  geofrancis Fri Oct 11, 2024 8:14 pm

    I have converted the adapter over to a ESP32S3, its as powerfull as a regular esp32 and the mini boards are pin compatible with the RP2040 zero so it will make it much easier to configure with the hull closed if it has wifi.

    Flight controllers as sub levelers - Page 3 B24f4664e0947803b333712c84f39c865b454cdf
    Flight controllers as sub levelers - Page 3 2550bf29cbc30bd2cf689a05548386e8ce8cec8c
    https://www.aliexpress.com/item/1005007274442944.html
    https://www.aliexpress.com/item/1005007385048661.html

    The code has been changed over to the MPRLS pressure sensor, I'm just waiting for it to arrive so I can start testing.

    https://github.com/geofrancis/MSP_Submarine_Adapter/blob/main/sub_esp32s3_mprls/sub_esp32s3_mprls.ino

      Similar topics

      -

      Current date/time is Fri Dec 13, 2024 3:15 am