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 a guide to past events see the "Shows and Events" section.
Bournville MBC on Sunday 11th August 2024, 10.00 i
::::

Papplewick Pumping Station Sub Weekend, 14th & !5th Sept 2024

P~~~

$$$

Who is online?

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

None


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

Latest topics

» ExpressLRS - 868/915 Mhz equipment
Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment EmptyToday at 8:58 pm by Marylandradiosailor

» Flight controllers as sub levelers
Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment EmptyToday at 8:14 pm by geofrancis

» 868/915 Mhz as a viable frequency for submarines.
Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment EmptyYesterday at 3:21 am by tsenecal

» Futaba -868/915mhz equipment
Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment EmptyYesterday at 3:15 am by tsenecal

» sonar data link
Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment EmptyMon Oct 07, 2024 12:53 pm by geofrancis

» Robbe Seawolf V2
Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment EmptyWed Oct 02, 2024 11:52 am by geofrancis

» Microgyro pitch controller corrosion
Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment EmptyWed Oct 02, 2024 11:32 am by geofrancis

» U Boat differential steering
Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment EmptyWed Oct 02, 2024 12:54 am by tsenecal

» WW2 mini sub build
Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment EmptyThu Sep 05, 2024 8:15 am by david f

Statistics

Our users have posted a total of 12524 messages in 1990 subjects

We have 1019 registered users

The newest registered user is Flyboy21

3 posters

    Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment

    david f
    david f
    AMS Treasurer


    Posts : 2411
    Join date : 2010-11-10
    Age : 74
    Location : Cumbria

    Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment Empty Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment

    Post  david f Tue Jan 21, 2020 12:14 pm

    This project came about because of a conversation with John Wrennall and a modeller at Haydock Park 2019 who mentioned that some Arduinos now have built in WiFi built in.

    Well I think he was referring to these:

    Node Mcu ESP8266 Development Board 12E WIFI CH340G v3 USB ESP12 ESP-12 NodeMcu

    Quite cheap (about £5 on ebay) and quite small. You can use the standard Arduino IDE software.

    This is a very useful "How- to" guide:

    https://robotzero.one/sending-data-esp8266-to-esp8266/

    This shows the transmitter (the 20p coin is for scale!) In my case the 12v battery voltage is reduced by a voltage divider to give a 3.3 v input as a maximum input. You can see the aerial on the right of the board.

    Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment 20200110

    This is the receiver in a waterproof box.

    Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment 20200111

    Conclusion.

    This works very well on the bench and would work well on a surface boat but I have tried it 3 times in my submarine and it doesn't give reliable, useful readings. I think that the very poor  transmission of 2.4Ghz through water is the problem.
    I enclose the software (I will also put it up on my Github) for any one interested. I will also put a link to Model Boat Mayhem because people with surface models may find a simple remote battery sensor useful.
    The telemetry option for openLRS developed by Tim Senecal is still the best option for submariners, I think.

    TRANSMITTER SOFTWARE:

    #include <ESP8266WiFi.h>
    //#include <U8g2lib.h>

    // TX software
    //RDF - Voltage input from divider to A0. 4.7kohms and 15k ohms for 12 v battery and 3.3 v input.

    //U8g2 Constructor List - https://github.com/olikraus/u8g2/wiki/u8g2setupcpp#introduction
    //U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 5, /* data=*/ 4);

    const char *ssid = "davido";
    const char *password = "password";

    const int analogInPin = 0;  // Analog input pin that the potentiometer is attached to
    int sensorValue = 0;        // value read from the potentiometer
    int outputValue = 0;        // value sent to server

    void setup() {
     Serial.begin(115200);
     delay(10);

     // We start by connecting to a WiFi network
     Serial.println();
     Serial.println();
     Serial.print("Connecting to ");
     Serial.println(ssid);

     /* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
        would try to act as both a client and an access-point and could cause
        network-issues with your other WiFi-devices on your WiFi-network. */
     WiFi.mode(WIFI_STA);
     WiFi.begin(ssid, password);

     while (WiFi.status() != WL_CONNECTED) {
       delay(500);
       Serial.print(".");
     }

     Serial.println("");
     Serial.println("WiFi connected");
     Serial.println("IP address: ");
     Serial.println(WiFi.localIP());
     Serial.begin(115200);
     // u8g2.begin();
     //  u8g2.setFont(u8g2_font_logisoso62_tn);
     //  u8g2.setFontMode(0);    // enable transparent mode, which is faster
    }

    void loop() {
     // read the analog in value:
     sensorValue = analogRead(A0);
     sensorValue = sensorValue / 6; // Put divider constant in to get volts directly x 10
     // map to range. The pot goes from about 3 to 1023. This makes the sent value be between 0 and 999 to fit on the OLED
     outputValue = map(sensorValue, 3, 1023, 0, 999);
     
     // print the results to the Serial Monitor:
     Serial.print("sensor = ");
     Serial.print(sensorValue);
     Serial.print("\t output = ");
     Serial.println(outputValue);

     char intToPrint[5];
     itoa(outputValue, intToPrint, 10); //integer to string conversion for OLED library

     //u8g2.firstPage();
     // u8g2.drawUTF8(0, 64, intToPrint);
     // u8g2.nextPage();

     // Use WiFiClient class to create TCP connections
     WiFiClient client;
     const char * host = "192.168.4.1";
     const int httpPort = 80;

     if (!client.connect(host, httpPort)) {
       Serial.println("connection failed");
       return;
     }

     // We now create a URI for the request
     String url = "/data/";
     url += "?sensor_reading=";
     url += intToPrint;

     Serial.print("Requesting URL: ");
     Serial.println(url);

     // This will send the request to the server
     client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                  "Host: " + host + "\r\n" +
                  "Connection: close\r\n\r\n");
     unsigned long timeout = millis();
     while (client.available() == 0) {
       if (millis() - timeout > 5000) {
         Serial.println(">>> Client Timeout !");
         client.stop();
         return;
       }
     }

     Serial.println();
     Serial.println("Closing connection");
     Serial.println();
     Serial.println();
     Serial.println();

     delay(500);
    }

    THIS IS FOR THE RECEIVER:

    #include <ESP8266WiFi.h>
    #include <ESP8266WebServer.h>
    //#include <U8g2lib.h>
    #include <LiquidCrystal_I2C.h>
    #include <Wire.h>

    // RX software
    // Using nodeMCU guide from here  https://robotzero.one/sending-data-esp8266-to-esp8266/
    // Original changed to display on a standard 16x2 LCD (I had plenty available!)
    // Use LCD instructions from here https://www.instructables.com/id/I2C-LCD-on-NodeMCU-V2-With-Arduino-IDE/
    // Select LCD address 0x3F and 0x27 are common
    //LiquidCrystal_I2C lcd(0x3F, 16, 2); // Set address for LCD
    //LiquidCrystal_I2C lcd(0x27, 16, 2); // Set address for LCD
    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address
    // LiquidCrystal_I2C library - https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library

    const char *ssid = "davido";
    const char *password = "password";

    ESP8266WebServer server(80);

    void handleSentVar() {
     Serial.println("handleSentVar function called...");
     if (server.hasArg("sensor_reading")) { // this is the variable sent from the client
       Serial.println("Sensor reading received...");
       int readingInt = server.arg("sensor_reading").toInt();
       char readingToPrint[5];
       itoa(readingInt, readingToPrint, 10); //integer to string conversion for OLED library

       Serial.print("Reading: ");
       Serial.println(readingToPrint);
       Serial.println();
       server.send(200, "text/html", "Data received");

       lcd.clear();
       lcd.print(" Volts: ");
       delay(200);
       lcd.print(readingToPrint);
       delay(1000);
       lcd.clear();
       
       server.send(200, "text/html", "Data received");
     }
    }

    void setup() {
     delay(1000);
     Serial.begin(115200);
     Serial.println();
     Serial.print("Configuring access point...");

     //Use predefined PINS consts for 16 x 2 LCD

     Wire.begin(D2, D1);

     //lcd.begin();
     lcd.begin(16, 2);  // initialize the lcd for 16 chars 2 lines, turn on backlight


     lcd.home();

     lcd.print("David!, NodeMCU");

     WiFi.softAP(ssid, password);
     IPAddress myIP = WiFi.softAPIP();

     server.on("/data/", HTTP_GET, handleSentVar); // when the server receives a request with /data/ in the string then run the handleSentVar function
     server.begin();
    }

    void loop() {
     server.handleClient();
    }
    avatar
    tsenecal
    Guest


    Posts : 321
    Join date : 2015-04-01

    Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment Empty Re: Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment

    Post  tsenecal Tue Feb 11, 2020 4:42 pm

    it appears that the latest rage is "LORA"... Long Range RF.... either 433mhz or 915mhz. the devices are more expensive, but an "arduino" atmega32u4 based LORA device goes for about $20... i would think that would work much better than the esp 2.4ghz equipment.
    david f
    david f
    AMS Treasurer


    Posts : 2411
    Join date : 2010-11-10
    Age : 74
    Location : Cumbria

    Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment Empty Re: Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment

    Post  david f Wed Feb 12, 2020 12:51 pm

    Hi Tim,

    That is very interesting. I wonder if the guy at Haydock Park was referring to a LORA device?

    Running at 433 or 915 is going to be much more successful for our watery purposes.

    Still a bit pricey though. (I assume that two are needed?)

    I wanted something simple and cheap just for battery voltage. Your openLRS telemetry does a lot more than a basic requirement and it seems to have been made fussy because manufacturers have all gone their separate ways.

    Food for thought! Thanks again,

    David
    C-3PO
    C-3PO


    Posts : 95
    Join date : 2018-11-21
    Location : Northamptonshire UK

    Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment Empty Re: Voltage or data measurement by WiFi - Node Mcu (Arduino) - A failed experiment

    Post  C-3PO Mon Feb 17, 2020 11:10 pm

    I got bored reading through technical specs - LoRa seems to use very wide bandwidth (upto 500khz - yes a full half megahertz!!) - I can see that this could soon lead to issues and possible non conformance here in the UK

    My gut says this is more likely to be workable on 868 but not on 433/434 459mhz

    Interested to see what others think/understand


      Current date/time is Fri Oct 11, 2024 10:39 pm