๐Ÿ’ฌ Battery Powered Sensors


  • Mod

    There have been some users that went that way but personally I am preferring to use a single AA LiFePo4 battery with standard voltages and clocks



  • I am a newbie and have some thoughts about the battery level that I did not find in this forum.
    The 8MHz 3.3V Arduino Pro Mini can handle down to roughly 2.8V.
    If I have understood the calculations in the sketch correctly then the analog value of A0 is 1023 at 3.44V and 0 at 0V.
    This means that at 2.8V the value is about 830 = 83% and under this, the Arduino stops working. Is this right?
    If this is correct, I wonder if someone has changed the calculation in the sketch so that the battery percentage becomes 0 at 2.8V?
    This would mean that the battery percentage becomes a more real value on the battery level.


  • Mod

    It's a simple percentage calculation that you can do it in the code



  • @gohan Thanks for your reply, you can show me how the code should look.


  • Mod

    void batM() //The battery calculations
    {
      delay(500);
      // Battery monitoring reading
      int sensorValue = analogRead(BATTERY_SENSE_PIN);
      delay(500);
    
      // Calculate the battery in %
      float Vbat = sensorValue * VBAT_PER_BITS;
      send(msgVBat.set(Vbat, 3));
      int batteryPcnt = static_cast<int>(((Vbat - VMIN) / (VMAX - VMIN))*100.);
      Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");
    
      // Add it to array so we get an average of 3 (3x20min)
      batArray[batLoop] = batteryPcnt;
    
      if (batLoop > 2) {
        batteryPcnt = (batArray[0] + batArray[1] + batArray[2] + batArray[3]);
        batteryPcnt = batteryPcnt / 3;
    
        if (batteryPcnt > 100) {
          batteryPcnt = 100;
        }
    
        Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %");
        sendBatteryLevel(batteryPcnt);
        batLoop = 0;
      }
      else
      {
        batLoop++;
      }
    }
    

    This is the function I use, I just define the VMAX and VMIN in the beginning of sketch. The function calculates an average of 3 measurements before sending the value


  • Hardware Contributor

    @gohan said in ๐Ÿ’ฌ Battery Powered Sensors:
    Hello, i didn't know why you add 4 measures (batarray) and you divide by 3 the sum .


  • Mod

    @tonnerre33 good catch! maybe it's an optimistic value ๐Ÿ™‚


  • Mod

    I actually didn't look much at battery percentage, but I prefer looking at the voltage that gives me a better idea of how the battery is doing since I can log the values on a graph



  • @magnusf It is important to know that the battery voltage is non linear in respect to how much juice left. Just search for "battery discharge curve" to see how much it depends on battery type, current and temperature. So calculating the percentage is actually meaningless unless You exactly know how much current your board sucks at what temperature and what type of battery You use.



  • Instead of using "DC-DC Step Up Boost Module 5V" for a HBS, wouldnยดt it make sense to just use 2 AA batteries for the nano and 2 additional batteries (i.e. four in a row) for the HBS?


  • Mod

    What's the hbs?



  • Same as on the motion example - HC-SR501, 4.5V- 12V.



  • Maybe only a third Battery, as the HBS only needs 4.5V..



  • To answer my own question: yes, it seems to work. Searched around and read a while, found this:
    https://forum.mysensors.org/topic/6511/hc-sr501-3-3v-randomly-sends-tripped-when-radio-is-on/22
    Best addition imho ,no need for step up / down. ๐Ÿ˜„



  • Hi,
    I'm trying to build a Soil Moisture sensor with NiMh battery and solar panel as in another post. I use a stepup converter to 3.3V connected on the VCC of a pro-mini 3.3V. The sensor seems working when connected to FTDI USB device, ut once I remove the power from FTDI, no more communication. I measured the voltage on the output of the stepup which indicates 3.26V. Is it norml or a defective step-up ? And should I remove the regulator of the pro-mini as suggested above or not ? (in article above, it states the regulator is not necessary, but it doesn't say if pro-mini would still work if regulator remains there).
    Thanks for your support


  • Mod

    @ricorico94 what does the debug output from the node and the gateway say?

    What regulator are you using? Most regulators produce power that is too noisy to be usable by the nrf24 radio (you didn't state which radio you're using so I'm just guessing here, based on the most common problems). What capacitor(s) are you using after the regulator?

    See https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help/ for the most common problems and how to diagnose them.

    Also see https://www.mysensors.org/build/battery for more information about battery powered sensors.



  • Hi,
    As regulator I use a stepup like that one:
    https://fr.aliexpress.com/item/DC-DC-0-8-3-3V-to-3-3V-Step-Up-Boost-Power-Module-For-Arduino/32819660926.html?spm=a2g0s.9042311.0.0.27426c37HEbdcz

    I use a NRF24L01 as radio module following the connection guidelines from Mysensors. I did not add any capacitor to 3.3 and ground of the NRF24L01.
    I connected the vO of the stepup to the VCC (the VCC between RX and GRD and not the RAW) of the arduino pro mini 3.3V as indicated in this post:https://forum.mysensors.org/topic/4045/solar-powered-soil-moisture-sensor
    I use indeed a similar lamp with its small NiMh battery (1.2v) and its solar panel.
    The NRF24L01 is connected on GRD (between RST and RAW) and on VCC (between A3 and RST). I hadn't put any capacitor.
    I tried following your advice to add a 0.1uF ceramic capcitor between VCC (the one between RX and GRD) of pro mini and its ground, but apparently, I face same issue.
    (I did not solder the capcitor yet, I only connected through the pins I usually use for the FTDI)

    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.2.0
    26 TSM:INIT
    28 TSF:WUR:MS=0
    34 TSM:INIT:TSP OK
    36 TSF:SID:OK,ID=4
    38 TSM:FPAR
    75 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2084 !TSM:FPAR:NO REPLY
    2086 TSM:FPAR
    2123 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4130 !TSM:FPAR:NO REPLY
    4132 TSM:FPAR
    4169 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6176 !TSM:FPAR:NO REPLY
    6178 TSM:FPAR
    6215 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8222 !TSM:FPAR:FAIL
    8224 TSM:FAIL:CNT=1
    8226 TSM:FAIL:DIS
    8228 TSF:TDI:TSL
    18229 TSM:FAIL:RE-INIT
    18231 TSM:INIT
    18237 TSM:INIT:TSP OK
    18241 TSF:SID:OK,ID=4
    18243 TSM:FPAR
    18280 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    20289 !TSM:FPAR:NO REPLY
    20291 TSM:FPAR
    20328 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    22337 !TSM:FPAR:NO REPLY
    22339 TSM:FPAR
    22376 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    24385 !TSM:FPAR:NO REPLY
    24387 TSM:FPAR
    24424 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    26433 !TSM:FPAR:FAIL
    26435 TSM:FAIL:CNT=2
    26437 TSM:FAIL:DIS
    26439 TSF:TDI:TSL
    36442 TSM:FAIL:RE-INIT
    36444 TSM:INIT
    36450 TSM:INIT:TSP OK
    36454 TSF:SID:OK,ID=4
    36456 TSM:FPAR
    36493 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    38502 !TSM:FPAR:NO REPLY
    38504 TSM:FPAR
    38541 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    40550 !TSM:FPAR:NO REPLY
    40552 TSM:FPAR
    40589 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    42598 !TSM:FPAR:NO REPLY
    42600 TSM:FPAR
    42637 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    44646 !TSM:FPAR:FAIL
    44648 TSM:FAIL:CNT=3
    44650 TSM:FAIL:DIS
    44652 TSF:TDI:TSL
    54657 TSM:FAIL:RE-INIT
    54659 TSM:INIT
    54665 TSM:INIT:TSP OK
    54669 TSF:SID:OK,ID=4
    54671 TSM:FPAR
    54708 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    56717 !TSM:FPAR:NO REPLY
    56719 TSM:FPAR
    56756 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    57493 TSF:MSG:READ,0-0-4,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    57499 TSF:MSG:FPAR OK,ID=0,D=1
    58765 TSM:FPAR:OK
    58767 TSM:ID
    58767 TSM:ID:OK
    58769 TSM:UPL
    58806 !TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
    60815 TSM:UPL
    60852 !TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=NACK:1
    62861 TSM:UPL
    62863 TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=2,st=OK:1
    64872 TSM:UPL
    64909 !TSF:MSG:SEND,4-4-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
    66918 !TSM:UPL:FAIL
    66920 TSM:FPAR
    66957 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK:
    68964 !TSM:FPAR:NO REPLY
    68966 TSM:FPAR
    69003 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    71012 !TSM:FPAR:NO REPLY
    71014 TSM:FPAR
    71051 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    73060 !TSM:FPAR:NO REPLY
    73062 TSM:FPAR
    73099 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    75108 !TSM:FPAR:FAIL
    75110 TSM:FAIL:CNT=4
    75112 TSM:FAIL:DIS
    75114 TSF:TDI:TSL
    

    Apparently, it sends correctly packets but can't receive any ACK or message from the gateway.
    I got this log by connecting a FTDI adapter with only the RX/TX cables. If ever I connect also the GRD and 3.3V of the FTDI, then I get no error message at all (even without the capacitor) and Domoticz receives all updates (and also sends as I use Domoticz to send customized sleep duration to the sensor).

    Should I try adding both the 0.1uF to VCC/GRD of arduino and also a 4.7uF to the 3.3/GRD of the NRF24 as suggested in the "Connect the Radio" page ?
    Any idea ?
    br,
    Rico


  • Mod

    @ricorico94 yes add the recommended capacitor.
    Also check the gateway log at the same time you check the node log. That will let you know if the gateway isn't hearing the node, or if the node isn't hearing the gateway.



  • Thanks for the advice, I'll try that.
    For the log on the gateway side : I use a gateway on the raspberry pi itself (as per https://www.mysensors.org/build/raspberry ) of my Domoticz installation. Is there an easy way (like via telnet) to get the logs other than by creating the new line in the config file ? Maybe the 3rd option proposed with "mysgw.pipe" ? (in such case, do I need to reboot whole raspberry after modifying the config file?)


  • Mod



  • Thanks to another arduino forum, I found what was wrong.. probably indeed a stability of power due to step-up converter. In that forum, they were explaining that receiving is more sensitive to power noise than sending data and that in such case, it's good to add a 100uF capacitor on 3.3V and GRD of radio module. I tried 100uF and it worked.. I then tried with 47uF and it's still working. (I had tried with 0.47uF and it was not working at all)

    In the "Connect Radio" guidelines, of Mysensors, it is stated that a capacitor of 0,47-47uF is improving reliability but that "the exact size usually doesn't matter" which was misleading in my case.
    Could I suggest to rephrase that sentence into "the exact size usually doesn't matter, but you can try 47uF if 0.47uF still doesn't work, especially if sending data works well and not receiving data." ?

    Edit for Erratum: please read 4.7-47uF instead of 0,47uF-47uF. Tests I had made were with 4.7uF as well, not 0.47uF
    br,
    Ricorico94


  • Mod

    @ricorico94 great input, thanks! I have updated the page, except that I changed 0.47uF to 4.7uF in your text since the recommendation is 4.7 - 47)



  • oups, indeed. I'll edit my post as well to avoid confusion as well. Thank you for your support, I appreciated a lot.
    By the way, I could never find how to get the logs in my gateway installed on raspPI. But that's another post. ๐Ÿ˜‰



  • Hello together,

    I'm just trying to get the voltage measurement to work. But there is something wrong. I built everything as shown above and uploaded the program to the Arduino pro mini. The only thing I changed is the sensing Pin A0 -> A3
    In debug mode I see the following (the supply voltage is constant 3.3V):

    Battery Voltage: 3.12 V
    Battery percent: 92 %
    
    Battery Voltage: 2.40 V
    Battery percent: 71 %
    
    Battery Voltage: 2.32 V
    Battery percent: 69 %
    
    Battery Voltage: 2.31 V
    Battery percent: 68 %
    
    Battery Voltage: 2.29 V
    Battery percent: 68 %
    
    Battery Voltage: 2.30 V
    Battery percent: 68 %
    
    Battery Voltage: 2.33 V
    Battery percent: 69 %
    

    What could be the reason? That doesn't make sense to me.



  • @maschler You may be picking up noise which will give an unsteady voltage during the ADC sample.
    A 0.1uF electrolytic cap between the analogue pin and ground in parallel with the resistor should stabilise it sufficiently.
    I use this arrangement with much higher resistances which are known to increase noise, the capacitor maintains a steady voltage sufficient for the ADC sample period.
    One thing worth checking with a multimeter is what the actual voltage is on supply and on the pin. The 1.1v bandgap is sometimes not exactly 1.1v, particularly on clones. Once you know the two values you can modify the ratio and you should get reliable and accurate readings.


  • Mod

    The 1.1v reference could be + or - 10%, but a small ceramic cap on near the analog pin should help to stabilize the reading. Also taking 3 measures and then sending the average is a good way of minimizing errors


  • Plugin Developer

    I'm looking for a USB rechargeable battery that can deal with very low power drain, so that I can power an Arduino Nano. Most power packs will not work with very small currents - they turn themselves off. So ideally it should not be too clever..

    Does anybody have a favourite?


  • Mod



  • It would be great to add to this arctle that if you want to be battery powered outdoors with temperature below zero - you have to use lithium batteries (FR6 for AA) (yes, batteries, not li-ion accumulators!) (for example ultimate lithium energizer, also could be found lithium batteries from other vendors), because Alkaline (LR6 for AA) will be frozen and loose their capacity heavily. If i remember it is >50% at -10 C and death at -20 C. Same problem for li-ion accumulators - when liquid is frozen - electrons are stucked...
    Also would be great to add some link about battery/accumulator types, advanteges and disadvantages, but i have no links in english, easy-to-read and in one place...

    But i have very great link about battery-powering that really should be added here, but in advanced section:
    http://www.gammon.com.au/power



  • @nekitoss Not sure where you got your information but my Gas Node is on it's second year running on the same two Varta AA alkalines and been down to -20 on more than a few occasions last winter, typically 4 months below -10... Currently the temperature is -3 and headed to -8 overnight, voltage is 2.98, will probably need to replace them in autumn 2019...



  • The tap point could be bypassed with a 0.1 uF capacitor

    Can someone explain, how exactly I should connect this capacitor? Should it be between A0 and GND? Would be great to see this capacitor in the graphic.



  • @benhub That rather depends what you are quoting from, as could not find the original statement.
    If it is to do with stabilising voltage from a point on a resistor divider to read it on the analogue pin, the capacitor is from the analogue pin to ground.
    It's purpose to dampen oscillations long enough for the ADC to sample the voltage, but usually only where high value resistances are used.



  • The quote is from this sample : Measuring and Reporting Battery Level

    Use a 1Mโ„ฆ (R1) and 470Kโ„ฆ (R2) resistor in series, connected to the positive terminal on the battery and ground and then connected the tap point to the A0 input on the CPU.

    The tap point could be bypassed with a 0.1 uF capacitor to keep the noise level low, at this otherwise high impedance point.



  • @tonbor Yes, the capacitor goes from the analog input to ground.


  • Mod

    @skywatch @tonbor @benhub @zboblamont thanks for your input. I have updated the page. I added the text in bold:

    The tap point could be bypassed with a 0.1 uF capacitor (connected in parallel with R2) to keep the noise level low

    and updated the image. Please let me know if something is still unclear.



  • Perfect!



  • If you remove the regulator and power with 2xAA batteries, do you only need the TX and RX pins for the FTDI programmer and if so can you use the RX and TX pins on the left side instead of the top FTDI pin connector? Trying to think how to connect the FTDI programmer without connecting to it's VCC and ground when there is no regulator on the pro mini.


  • Mod

    @macgyver33 you need rx, tx and gnd.

    The pins on the left side and the ones on the top work the same way, you can use the ones on the left if you prefer.



  • Is exist something "last wish" in MySensors, when battery go below predefined level the device to send last massage to the GW and go sleep forever.
    The idea is the controller/application to have information about the device and to be known this device is dead and need battery change.


  • Mod

    @tiana the controller will know the last battery level. Just set the predefined level in your controller?



  • Yes but in this case the last massage will be the same like the previous, only the battery level will be below some predefined value. i don't like this. I will think how to solve this.



  • @tiana - Of course you can do this in your code.

    Just read the battery level and when it gets to the lowest level you decide upon (maybe a little testing needed here) then include the line...

    if(battery_level_read < battery_low_level){
    send.msg(your last message)
    sleep(long time period)
    }

    You need to define all the things above as normal for variables (floats for the battery reading and levels and UL for the long sleep)....



  • @tiana I agree with @mfalkvidd , normally it is the Controller which sends out the warning to change battery, certainly Domoticz has this provision incorporated?
    Here the batteries are read at approximate 12 hour intervals, and Domoticz is preset to signal a warning below 1.7v, which is days or even weeks from actually dying. If I'm away or forgetful it will cease updating anyway and flag Red on the display.
    Once you have established the consumption curve for your batteries until flat, easy enough to set the warning threshhold before the Node dies...



  • @tiana
    Create dummy contact sensor on your node and if node sends last message, it will trigger this contact before "die".
    So controller knows, that it was last message and node is off.
    But better is allow controller do its job, like wrote all others.
    I personally check battery level and "no incoming messages in supposed interval" to send alert to my e-mail ( and SMS ).
    In this example tank level sensors sends every 10min, so after 3 messages lost, I will be informed.

    0_1560340917673_2019-06-12-135250_1920x1080_scrot.png



  • Thanks for the ideas, i will modify the code to use LowPower lib and will cut the power to the radio module to increase battery live, when last massage is send the node will never power the radio module, will be only short interrupt and go again to sleep forever. This will give me power usage 20times more than self battery discharge. Which have to give me node uptime around 260days with coin cell battery.



  • @tiana
    And for what will be that offline node usefull?



  • Door/Window/Button



  • @tiana
    Forever sleeping door sensor with low battery?

    "when last massage is send the node will never power the radio module"

    Why door sensor, if it never sends message?



  • @kimot
    At all of the time 328p will be in sleep forever, when button is pressed interrupt is triggered and wake the 328p power ON the radio send info power OFF radio and go sleep forever.
    Only when battery level go below critical level. the radio stay OFF and only interrupt and sleep forever.

    I am almost ready with the drawings of the hardware, and next week start work on software... you can see the project in the openhardware.io i gonna upload it later tomorrow.



  • Hi Guys, I need some help on this guide.
    I am running a Nano with radio and Si7021 sensor on 1Mhz to lower the required operating voltage, other than this is unmodified no desoldered led or regulators etc.. I tried running it on 2x 1.5v AA batteries connected to Vin and GND, the LED powers on but nothing else happens. When using 3 AA batteries it does send data, so apparently it needs more than 3v. How can I ensure that the setup is fine with 3V, I bought the 3V AA battery holder but I cannot seem to run it at that currently. Which steps can I take to do so? Help is appreciated.


  • Hardware Contributor

    @Sebex I run all my nodes with 2xAA rechargable NiMh (or 1 x LifePo4) with Si7021.

    1. Use MiniCore bootloader (https://github.com/MCUdude/MiniCore)
    2. Set BOD at 1.8V for NiMh
    3. Set speed @8Mhz ๐Ÿ™‚

    Enjoy your 1 or 2 years node life at transmit every 5 minutes.

    PS Remove the LED and the regulator, of course ๐Ÿ˜‰

    PPS I use spare AtMega328p on custom PCB board, but same result with a couple of Nano without regulator.



  • @sineverba thanks, I got it working and it's up and running. Still have to desolder the led and remove the regulator, will do that later.
    Regarding the BOD, what happens if I disable it? Will it run for longer as it does not shutdown? Or is any voltage below 1.8v bad for the arduino?

    A bit off topic maybe, but I was wondering how the 'pros' around here make the sensor small and sturdy for Arduino's with Si7021+ 2xAA battery pack. My DuPont wires seem a bit loose, so I'm wondering whether I should solder them. And perhaps someone 3d printed a case for an Arduino+Batterypack or some sorts.


  • Mod

    @Sebex said in ๐Ÿ’ฌ Battery Powered Sensors:

    And perhaps someone 3d printed a case for an Arduino+Batterypack or some sorts.

    https://www.mysensors.org/build/print might have something you can use. openhardware.io has a few devices with cases.


  • Mod

    @Sebex said in ๐Ÿ’ฌ Battery Powered Sensors:

    Regarding the BOD, what happens if I disable it? Will it run for longer as it does not shutdown? Or is any voltage below 1.8v bad for the arduino?

    1.8V is the minimum voltage according to the atmega328 datasheet. Below that it might work, but it might also do all sorts of strange things. We've seen reports of nodes getting stuck on continuous transmit, blasting radio signals all the time which blocks all other nodes from communicating. So keeping the bod at 1.8V is probably a good idea. 2xAA have almost no power left at 1.8V anyway. See https://www.avrfreaks.net/forum/aa-alkaline-discharge-curve-5ma for some discharge curves.



  • @mfalkvidd thanks makes sense, eventually I will switch to NiMh. Had a look at the different cases, gives some good inspiration thanks for pointing in the right direction!

    Now that I want to desolder the regulator and LED on the Nano, I just want to verify something, since the video shown is about the mini pro.

    (1) Is the circled part in the image below, indeed the regulator on the Nano?
    (2) On the battery powered sensor page, step 4 states to cutout the Vout pin. Why does this lower power consumption, and how can I locate this on the Nano?

    alt text


  • Mod

    @Sebex I have never tried to run a Nano on battery, so I don't know but that looks like a regulator.

    The Nano operates at 5V and consumes much more power than a 3.3V Pro Mini.

    Yes, the regulator will consume power if it is not disconnected.


  • Hardware Contributor

    The big chip to the left is also a serial-usb converter which needs to be removed, making it not possible to program from the usb socket. Along with these components there are resistors and other components that might blead current so i dont think its that easy compared to just doing it to a Pro Mini.



  • Ok thnx guys, guess I'll be ordering a pro mini very soon!


  • Hardware Contributor

    @Sebex - i think thats the easiest way, but sometimes its fun to try to create something new - its not impossible, but I would try to reverse engineer the nano (already done - search arduino nano schematic) and there you have to identify all "not essential" components and remove those (ie, making it a big pro-mini) to be able to get the current down as much as possible.



  • @Sebex said in ๐Ÿ’ฌ Battery Powered Sensors:

    A bit off topic maybe, but I was wondering how the 'pros' around here make the sensor small and sturdy for Arduino's with Si7021+ 2xAA battery pack. My DuPont wires seem a bit loose, so I'm wondering whether I should solder them. And perhaps someone 3d printed a case for an Arduino+Batterypack or some sorts.

    You may want to try wire wrapping. Itโ€™s faster than soldering, sturdier than DuPont and you can connect multiple wires on same pin. Works wonders for gnd and vcc. Of course if the project is yanked harder, the wire wraps come out.
    I made this small video for my home automation group in India. - hence prices for the wire wraps and tool are mentioned in local currency. I leant about this amazing technique from Andreas Spiess
    my video
    guy with Swiss accent



  • @Puneit-Thukral Both DuPont and wirewrap are generally considered as prototyping methods. For final device build and production more secure connections should be implemented.



  • @skywatch Agree with every word of yours. Not justifying myself here but wirewraps are deployed all over my house. I pour some hot glue to ensure that they donโ€™t come loose. And then a 3D printed enclosure takes care of the elements.
    Also, it helps me to quickly repurpose the hardware.
    Itโ€™s just another approach.
    In an ideal world - where PCB shipments never arrive from China and locally they are a but expensive , this is my poor manโ€™s alternative. 90F6D2B8-A1BA-4156-A23E-B7783A89FA49.jpeg 97A8362E-7B49-433F-8709-42E49469B161.jpeg Example photos. The coin cell holder is diy. Used shaving blades and wrapped wires and taped to create a circuit.



  • @Puneit-Thukral I understand 'poor mans alternative' soooo well! ๐Ÿ˜‰

    Glue on the wirewraps will help keep them in place and mitigate thermal stress to some degree and also stop dust and moisture. But over time the glue will change and shrink/crack and things will start to become strange with that arrangement.

    It's hard to beat a good soldered joint in the end, that's why all the commercial kit is done that way.

    Nice case BTW. I also am working on 3D printed cases for some nodes. Another 6 weeks of lockdown and I should have started on them! ๐Ÿ˜‰



  • @Puneit-Thukral interesting! Seems as a better option than Dupont, I'm gonna look into it.
    You mention hot glueing the wires yourself as extra protection. But I imagine you can also put a layer of solder on it right?



  • @Sebex yes, of course. I have done that as well. In case I need to repurpose something , removing solder completely away is a tougher job for me than peeling away a layer of glue. Guess, I am just lazy. ๐Ÿ˜ƒ



  • @Puneit-Thukral haha okay I see.

    Another question, your case that you use in the video snaps onto the pins perfectly it seems. Did you 3d print that yourself? I'm looking to 3D print a case for my pro mini and some other sensors that snaps in a similar way so that nothing moves around. However I'd rather copy a proven design than figuring out the tolerances myself.



  • @Sebex Yes, I 3D printed on my ender 3 and I am using this on nodemcu running ESPhome. But I did not design it. Here is the Thingiverse link to it.
    Nodemcu case

    I would love to do similar case and a larger case like this to fit other boards. Its rock solid. I do not have skills to make a linear pattern like this. I think I should figure out how to do it.



  • @Puneit-Thukral cool, from what I read the pins are the same size as on Arduino's. I'll use this design to create one for myself.



  • @Sebex Do share the STL - it will be great and if you use Fusion360, then may I request for the F3D file.. I am semi-skilled when it comes to designing



  • @Puneit-Thukral Will do!
    After closer inspection the pins of the NodeMCU seem to be a lot bigger in size. However I am struggling to find the correct sizing of Arduino Pro Mini pins (width/thickness). The spacing between pins and length of them are easy to find but I cannot find the thickness at all. Do you have an idea?



  • @Sebex Will this help
    https://grabcad.com/library/arduino-pro-mini-1
    and should we move this conversation to another topic /PM as this is not relevant to this thread.



  • @mfalkvidd, on the image I see the following marking in red
    ProMiniModBatterySavins.png

    VCC ==> N/C

    Do you know what the meaning is?
    This VCC pin and the other VCC pin at the bottom of the image are connected. I verified with the multimeter.
    So, what's the purpose of this remark?

    These pins at the right are used to program the pro mini. I had no problems to program after removing the led and the power regulator. The programmer used the VCC to power the pro mini without any problem...



  • @evb I believe that the reason is to physically (and electrically) isolate the voltage regulator from the circuit. Then only VCC will work and not RAW.

    Essentially the same as removing the led or it's series resistor (only one or the other will do) and the regulator from the board.



  • @skywatch, you mean that in normal conditions with the power regulator, we connect the power supply (max 16VDC) to the raw pin and can take 3.3V or 5V, depending on which version, at the pin VCC?
    And that now it isn't possible anymore with the regulator removed?

    I would propose to change the picture :

    • there are 2 VCC pins, so the current picture is confusing
    • adapt the drawing and mention to connect the battery (2xAA) 3V directly to VCC pin at the bottom (not the VCC pin in the programming row of contacts!)

    @skywatch and @mfalkvidd, what do you think?



  • @evb said in ๐Ÿ’ฌ Battery Powered Sensors:

    @skywatch, you mean that in normal conditions with the power regulator, we connect the power supply (max 16VDC) to the raw pin and can take 3.3V or 5V, depending on which version, at the pin VCC?
    And that now it isn't possible anymore with the regulator removed?

    Yes, because the regulator will drain batteries faster using raw than connecting an appropriate voltage to VCC....

    I would propose to change the picture :

    • there are 2 VCC pins, so the current picture is confusing
    • adapt the drawing and mention to connect the battery (2xAA) 3V directly to VCC pin at the bottom (not the VCC pin in the programming row of contacts!)

    @skywatch and @mfalkvidd, what do you think?

    I think it is up to the user to decide what pins they want to connect to and why.


  • Mod

    @evb I don't know what the N/C text means. Presumably N/C stands for Not Connected, but I don't understand what isn't (or shouldn't?) be connected, so I can't say anything about that part unfortunately.

    The device can be powered through any of the two Vcc pins. Use the one that is most convenient.

    I am not aware of any Arduinos that can handle 16V input on the raw pin. Most clones don't even handle 12V.

    If the regulator is removed, the Arduino can no longer be powered through the raw pin.



  • @mfalkvidd That's why I propose to adapt the article and image ๐Ÿ™‚

    If even experienced people like you don't know what it means, what should beginners think?
    I was confused and did some extra research on schematics, etc on the internet and measurements on my pro mini, afraid to blow up my only TTL to USB programmer after the modification of the pro mini for saving power consumption ๐Ÿ˜“

    The 16V was found on a schematics from the arduino.cc (https://www.arduino.cc/en/uploads/Main/Arduino-Pro-Mini-schematic.pdf). I use typically a 9V power adapter to be safe.

    @skywatch You are right that the user finally decides what VCC pins he or she will connect, but we can help him and give a hint : if he uses the right VCC pin to solder his battery wire, he will have a hard time to connect his TTL to USB programmer...


  • Mod

    @evb yes I see your point. But changing things without understanding the background is troublesome, in my experience. Whoever created the original image probably had a good reason to write the N/C part. Therefore, I would prefer if any of the "Ancients" (i.e. people who joined the project before me) could chip in.



  • @evb MySensors is a a technical project that involves both hardware, software and firmare. It is not that easy for everyone to follow a single example and then get all that they want.

    Think of it as a leanring curve. You already found something that is not the way you want it to be for your use. Many others will agree with that. Some want it a different way.

    The main objective is to learn all you can (or need) to get your projects to where you want them. Some out there won't have a single battery node at all, some will be more advanced in battery power conservation than the case in this thread.

    I flagged a faulty 'build' example more than 2 years ago, but it is still there and still wrong. But mine works as it should because I studied the data sheets and did it the right way. Change does not come quickly it seems.

    You have to put time and a lot of effort into this unless you already work in such an area or have a degree in associated methodolgy.



  • @skywatch unfortunately, that is also the impression I have, the documentation is not always up to date and it is a laborious process to get it improved. ๐Ÿ˜ž

    MySensors is a great project, but the learning curve is not negligible. Making it easier for beginners with real-world examples might make that learning curve a bit easier.

    I've already mentioned it, but one example is the workflow of the open source project Home Assistant. The setup of the documentation and the possible pull requests for improvement are easier to get accepted.

    If @mfalkvidd now manages to find and to wake up the 'Ancients', this article might be able to be improved anyway ๐Ÿ˜€ ๐Ÿ‘


  • Hardware Contributor

    @mfalkvidd Don't know if I'm qualified, but I've vague memory (or a wild guess). I think there were some pro-mini models that lost connection to one vcc-pin if you made the cut after the voltage regulator. And btw I never really know why the cutting method was so popular.



  • @m26872, your memory is correct. There are or were pro-mini models who lost connection on the VCC pin at the right if you removed the power regulator. (https://forum.pimatic.org/topic/383/tips-battery-powered-sensors/2).

    My batch of chinese pro mini's are not loosing their connection with the VCC pin at the right.

    @mfalkvidd, you can maybe adapt the wiki article with this extra info?



  • Meanwhile I found following forum topic : https://forum.mysensors.org/topic/2067/my-slim-2aa-battery-node. Thanks @m26872 ๐Ÿ™‚

    @mfalkvidd, I insist ๐Ÿ˜‰ , if modifying these 'official' site articles turns out to be so difficult, can't a new section not be added like for example 'User experiences' or 'Advanced use' or 'Real world examples' or ... ?
    Now we are obliged to read through hours of forum topics, hoping to find more information somewhere.
    On one hand, this is of course instructive, but on the other hand it also wastes a lot of time looking for answers.
    If we already had a starting list of some topics from experienced users, the learning curve would already be smaller.

    I started my battery crusade months ago by ordering some Arduino Pro Mini's from our Chinese supplier AliExpress following the official site article.
    Because I could not obtain the given consumption of current, I began to search further.
    Today after hours of searching and reading on the forum, I realize that this choice was actually not the right one.
    I probably had better ordered the custom PCB from @m26872 and used a barebone 328P, or a Moteino or a Canique or...

    As far as the current of my pro mini is concerned, I'm stuck at a minimum of 133ยตA.

    • pro mini without power led and power regulator
    • refused using the MiniCore packet to 1.8V BOD and 1MHz internal
      • board : ATmega328
      • clock : internal 1 MHz
      • BOD : BOD 1.8V
      • EEPROM : EEPROM retained
      • Variant : 328P / 328PA
      • Bootloader : Yes (UART0)
    • only one open or closed contact on pin D3 with external pull-up of 1M ohm
    • radio is a RFM69HW
    • sketch is using the mysensors sleep function with interrupt wake up (MySensors lib version 2.3.2).

    To test if it was the radio module not completely sleeping and causing this consumption, I tested the same on a other pro mini (no power led and no power regulator, same refusing), without any external hardware, using the LowPower sketch from https://andreasrohner.at/posts/Electronics/How-to-modify-an-Arduino-Pro-Mini-clone-for-low-power-consumption/
    ==>same measurement : 133ยตA
    So the radio module is not the raison!

    So what is the cause of this higher consumption?
    The quality of the Chinese clone boards?
    Or is there still external hardware on the board consuming some current? The external crystal still present for example?

    Pro mini schematics.jpg

    On the pro mini, there is a led connected to the SCK pin. I think that will add an extra of +-1mA when the radio is active?
    But it has nothing to do with the sleep current of 133ยตA...


  • Mod

    @evb sorry for the late reply. I noticed your post earlier, but quickly realized I would need some time to catch up and grasp the full discussion. Now, when I finally have time to try to catch up, I realize that this is way beyond my capability of understanding. But if you provide instructions, I can paste them into the pages you deem relevant.



  • @mfalkvidd
    Ok, the first point is all about the image with the mention N/C
    (see https://forum.mysensors.org/topic/4796/battery-powered-sensors/232)
    We didn't know why this was set on the image.
    Now we do: there were or are pro mini's, if you desolder the voltage regulator, the mentioned VCC hole is not connected anymore.
    --> if you have a pro mini where this is the case, you can't use anymore the usb-to-ttl programmer like that because the pro mini won't be powered on anymore by the VCC of your programmer. You must connect the VCC pin of the programmer with a wire to the other VCC hole.
    --> in the other case, like mine pro mini version, no problem, the VCC hole at the right is still connected.

    The second point is all about the struggle to change/adapt/update existing site articles with updated/corrected/extended information ๐Ÿ™‚
    I see that most site articles have the submenu 'Related Content'. In most articles this is empty. Can't we use that to link to forum topics with more information, I mean forum topics with a great deal of explanation or real world examples.
    So that the reader has directly more information to read on the subject, without to be obliged to read hundreds of forum topics before finding the ones with adequate information.
    For example I started with the pro mini, because mentioned in the site article, but today I'm aware that this was maybe not the way to go...
    An example of such a forum topic is : https://forum.mysensors.org/topic/2067/my-slim-2aa-battery-node.


  • Mod

    Thanks @evb. I have added the content:
    1e7e3f54-9b88-4110-a3ce-3974d84395cf-image.png

    As for the related content, I am not aware of any way to affect that part. To my knowledge, each page links to its own forum thread. For the battery page, it links to the forum thread we are currently posting in.


  • Mod

    @evb said in ๐Ÿ’ฌ Battery Powered Sensors:

    As far as the current of my pro mini is concerned, I'm stuck at a minimum of 133ยตA.

    So how low do you want to go? The original article mentions 120uA, so you seem to be pretty close to that value.



  • @Yveaux, after your comment, I did a search on '120' and you are right, it is even mentioned at the beginning of the article! ๐Ÿ˜ฒ
    I think I was to focused on the table of the Radio Power Consumption and on the forum topic https://forum.mysensors.org/topic/2067/my-slim-2aa-battery-node with a sleep consumption of:
    The Sleep Mode Power Consumption
    I measured the sleep mode current draw to be 1.5uA when it's set to interrupt wake up and 5.8uA when it's set to timer wake up.

    So the 133 ยตA is indeed very close to the 120ยตA mentioned!
    So my node is functioning in the wanted consumption range, nothing wrong! ๐Ÿ™‚
    Thanks.


  • Mod

    one of the eternal problems with documentation: There is always something missing that should be added, but there is also always too much information for someone to read and comprehend.


  • Mod

    hek kindly explained to me how the related content works. Google generates it based on their magic. So that's why I was unable to find out how to affect it.
    018ACF73-A5F4-46A1-9051-7513E4A9AF8E.png



  • @mfalkvidd, thanks for searching this out ๐Ÿ™‚
    So it is not really usable as a new section for linking adequate forum topics.

    Can we add then a new section called for example 'More (advanced) information' and put there more information for users wanting more (advanced) information? It can be extra text information or here for example a link to a advanced useful forum topic like I already mentioned.

    What do you think about it?
    My intention is to let others avoid the mistake I have made.
    If we can provide some targeted links to topics that go deeper on the (basic) content of the article, then that is a win-win situation. The user gets his information and new ideas faster and the topic starter gets recognition for his work ๐Ÿ™‚
    As a user and certainly a beginner, it is sometimes overwhelming to search the forum and to distinguish useful topics from unusable ones.


  • Mod

    @evb yes, adding a new section is easy. Iโ€™ll add one when Iโ€™m not on mobile.


  • Mod

    New section added



  • Does enabled myDebug and some Serial.print statements (with serial port disconnected) affect power consumption of the node?



  • @APL2017 I have no hard evidence, but logically this will take a little more processor time, so a little more power consumption.
    But in my opinion, this is going to be negligible as long as you don't have thousands of lines with serial.print statements.



  • @APL2017 debug and serial print are for developmenat only. They will use more power and slow the system (node) down slightly.

    When things are working well, remove debug and serial print from your sketches.


  • Mod

    I keep my debug statements. If the node starts to act up, I want to be able to connect a logger and se what is happening without having to flash the node first.



  • If I remember correctly, writing to the serial port takes about 10s / baud rate for a single byte. That's a little unter 90ยตs at 115200 baud (common for Arduinos clocking 16 MHz at 5V) or about 1ms at 9600 baud (1MHz for 3V or less).

    Imagine we are transmitting two messages per wake cycle and print another few custom lines to the serial port as well, that may result in about 500 bytes total. This would then add another 45ms on a fast clocking Arduino (115200 baud) or 0.5s (9600 baud) - plus likely some overhead - to the time the microcontroller spends in an active state.

    According to the datasheet (p.312), an ATmega328P clocking at 1MHz consumes about 0.5mA in an active state at about 3V. So, from here on, you could calculate how drastically (or not) an additional ~0.1 - 0.7s of active time per wake cycle would impact the runtime of the battery.

    Since it's possible to run a node for a year or much longer off a set of batteries if it doesn't send lots of messages every few minutes, I doubt you would be able to notice a difference between disabling debug prints or keeping them.

    It is usually much more important to keep the current consumption during the power down phase as low as possible, than shedding off a few ms of active time.



  • @evb Hello. I am the maker of the Canique MK2 boards. I started just like you with the website from Andreas Rohner, desoldering the LED and desoldering the voltage regulator from such a chinese board until I realized this is the wrong way round.
    As far as I recall, I've seen voltage regulators consume something in the order of 100uA when reverse powered. So that might be a hint.
    The external crystal should not be drawing that much current. Using a 16MHz oscillator current can go as low as 4uA with watchdog enabled - in theory and on boards built with minimum consumption as a design goal.

    To your question regarding the SCK pin: yes, if it is connected to a LED every clock pulse on the SCK pin (when SPI is enabled) will make the LED draw current.

    You also have these kinds of troubles (SPI drawing too much current when active or inactive) with chinese boards having a BME280 on them for example. If you have high quality standards, the stock chinese boards won't fit your needs.



  • @evb little info regarding the LED on the SCK pin.
    Assuming it is a red LED with a forward voltage of 1.8V, considering the chip is powered with 3.3V and considering the 330 Ohm resistor in series with the LED, the additional current draw when SCK goes high should be about 4.5mA.


Log in to reply
 

Suggested Topics

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts