πŸ’¬ Battery Powered Sensors

  • 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

  • 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:

  • @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.


  • 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
    and should we move this conversation to another topic /PM as this is not relevant to this thread.

Log in to reply

Suggested Topics

  • 32
  • 14
  • 133
  • 12
  • 23
  • 60
  • 17
  • 85