Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Arduino ProMini 3.3V on 1MHz + RFM69W missing ACKs

Arduino ProMini 3.3V on 1MHz + RFM69W missing ACKs

Scheduled Pinned Locked Moved Troubleshooting
13 Posts 4 Posters 280 Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • electrikE Offline
    electrikE Offline
    electrik
    wrote on last edited by
    #4

    The long sleeps in between your send functions are not really needed, if you would like some time to charge the capacitor (this is done in milliseconds), a delay will also do.
    But that doesn't explain the duplicate messages. Can you post debug log for both situations? If you suspect the drivers, it could be better to open an issue on GitHub

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thenounoursk
      wrote on last edited by
      #5

      I'll post logs this weekend hopefully.

      I take your point on charging the capacitor. It looks like 1ms would be more than enough to charge it completely. I suppose the question is also, how much time does it take for the battery to recover from a send operation? I don't have the right tooling to do a nice numerical analysis on that, but maybe can do something cheeky.

      1 Reply Last reply
      0
      • T thenounoursk

        Hi everyone,

        This is my first post here. First of all, I should say congratulation for the formidable work you're putting in there. I've discovered MySensors about 2 months ago and I'm loving it.

        I've recently built:

        • A MQTT gateway with a NodeMCU + RFM69W
        • A temperature node (Arduino ProMini 3.3v) + SI7021 + RFM69W. Running on a CR2032 cell.

        Initially tested the whole thing for a few days and it works like a charm. But I noticed battery level dropping slowly (well expected I suppose). I thought, maybe I can actually do something to minimize energy used. I read a bunch online and implemented the following:

        • Remove the led (well that one everyone seems to remove)
        • Remove the regulator
        • Add 100uF capacitor between GND and 3.3V on RFM69W (helps battery I've heard)
        • Add sleep instructions here and there in my code to allow the battery to rest. The code is mostly the SI7021 example found in MySensors plus a few sleeps...
        • Disable BOD (otherwise actually noticed that since adding my capacitor, my sensor would struggle to start, because of initial drain taking the battery to ~2.7V I suppose)
        • Lower CPU clock to 1MHz to allow to run when battery gets lower voltage (I read that 8MHz wouldn't be stable around 1.8V but the radio, sensor and arduino could still work at that voltage).

        Now, it still works. And if anyone has any feedback on what I just explained, they would be most welcome as I'm sure I've got more to learn.

        One thing doesn't work as expected: when running on 1MHz, most of the time, my Gateway receives duplicate transmissions of my node. When running on 8MHz (everything else the same), no duplicates. Sensor is close to GW (3m). I suspected maybe on 1MHz I need to increase the ACK timeout of sensor, so I increased it to 2seconds. I can now see duplicate messages being 2s apart on the gateway, so that didn't do the trick.

        My current solution is to not allow retries, but that is really a bad workaround... Anyone has an idea of what I could try to see what is the problem here?

        Thanks everyone.

        rozpruwaczR Offline
        rozpruwaczR Offline
        rozpruwacz
        wrote on last edited by
        #6

        @thenounoursk I really advise You to get a good multimeter with current measurement down to 1uA. Without it You will have hard time to debug problems with high currrent consumption. And I mean high current is about 100uA for a battery powered node. Waiting couple of days to check if current cosumption problem is fixed is not a good idea :) There can be a lot of issues that makes your node consume to much current, both hardware and software. For example, I have a node that had good current consumption, but after some time it started to cosume much more current. It turned out to be a failed power decoupling capacitor. Without multimeter I would never find out what was the cause.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thenounoursk
          wrote on last edited by
          #7

          @rozpruwacz I should have been more precise, I have a good multimeter already :) But when I talked about how measuring how much time it takes the battery to recover after a send operation, I thought about doing it on an oscilloscope... Poor phrasing on my part, my multimeter will be enough to get an idea of how much time it takes, I will just not get the nice chart to back up my experience.

          1 Reply Last reply
          0
          • I Offline
            I Offline
            iahim67
            wrote on last edited by
            #8

            Hi, as a side note - check the datasheet of the 100uf capacitor you have used for the leakage current as it could be as high a few uA which is comparable with the current of a sleeping ATMega328 / Arduino board. Make sure you use a low leakage capacitor for a longer battery life.
            For a low current temperature sensor you can use a thermistor (like 4k7 @ 25 Celsius) in series with a resistor (4k7 1%). Connect one end of the th to the GND, one end of the resistor to a digital output of the Arduino and the common connection of the th and resistor to an analog input of Arduino. You will power on (make the output HIGH) the th+resistor string from the digital out shortly before making the measurement then make the output LOW after the measurement.
            Means you will only use power to measure the temperature for a very short time.
            Here is my code (I am not a professional firmware guy :smiley: ) for such a temperature sensor:

            // ver. v1.2
            /*
              Mini v5
              TH: Th=GND, Series Resistor=3, Middle=A0
              check Radio connections/wires
              check power supply +5V
            */
            
            //Enable debug prints to serial monitor
            //#define MY_DEBUG
            
            #define MY_RADIO_NRF24
            #define MY_NODE_ID 9
            #define DEBUG 0
            #define BATTERY_SENSOR 1
            
            #include <MySensors.h>
            #include <Vcc.h>
            
            #define TH_LIBRARY_CHILD_ID 1
            #define VOLTAGE_CHILD_ID 2
            #define TH_PIN 3
            
            int _nominal_resistor = 4700;
            int _nominal_temperature = 25;
            int _b_coefficient = 3950;
            int _series_resistor = 4877;
            int _pin = 0;
            int batt_report_count = 120;
            
            const float VccMin        = 1.8;
            const float VccMax        = 3.0;
            const float VccCorrection = 1.0 / 1.0; // Measured Vcc by multimeter divided by reported Vcc
            
            Vcc vcc(VccCorrection);
            
            MyMessage msgTemp(TH_LIBRARY_CHILD_ID, V_TEMP);
            MyMessage msgVoltage(VOLTAGE_CHILD_ID, V_VOLTAGE);
            
            void setup()
            {
              //Serial.begin(115200);
            }
            
            void presentation()
            {
              // Send the sketch version information to the gateway and Controller
              sendSketchInfo("TH_LIBRARY@Mini_2xR6", "1.2_FOTA");
              wait(1);
              present(TH_LIBRARY_CHILD_ID, S_TEMP, "TH_LIBRARY");
              wait(1);
              present(VOLTAGE_CHILD_ID, S_MULTIMETER, "TH_LIBRARY_BATT");
              wait(1);
            }
            
            void loop()
            {
              if (batt_report_count == 120)
              {
                batteryReport();
              }
              batt_report_count--;
              if (batt_report_count == 0)
              {
                batt_report_count = 120;
              }
              tempReport();
              smartSleep(180000);
            }
            
            //###############################################################
            
            // Send a battery level report to the controller
            void batteryReport() {
              // measure the board vcc
              float v = vcc.Read_Volts();
              float p = vcc.Read_Perc(VccMin, VccMax);
            #if DEBUG
              Serial.print("VCC = ");
              Serial.print(v);
              Serial.println(" Volts");
              Serial.print("VCC = ");
              Serial.print(p);
              Serial.println(" %");
            #endif
            #if BATTERY_SENSOR
              // report battery voltage
              send(msgVoltage.set(v, 3));
              wait(1);
            #endif
              // report battery level percentage
              sendBatteryLevel(p);
              wait(1);
            }
            
            //##################################################################
            
            void tempReport()
            {
              // set TH pin in output mode
              pinMode(TH_PIN, OUTPUT);
              // set TH_PIN HIGH
              digitalWrite(TH_PIN, HIGH);
              wait(1);
              // read the voltage across the thermistor
              float adc = analogRead(_pin);
              // set TH_PIN LOW
              digitalWrite(TH_PIN, LOW);
              // calculate the temperature
              float reading = (1023 / adc)  - 1;
              reading = _series_resistor / reading;
              float temperature;
              temperature = reading / _nominal_resistor;     // (R/Ro)
              temperature = log(temperature);                  // ln(R/Ro)
              temperature /= _b_coefficient;                   // 1/B * ln(R/Ro)
              temperature += 1.0 / (_nominal_temperature + 273.15); // + (1/To)
              temperature = 1.0 / temperature;                 // Invert
              temperature -= 273.15;                         // convert to C
            #if DEBUG == 1
              Serial.print(F("THER I="));
              Serial.print(TH1_CHILD_ID);
              Serial.print(F(" V="));
              Serial.print(adc);
              Serial.print(F(" T="));
              Serial.println(temperature);
            #endif
              send(msgTemp.set(temperature, 1));
              wait(1);
            }
            
            1 Reply Last reply
            0
            • T thenounoursk

              Hi everyone,

              This is my first post here. First of all, I should say congratulation for the formidable work you're putting in there. I've discovered MySensors about 2 months ago and I'm loving it.

              I've recently built:

              • A MQTT gateway with a NodeMCU + RFM69W
              • A temperature node (Arduino ProMini 3.3v) + SI7021 + RFM69W. Running on a CR2032 cell.

              Initially tested the whole thing for a few days and it works like a charm. But I noticed battery level dropping slowly (well expected I suppose). I thought, maybe I can actually do something to minimize energy used. I read a bunch online and implemented the following:

              • Remove the led (well that one everyone seems to remove)
              • Remove the regulator
              • Add 100uF capacitor between GND and 3.3V on RFM69W (helps battery I've heard)
              • Add sleep instructions here and there in my code to allow the battery to rest. The code is mostly the SI7021 example found in MySensors plus a few sleeps...
              • Disable BOD (otherwise actually noticed that since adding my capacitor, my sensor would struggle to start, because of initial drain taking the battery to ~2.7V I suppose)
              • Lower CPU clock to 1MHz to allow to run when battery gets lower voltage (I read that 8MHz wouldn't be stable around 1.8V but the radio, sensor and arduino could still work at that voltage).

              Now, it still works. And if anyone has any feedback on what I just explained, they would be most welcome as I'm sure I've got more to learn.

              One thing doesn't work as expected: when running on 1MHz, most of the time, my Gateway receives duplicate transmissions of my node. When running on 8MHz (everything else the same), no duplicates. Sensor is close to GW (3m). I suspected maybe on 1MHz I need to increase the ACK timeout of sensor, so I increased it to 2seconds. I can now see duplicate messages being 2s apart on the gateway, so that didn't do the trick.

              My current solution is to not allow retries, but that is really a bad workaround... Anyone has an idea of what I could try to see what is the problem here?

              Thanks everyone.

              electrikE Offline
              electrikE Offline
              electrik
              wrote on last edited by
              #9

              @thenounoursk did you ever solve the issue of the duplicate messages on 1mhz?

              T 1 Reply Last reply
              0
              • electrikE electrik

                @thenounoursk did you ever solve the issue of the duplicate messages on 1mhz?

                T Offline
                T Offline
                thenounoursk
                wrote on last edited by
                #10

                @electrik no not yet. It's still on my list of things to do though.

                1 Reply Last reply
                0
                • electrikE Offline
                  electrikE Offline
                  electrik
                  wrote on last edited by
                  #11

                  In the mean time I got it working. I thought I was using the HW model, but it turned out that it was a regular W model. Also I'm using the new driver, and this works perfectly.
                  Sometimes I do receive duplicate messages but I believe that is caused by the connection itself i.e. no acknowledge is received by the transmitter, and that resends the message.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    thenounoursk
                    wrote on last edited by
                    #12

                    Thanks for the tip, I should give a try with the new driver then.

                    My node actually died a week ago, battery dead. Thing is, a week before that, I checked the battery with a multimeter and it looked in real good shape. So I'm not sure what happened but I'm leaning towards something unexpected rather normal life cycle of a battery. Out of interest, what's your typical lifetime (assuming your setup is similar)?

                    1 Reply Last reply
                    0
                    • electrikE Offline
                      electrikE Offline
                      electrik
                      wrote on last edited by
                      #13

                      I can't tell yet. The node I'm now using is a wall switch, operating on a CR2032 battery. No idea yet how long it lasts.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      17

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular