* 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

*STOP PRESS* Coronavirus. A lot of Clubs have already cancelled all activities. Check carefully before you plan any travel

.

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

. ,

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

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

.

Bournville Sub Day, Sunday 13th September

,,,,

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

Who is online?

In total there are 2 users online :: 0 Registered, 0 Hidden and 2 Guests :: 1 Bot

None


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

Latest topics

» Seehund Drawing
Simple telemetry system for openLRS EmptyTue Jun 02, 2020 8:05 am by david f

» Yellow Submarine - Beatles
Simple telemetry system for openLRS EmptyWed May 27, 2020 11:03 am by david f

» Italian CB class from WW2
Simple telemetry system for openLRS EmptyWed May 27, 2020 10:55 am by david f

» Simple telemetry system for openLRS
Simple telemetry system for openLRS EmptyTue May 19, 2020 11:47 am by david f

» New member from Liverpool, England - Krick type v11b
Simple telemetry system for openLRS EmptyFri May 15, 2020 9:35 am by david f

» 3D printed sub kits
Simple telemetry system for openLRS EmptyFri May 08, 2020 6:42 am by SWEnick

» Smoke or Steam generator for submarine models?
Simple telemetry system for openLRS EmptyThu May 07, 2020 9:15 am by david f

» Piston Ballast Systems
Simple telemetry system for openLRS EmptyMon May 04, 2020 9:29 am by david f

» openLRS and 2.4 Ghz and Submarines
Simple telemetry system for openLRS EmptySat May 02, 2020 8:42 am by david f

Statistics

Our users have posted a total of 11143 messages in 1824 subjects

We have 853 registered users

The newest registered user is dreamterre

    Simple telemetry system for openLRS

    david f
    david f
    AMS Treasurer

    Posts : 2101
    Join date : 2010-11-10
    Age : 69
    Location : Cumbria

    Simple telemetry system for openLRS Empty Simple telemetry system for openLRS

    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 20200510

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

    Simple telemetry system for openLRS 20200519

    Depth reading.

    Simple telemetry system for openLRS 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 20200517

    Simple telemetry system for openLRS 20200516

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

    Simple telemetry system for openLRS 20200518

    Simple telemetry system for openLRS 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, Telemotry 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 inout 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 deoth 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.

      Current date/time is Thu Jun 04, 2020 11:46 pm