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 *



Join the AMS - Registered Forum users can become members of the AMS and it's free ...... To join send an email with your name , address and phone number to amstreasure@googlemail.com


For further details of any events shown here also see the "Shows and Events" section on the forum

*HOPING FOR A BETTER 2021 AND MORE OF THESE EXCELLENT FREE EVENTS ALL AROUND THE COUNTRY!

.

CANCELLED because of coronavirus. Papplewick Pumping Station, Nottingham, Sunday 12th & Monday 13th April
CANCELLED because of coronavirus. Bournville Sub Day, Sunday 10th May 2020

. ,

(CANCELLED) Submarine, Boating & Sailing Weekend, Norwich MBC, Weekend of 25,26th July

,./
.
Model Boat Convention, Haydock Park (Cancelled this year)

.

CANCELLED. Bournville Sub Day, Sunday 13th September

,,,,

(CANCELLED) Club Submarine Regatta, Furness MBC, Barrow in Furness, Sunday 20th Sept 2020

Who is online?

In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest

None


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

Latest topics

» openLRS on 458Mhz and 433Mhz and submarines
Simple telemetry system for openLRS (on 458Mhz) EmptySat Oct 24, 2020 5:15 pm by tsenecal

» Making end caps
Simple telemetry system for openLRS (on 458Mhz) EmptyWed Oct 21, 2020 3:07 pm by tsenecal

» New AMS member Henry from South Australia
Simple telemetry system for openLRS (on 458Mhz) EmptyTue Oct 20, 2020 3:27 pm by david f

» New member intro
Simple telemetry system for openLRS (on 458Mhz) EmptyTue Oct 20, 2020 3:23 pm by david f

» Krick Type Vll B Wiring and build photos
Simple telemetry system for openLRS (on 458Mhz) EmptyFri Oct 09, 2020 3:15 pm by PeterJames

» bicycle CO2 inflation systems
Simple telemetry system for openLRS (on 458Mhz) EmptyWed Oct 07, 2020 1:15 am by salmon

» use of 458MHz modules
Simple telemetry system for openLRS (on 458Mhz) EmptyFri Oct 02, 2020 6:51 am by tsenecal

» Newcomer to the forum?
Simple telemetry system for openLRS (on 458Mhz) EmptyThu Oct 01, 2020 10:05 pm by SimonH

» Ship model event in Fassberg, northern Germany, on 20th of September 2020
Simple telemetry system for openLRS (on 458Mhz) EmptyTue Sep 29, 2020 10:38 pm by Hermann

Statistics

Our users have posted a total of 11188 messages in 1834 subjects

We have 869 registered users

The newest registered user is cliffhanger7

    Simple telemetry system for openLRS (on 458Mhz)

    david f
    david f
    AMS Treasurer

    Posts : 2122
    Join date : 2010-11-10
    Age : 70
    Location : Cumbria

    Simple telemetry system for openLRS (on 458Mhz) Empty Simple telemetry system for openLRS (on 458Mhz)

    Post  david f on Tue May 19, 2020 11:47 am

    Firstly my thanks to Tim Senecal for opening up the use of openLRS and telemetry for model subs.

    I have been been using telemetry on openLRS for 2 or 3 years now and it is useful but not in the same way that it is used in model aircraft.

    A lot of the measures and sensors are not really very useful for model subs. For example:

    GPS - it doesn't work underwater.
    Amps - not very important really.
    Fuel gauge - ??
    Multiple battery voltages - maybe overall battery voltage?
    Temperatures - ?
    RPM - ?
    Compass - useful?
    Altitude - yes, but needs to be depth.

    Of the list, I've found that battery voltage, depth and compass heading are really useful.

    I haven't had much success with various compass modules. They work fine on the bench but in the close confines of a model sub they don't work well, at all. I think that stray magnetic fields from the wiring is the culprit.

    So a telemetry system with only 2 values would be useful (and also easier for me with my limited coding skills!) I've been thinking about this for a year or two but the coronavirus lockdown has given me some time and focus. (OK, I'm trying VERY  hard to find some benefit from a global crisis!)

    So here it is. It is also open source (Please check my Github for the latest software.  https://github.com/rdforrest/openLRS ) so you are not tied to any commercial systems and it lends itself to things like Phil Green's home made, Arduino based TX system.

    The transmitter is a gutted one modified as per Phil Green's guide. (Hope you like the rubber bands.)The oLED display is showing a lead acid battery voltage (10 volts):

    Simple telemetry system for openLRS (on 458Mhz) 20200510

    The depth reading (7m) (Only test data!)

    Simple telemetry system for openLRS (on 458Mhz) 20200519

    Depth reading.

    Simple telemetry system for openLRS (on 458Mhz) 20200514

    The Arduino Nano Every and the oLED display at the Transmitter end before being heat sleeved. TX battery voltage provides the power and draws about 50mA.

    Simple telemetry system for openLRS (on 458Mhz) 20200517

    Simple telemetry system for openLRS (on 458Mhz) 20200516

    The Hobbyking receiver end. Another Arduino Nano Every acts as the data gatherer

    Simple telemetry system for openLRS (on 458Mhz) 20200518

    Simple telemetry system for openLRS (on 458Mhz) 20200513

    The sketch for the data gatherer Arduino: (Please check my Github for any updates.)

    /*
     Based on work by Tim Senecal.
     For Nano Every. (I have had problems with clones stopping working and requiring sketch to be reloaded.)
     Sends data over openLRS Passthru.
     To do this, open the openLRS configurator for TX , Set serial baudrate(bps) to 9600, data rate(bps) to 9600, Telemetry to "Yes" (This is Passthru)
     Connections to Hobbyking receiver module:
      Arduino TX (Pin TXD1) -> receiver  RX (Serial port pins, 4th pin down fom top - aerial on left)
      Arduino GND -> receiver GND (Serial port pins,1st pin down from top - aerial on left.)
      Voltage divider input to A2
      Other sensor input (e.g Depth) to A3
      Receiver +6v to Vin on arduino
     Arduino serial data default is, serial baud rate (9600) and 8 data bits, no parity,no stop,LSB and not inverted - the default

     Sept 2019-RDF - Voltage Divider. Move to  input from divider set by 4.7kohms and 15k ohms for 12 v battery. Better for  3.3 v input.
     (My original depth calibration depth (Using Tim's depth sensor detailed on SubPirates Forum)  = 3 * (depth - 84); // 84 to set zero)
    */

    void setup() {

     // Open USB serial communications and wait for port to open:
     Serial.begin(9600);
     while (!Serial) {
       ; // wait for serial port to connect. Needed for native USB port only
     }

     Serial.println("Wake-up-you Serial usb port!");
     delay(1000); // We wait 1 second

     // Open second hardware serial port
     Serial1.begin(9600);

     Serial1.println("Wake-up Serial1 port!");
     delay(1000); // We wait 1 second

    }
    void loop() {

     // Read voltage sensor value on A2
     int sensorVal = analogRead (A2);
     sensorVal = sensorVal / 76; //  Fiddle factor (originally 67) is calibration value for voltage from earlier software by RDF
     String mysensorVal = String(sensorVal);

     // Read depth sensor value on A3
     int sensorVal1 = analogRead (A3);
     sensorVal1 = sensorVal1 / 100; //  Fiddle factor is calibration value
     String mysensorVal1 = String(sensorVal1);

     // print the voltage sensor value
     Serial.println(mysensorVal);
     Serial.print('\n'); // new line
     delay (200);

     // print the voltage sensor value to Serial
     Serial.println(mysensorVal1);
     Serial.print('\n'); // new line
     delay (200);

     Serial1.print(mysensorVal);
     delay (200);
     Serial1.print('\n'); // new line
     delay (200);

     // print the voltage sensor value to Serial1
     Serial1.print(mysensorVal1);
     delay (200);
     Serial1.print('\n'); // new line
     delay (200);

     //Test
     //Serial1.print("RDF");

     delay(10); // We wait 10mS to print the next value

    }


    The sketch for the display Arduino:


    /*
     Based on work by Tim Senecal.
     For Nano Every. (I have had problems with clones stopping working and requiring sketch to be reloaded.)
     Displays 2 streams of data on 0.96 inch oLED display which is visible in sunlight.
     Sends data over openLRS Passthru.
     To do this, open the openLRS configurator for TX , Set serial baudrate(bps) to 9600, data rate(bps) to 9600, Telemetry to "Yes" (This is Passthru)
     Connections to Hobbyking transmitter module:
     Identify serial port on module. (6 pins in a line.)
     Identify DTR pin. (Usually the left hand pin but it is marked on the back of the board.)
     Connect Arduino RX (Pin RXD1) --> TX pin on TX module (next to DTR pin)
     Connect Arduino Gnd --> Ground on TX module. (One of 2 pins furthest from DTR)
     Power supply: Arduino Vin --> Transmitter battery positive. (You can connect a flying lead into the TX module.)
     Arduino serial data default is, serial baud rate (9600) and 8 data bits, no parity,no stop,LSB and not inverted - the default

     Nano and display draw about 50mA

     Details of OLED display from Banggood:
     White 0.96 Inch OLED I2C IIC Communication Display 128*64 LCD Module
     VCC: 3.3-5V
     GND: Ground
     SCL: Serial Clock
     SDA: Serial Data
     Size: 0.96 inch
     Resolution: 128*64
     Color: white
     Viewing angle: >160°
     Support platform: , 51 series, MSP430 series, STM32/2, chip, etc.
     Ultra low power consumption: 0.04W during normal operation
     Wide voltage support: DC 3.3V-5V
     Working temperature: -30 ° C ~ 80 ° C
     Driver chip: SSD1306
     Communication method: IIC, only 2 I/O ports
     Backlight: OLED self-illumination, no backlight required
     Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
     Copyright (c) 2016, olikraus@gmail.com
     All rights reserved.

    */
    #include <Arduino.h>
    #include <U8g2lib.h>

    #ifdef U8X8_HAVE_HW_SPI
    #include <SPI.h>
    #endif
    #ifdef U8X8_HAVE_HW_I2C
    #include <Wire.h>
    #endif

    String inString;   //  Make global
    long bitt = 0;   //  Make global
    /*
     U8g2lib Example Overview:
       Frame Buffer Examples: clearBuffer/sendBuffer. Fast, but may not work with all Arduino boards because of RAM consumption
       Page Buffer Examples: firstPage/nextPage. Less RAM usage, should work with all Arduino boards.
       U8x8 Text Only Example: No RAM usage, direct communication with display controller. No graphics, 8x8 Text only.

     This is a page buffer example for oLED.
    Display Connections: Vcc to 5v. A4 pin is SDA. A5 pin is SCL.

     Some fonts:
       // u8g2.setFont(u8g2_font_ncenB14_tr);
       // 11 Pixel height font
       //u8g2.setFont(u8g2_font_ncenB10_tr);
       // 14 Pixel font
       //u8g2.setFont(u8g2_font_profont22_mf);
       // 16 Pixel font
       //u8g2.setFont(u8g2_font_crox3hb_tn);
       // 49 Pixel Height
       //u8g2.setFont(u8g2_font_fur49_tn);
       //u8g2.drawStr(20, 55, b);
       // 62 Pixel Height
       u8g2.setFont(u8g2_font_logisoso62_tn);
    */

    // Please UNCOMMENT one of the contructor lines below
    // U8g2 Contructor List (Picture Loop Page Buffer)
    // The complete list is available here: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp
    // Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected
    //U8G2_NULL u8g2(U8G2_R0); // null device, a 8x8 pixel display which does nothing
    //U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
    //U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6); // Arduboy (Production, Kickstarter Edition)
    //U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
    //U8G2_SSD1306_128X64_NONAME_1_3W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* reset=*/ 8);
    //U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
    //U8G2_SSD1306_128X64_ALT0_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);   // same as the NONAME variant, but may solve the "every 2nd line skipped" problem
    //U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* reset=*/ 8);
    U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);   // All Boards without Reset of the Display

    // End of constructor list.RDF removed a lot of these.

    void setup(void) {

     // Open serial communications and wait for port to open:
     Serial.begin(9600);
     Serial1.begin(9600);

     while (!Serial) {
       ; // wait for serial port to connect. Needed for native USB port only
     }

     while (!Serial1) {
       ; // wait for serial port to connect. Needed for native USB port only
     }

     Serial.print("Wake-up USB!");
     delay(1000); // We wait 1 second

     //Test oled
     u8g2.begin();
     u8g2.firstPage();
     do {
       u8g2.setFont(u8g2_font_ncenB14_tr);
       u8g2.drawStr(0, 15, "DATA RX");
     } while ( u8g2.nextPage() );
     delay(1000);

    }
    void loop(void) {
     // This is the function which receives the serial data:

     recvWithEndMarker();

     delay(200); // We wait 200 mS to print the next value

     // Convert integer to character for display ( https://www.instructables.com/id/Converting-integer-to-character/)

     long a = bitt;

     char b[3]; // define character variable

     String str; // define string variable

     str = String(a); // convert to string

     str.toCharArray(b, 3);

     // Print to oLED
     u8g2.firstPage();
     do {
       // 62 Pixel Height
       u8g2.setFont(u8g2_font_logisoso62_tn);
       u8g2.drawStr(20, 65, b);
     } while ( u8g2.nextPage() );
     delay(1000);

    }

    // Functions:

    void recvWithEndMarker() {

     /*
       Serial connection with String to Integer conversion

       Reads a serial input string until it sees a newline, then converts the string
       to a number if the characters are digits.

       The circuit:
       - No external components needed.

       created 29 Nov 2010
       by Tom Igoe

       This example code is in the public domain.

       http://www.arduino.cc/en/Tutorial/StringToInt
     */

     inString = "";    // string to hold input

     // Open serial communications and wait for ports to open:
     Serial.begin(9600);
     while (!Serial) {
       ; // wait for serial port to connect. Needed for native USB port only
     }

     // send an intro:
     Serial.println("\n\nString to Int():");
     Serial.println();

     // Read serial1 input:
     Serial1.begin(9600);
     while (Serial1.available() > 0) {
       int inChar = Serial1.read();
       if (isDigit(inChar)) {
         // convert the incoming byte to a char and add it to the string:
         inString += (char)inChar;
       }
       // if you get a newline, print the string, then the string's value:
       if (inChar == '\n') {
         // Save value as a long integer.RDF
         bitt = inString.toInt();
         Serial.print("Value:");
         Serial.println(inString.toInt());
         Serial.print("String: ");
         Serial.println(inString);
         // clear the string for new input:
         inString = "";
       }
     }
    }


    Read the comments in the software for a lot of the detail. Please note that you need to set up "Passthru telemetry" for the TX module using the openLRS configurator.

    LATER EDIT: 3.6.2020. I have experienced some overheating problems of the Arduino feeding the oLED display. This may be because the display is designed for 3.3 volt logic. So I'm trying voltage level conversion. (3.3v to VDD, 470 ohm resistors in series, 1k ohm resistor then connected to earth for SDA and SCL to convert to 3.3 input.) 4.7 k ohm pullup resistors also fitted for i2c requirement. This is working well so far with no overheating. You can use one of the level shifter boards as an alternative. I am also looking at using a Nokia 5110 display. Cheap, and it may be more visible in bright sunlight. (Although the oLED display seems fine in my (northern!) sunlight.


    Last edited by david f on Wed Jul 08, 2020 12:41 pm; edited 2 times in total
    david f
    david f
    AMS Treasurer

    Posts : 2122
    Join date : 2010-11-10
    Age : 70
    Location : Cumbria

    Simple telemetry system for openLRS (on 458Mhz) Empty Re: Simple telemetry system for openLRS (on 458Mhz)

    Post  david f on Sat Jul 04, 2020 12:03 pm

    This is still working fine on daily bench tests. I am hoping to get back to the Barrow pond soon when the Furness MBC re-opens for some testing "in the wet". Use the latest software on my Github if you want to have a go. The latest files you want are:
    openlrs-trial-send-data-2.1.ino

    open-trial-receive-data-2.2.ino

    (I have tried the Nokia display and it works but with a rather retro look! I will stick with the oLED.)

    David
    david f
    david f
    AMS Treasurer

    Posts : 2122
    Join date : 2010-11-10
    Age : 70
    Location : Cumbria

    Simple telemetry system for openLRS (on 458Mhz) Empty Re: Simple telemetry system for openLRS (on 458Mhz)

    Post  david f on Sat Aug 29, 2020 1:53 pm

    Well finally managed to get back in the water (with my Turkish Nordenfelt photo below) so a good  opportunity to test out the simple telemetry system on openLRS and it works very well. Transmits current draw (3A max) and battery voltage (just the thing for LIPO use as with this sub.)

    Simple telemetry system for openLRS (on 458Mhz) 20200810

    I ended up using the very useful INA 219 chip for voltage and current which interfaces to the Arduino by i2c. (Photo below)

    Simple telemetry system for openLRS (on 458Mhz) 20200811

    The code in C follows but have a look at my Github site for updates etc:
    https://github.com/rdforrest/openLRS


    C
    /*
     Based on work by Tim Senecal.
     For Nano Every (Which has the advantage of having several serial ports in hardware)(I have also had problems with clones stopping working and requiring sketch to be reloaded.)
     Sends data over openLRS Passthru.
     To do this, open the openLRS configurator for TX , Set serial baudrate(bps) to 9600, data rate(bps) to 9600, Telemetry to "Yes" (This is Passthru)
     Connections to Hobbyking receiver module:
     Arduino TX (Pin TXD1) -> receiver  RX (Serial port pins, 4th pin down fom top - aerial on left)
     Arduino GND -> receiver GND (Serial port pins,1st pin down from top - aerial on left.)
     Voltage divider input to A2
     Other sensor input (e.g Depth) to A3
     Receiver +6v to Vin on arduino
     Arduino serial data default is, serial baud rate (9600) and 8 data bits, no parity,no stop,LSB and not inverted - the default
     Sept 2019-RDF - Voltage Divider. Move to  input from divider set by 4.7kohms and 15k ohms for 12 v battery. Better for  3.3 v input.
     (My original depth calibration depth (Using Tim's depth sensor detailed on SubPirates Forum)  = 3 * (depth - 84); // 84 to set zero)
     July 2020. Working on putting on voltage and current using an INA219 module.
     Aug 2020 This works well now. (Address is 64 (0x40)(From i2c scanner)

    */

    #include <Wire.h>
    #include <Adafruit_INA219.h>

    Adafruit_INA219 ina219;

    void setup() {

     // Open USB serial communications and wait for port to open:
     Serial.begin(9600);
     while (!Serial) {
       ; // wait for serial port to connect. Needed for native USB port only
     }

     uint32_t currentFrequency;

     Serial.println("Starting INA219 current monitor");

     // Initialize the INA219.
     // By default the initialization will use the largest range (32V, 2A).  However
     // you can call a setCalibration function to change this range (see comments).
     // To use a slightly lower 32V, 1A range (higher precision on amps):
     //ina219.setCalibration_32V_1A();
     // Or to use a lower 16V, 400mA range (higher precision on volts and amps):
     //ina219.setCalibration_16V_400mA();
     if (! ina219.begin()) {
       Serial.println("Failed to find INA219 chip");
       while (1) {
         delay(10);
       }

     }
     // Open second hardware serial port
     Serial1.begin(9600);
     Serial1.println("Wake-up Serial1 port!");
     delay(1000); // We wait 1 second

    }

    void loop() {

     // Get data from IN219
     float shuntvoltage = 0;
     float busvoltage = 0;
     float current_mA = 0;
     float loadvoltage = 0;
     float power_mW = 0;

     shuntvoltage = ina219.getShuntVoltage_mV();
     busvoltage = ina219.getBusVoltage_V();
     current_mA = ina219.getCurrent_mA();
     power_mW = ina219.getPower_mW();
     loadvoltage = busvoltage + (shuntvoltage / 1000);

     Serial.print("Bus Voltage:   "); Serial.print(busvoltage); Serial.println(" V");
     Serial.print("Shunt Voltage: "); Serial.print(shuntvoltage); Serial.println(" mV");
     Serial.print("Load Voltage:  "); Serial.print(loadvoltage); Serial.println(" V");
     Serial.print("Current:       "); Serial.print(current_mA); Serial.println(" mA");
     Serial.print("Power:         "); Serial.print(power_mW); Serial.println(" mW");
     Serial.println("");

     delay(2000);

     //Select and process variables to output (round off floating variables)
     int sensorVal = round(busvoltage);     // Round off bus voltage

     int sensorVal1 = abs(current_mA);     // This gives a very simple current draw figure, accuarate to about an amp.
     sensorVal1 = sensorVal1 / 1000;
     sensorVal1 = round(sensorVal1 + 0.5);

     // Read voltage sensor value on A2
     //int sensorVal = analogRead (A2);
     //sensorVal = sensorVal / 76; //  Fiddle factor (originally 67) is calibration value for voltage from earlier software by RDF
     String mysensorVal = String(sensorVal);

     // Read depth sensor value on A3
     //int sensorVal1 = analogRead (A3);
     // sensorVal1 = sensorVal1 / 10; //  Fiddle factor is calibration value
     String mysensorVal1 = String(sensorVal1);

     // print the voltage sensor value
     Serial.println(mysensorVal);
     Serial.print('\n'); // new line
     delay (200);

     // print the voltage sensor value to Serial
     Serial.println(mysensorVal1);
     Serial.print('\n'); // new line
     delay (200);

     Serial1.print(mysensorVal);
     delay (200);
     Serial1.print('\n'); // new line
     delay (200);

     // print the voltage sensor value to Serial1
     Serial1.print(mysensorVal1);
     delay (200);
     Serial1.print('\n'); // new line
     delay (200);

     //Test
     //Serial1.print("RDF");

     delay(10); // We wait 10mS to print the next value

    }

      Current date/time is Wed Oct 28, 2020 7:38 am