💬 Battery Powered Sensors



  • Any thoughts on what I could do to fix the issue permanently without the multimeter?


  • Mod

    why don't you connect the radio directly to battery?



  • this is very wierd ... maybe try another nrf module ? also try what gohan suggested. But it should work as it is. I have similar configuration, but the boost converter has pass trough mode, so i can switch it on and off from the atmega and have no problems with that setup, no matter if the boost converter is os or off, the communication is ok. Can you upload a picture of your setup ? maybe we see something you didn't realize is important to say.


  • Hardware Contributor

    @FatBeard - Could it be that the step up booster are making alot of noice. When you connect your multimeter it works in some way like a filter and reduces the noice?

    I have made alot of these sensors and i strongly suggest you connect i like @gohan suggest - radio directly to the bat.

    This is how i have created my EasyPCB and with alot of trial and error - radio + booster isnt a good idea.

    https://www.openhardware.io/view/4/EasyNewbie-PCB-for-MySensors



  • @sundberg84 Ok, thanks guys. I'll try your suggestions out tonight. I would have preferred to do it through the step up to get the most out of the batteries but maybe this is not practical.


  • Mod

    maybe you could use the booster, but you would need to analyze the kind of noise and build a specific filter for that.



  • @FatBeard boost converter has limited efficiency, this means that it eat the battery power. Nrf can work down to 1.9 V so it is not so obvious that the booster actually will make your sensor live longer.


  • Mod

    It can help drainig the battery to even lower voltages, but the tradeoff is lower efficiency and noise


  • Hardware Contributor

    Search the forum. Booster VS not booster - its always a tradeoff.
    Some people go further and skip booster and lower BOD on the arduino instead.
    I would say 1.9V is pretty good... I have had my longest temp sensor now since the beginning (Almost 3 years) and changed 2xAA once. If you are using sleep and measure once you will get away with a long lasting sensor.


  • Mod

    At 0.95V per cell, an alkaline battery has delivered about 99% of its total capacity. Look at a discharge curve like this:
    0_1498143146830_IMG_1741.PNG

    So if the booster has more than 1% overhead, using a booster to power nrf24 and atmega328 will give worse battery performance than running directly off 2 alkaline batteries.



  • Thats for the response guys. So tried connecting directly to the battery. I cut the trace on the pcb, then soldered a wire directly from the vIn to the positive leg of the 4.7u cap that leads to the radio. No joy though. Still same problem.

    To the point about disabling bod, i have done that already, my issue with that setup though is that my dht22 seems to give inconsistent measurements when operating. It would give readings a degree apart every 5 minutes when the temperature would have remained a lot more stable. I assumed this to be due to the 2x batteries running at just a tad below 3v, while the dht22 is rated at 3.3v. Hence i thought the stepup would fix this problem.


  • Mod

    Get a more serious sensor like sht31 or si7021 😉


  • Hardware Contributor

    @FatBeard - I use this setup, run the radio from the battery and arduino and dht22 from booster without problems. It should work. About the readings... as gohan said... the dht22 is known for... not that good quality



  • I've actually ordered some bme280s which I'm waiting on, I think they will work down to low voltages too. So hopefully that will sort this issue by not needing the step up.

    I would like to still to be able to figure out this problem though. I tried removing the dht22 completely to see if it was contributing to the problem, no luck. I've tried various capacitors over the ground and vout to no avail.

    How would I go about analysing noise on the circuit?



  • @sundberg84 I'll also take a look at your pcb. I was trying to achieve a pcb like that. A generic one to use with various sensors. I Was hoping to do it myself for the sake of learning. But I may have change tact.


  • Hardware Contributor

    @FatBeard - I would start by changing the Nrf24l01+ - there are some really bad ones out there.
    Second I would rewire everyhing from/to the radio. After that I would rewire everything else and maybe change the arduino. As you said, removing all sensors and try debug in "bare minimun" (Power, Arudino and Radio) is a good idea. You can create a fake motion sensor sketch for example sending 1/0 with a 10 sec delay in between just to test the setup (without sensor attached).


  • Hardware Contributor

    I'm using an approach read some thread bottom. Direct 2XAA to the Atmega barebone @8Mhz with BOD disabled and step up (not very efficient) to port the voltage of the batteries to a 3.3v for the DHT22. I'm reading the voltage with "secret voltmeter" example posted (https://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/ )

    The Atmega sleep for 10 minutes, take reading and if different sends to the gateway (as your sketches). I want shutdown the booster, as it is not very efficient. I did have a debate on arduino forum: https://forum.arduino.cc/index.php?topic=488315.0

    Basically, a part that I don't absolutely "cut the ground" with a NPN, otherwise I could have issues with different potential grounds etc etc, I don't know anymore if my design is secure and can works.

    For all friday, saturday and sunday my node was power on without issues, but I don't want my house burning for a short circuit from batteries...

    This is base fritzing draw:

    alt text

    And this is the real pictures of node:

    alt text

    And final this is the not-so-efficient booster: https://www.amazon.it/gp/product/B06XHJCHX6/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1 and regulated exit to 3.3v.

    (Voltage goes down from friday to today from 2.74 to 2.63).

    Am I wrong with my connections? Thank you to all....



  • @sineverba I gave up trying to cross connect power controls directly and went for bistable telecoms relays, 100mW fire 30ms max latched stay open until you reverse signals from + & - pins. Works a treat, powered only for duration of latch....pity the sensor it controlled was shit, but hey ho....small steps


  • Hardware Contributor

    @zboblamont

    A bistable could cost more than entire node 😄

    But it could be an idea... instead of NPN. But remain my doubt.... for the moment, with node powered in this mode..... Am I in danger of burn battery / node / house? 😞


  • Mod

    If I were you I'd go for an I2C sensor that could also work at low voltage, this way you could also power the sensor via a digital pin and turn it off before entering the sleep function to save extra power.


  • Hardware Contributor

    @gohan

    What sensor do you use? Seems interesting the Bosch BM280 that has also the pressure but seems it wants the 3.3v...


  • Mod

    I am testing SHT31 and BME280 but it is on the power hungry side and temperature is reading +0.5/+0.7 °C more, while the SHT31 is +-0.2°C



  • @sineverba I think the small latching Axicom 3v signal relay I used was around 2 euro, but they were sold in packs of 10, so expensive if no use for the other 9 🙂 The objective was low current low voltage short power duration, I found that the enable pin for the booster used more power when system was sleeping... switching the 5v booster by relay ensured no current leakage, 2 pins from the Arduino to control it, 30mA for 30ms to open, same to close it, as and when required to power the 5v ultrasonic... Arduino had it's own battery pack and booster but spends most of it's time in deep sleep so power consumption is peanuts.


  • Hardware Contributor

    @zboblamont
    Do you want post your schema // picture of your node? Thank you in advance 🙂



  • @sineverba None are finished, as waiting on the replacement ultrasonic to arrive. I posted photos of the original booster and JSN board at https://forum.mysensors.org/topic/4810/distance-sensor/43
    when seeking opinions on potential noise issues. The tiny relay is also shown there.
    The external nodes will all be Whisper Nodes (essentially a customised pro-mini), 2 have RTCs on board to take ultrasonic readings on two tanks, the rest respond to events.


  • Hardware Contributor

    Atmega on breadboard, 8MHZ, no Xtal, BOD disabled.

    I have a question and an issue.

    This is exactly the breadboard (missing only the NRF, connected direct to the battery and not to the stepup and NRF has the 4.7mF capacitor and works very well on every other node).

    alt text

    This is my sketch > https://pastebin.com/raw/6Kxm238q

    1. Can I remove one of the two 104 capacitors? Or I need both? Atmega feeded directly from battery, I remember.

    2. With this setup, the node *doesn't trasmit and if I connect the serial (via FTDI232) Atmega floods it with strange characters and doesn't stop (I did try all the bauds, but default is 115200). The leds on FTDI232 blinks continuosly, 1 blink 1 strange chars printed on monitor serial.

    2a) If I remove totally the ground between rails or remove totally the booster (so, for breviti, I don't give anymore power to the DHT22) the node trasmits very well (of course only the voltage) and serial works

    2b) If I feed the node with 3.3v (e.g. from the FTDI232) the node transmits and serial is all ok.

    At the end, seems that DHT 22 (rated for max 6V) doesn't want the 4.92V OR Atmega crash with this voltage.

    PS I have the stepup to 5V 'case I did wrong the order..... 🙂

    Thank you to all!


  • Mod

    @sineverba your wiring looks quite odd. Especially compared to https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/overview
    Where did you find the wiring guide?


  • Hardware Contributor

    @mfalkvidd do u mean the DHT? I can assire you that resistor is between data and VCC 😉 maybe semms strange for need of arrangement on frtzing....... in effect at 3,3 it works and it works in another noce (at 3,3) i would understand because at 5v it doesnt works and serial is flooded ...... I could also post a picture of real breadboard 🙂

    Thank you!


  • Mod

    @sineverba yes, you're right. It looks a bit different but the connections are equivalent. Sorry for the confusion.


  • Hardware Contributor

    @mfalkvidd no problem ! I can understand the difficult to understand schemas of other people 😉 do you nave btw somw idea for my issues and queation (if I can remove a caos, for example).... Thank you


  • Mod

    @sineverba sorry, I don't. I have no experience with the bare atmega.



  • How about using rechargeable batteries instead of alkaline? They would be 1.2V instead of 1.5. vmax would be 2.8V ?


  • Hardware Contributor

    @Oliviakrk
    I use recheargeable. At full charge both are 2.74...
    DHT22 at 2.74 doesn't read. It is rated for 3.3v - 6v



  • @sineverba
    Yes, so a stepup before DHT 22 is required. And it works...But..I have issues with measuring battery level.

    int batteryPcnt = sensorValue / 10;
    

    Always gives something around 74-77%. Even if I use batteries straight of the charger (Panasonic/Sanyo Enelops, which are 1,3 -1,4V when taken of the charger)



  • There is minor correction in the battery level measurement calculation. It should be 1.1 * (1 * 10^6 + 470 * 10^3) / (470 * 10^3) = 3.44V


  • Mod

    @Oliviakrk Look in comments in the code

    // 3.44/1023 = Volts per bit = 0.003363075
    

    if your batteries put out a total of 2.8V the voltage divider is set to use a Vmax of 3.44V (that suits the alkaline batteries), that is probably why. If you want you could change the voltage divider for a lower Vmax



  • @sundberg84 To give you an update. I've changed from a dht22 sensor to a bme280 i2c sensor. The sensor is running off a4 and 5 and power is gotten directory from 2aa batteries. My original problem is gone in that it's working fine as a mysensors node. My issue though is when in sleep mode, i'm running at 1ma, when i would expect to be down in the low ua area. Any thoughts? The code i'm using is based off of this thread: https://forum.mysensors.org/topic/3816/bme280-temp-humidity-pressure-sensor/5


  • Hardware Contributor

    @FatBeard I looked at the datasheet and you should expect only a couple of uA... not mA. I would first disconnect the sensor and make sure it's not the other setup that draws power. Did you remove led and volt. reg.?

    If the sensor still draws power I would either try another one or power it from a digital pin and turn power off before sleep with LOW.



  • @sundberg84 Thanks Sunberg, pretty much sorted now. It was the sensor, i changed libraries and it solved my problem. In theory i was using the forced read with both, but only the sparkfun bme280 library worked in reducing the power. To the best of my knowledge, i'm now running at 6ua most of the time with a 60ms (i timed from beginning to end of the loop method) jump to 1amp every three minutes to get a reading. It's difficult for me to capture the amps properly as when i put my uni-t digital multimeter into the circuit, the nrf stops working. Any thoughts on why that might be?


  • Mod

    1 Amp is definitely a lot. I think it can't be a correct reading


  • Hardware Contributor

    @FatBeard - as @gohan said - 1A can not be correct. Something is wrong.
    If the radio does not work, and the sensors if fishy... I would disconnect it and run the radio/atmega only and fake a sensor value to send and see what happens.



  • @sundberg84 @gohan. Apologies , that's a typo on my part. It jumps to 1ma do 60ms from 6ua. Which I'm happy with I think. My question was more how I can measure it properly. The multimeter seems to be effecting the circuit.


  • Hardware Contributor

    This post is deleted!

  • Mod

    @FatBeard actually what you really need to measure is the sleep current as it is the state where the node will be spending all of its time. Where are you connecting the multimeter for measuring current?



  • @gohan between positive end of one of the two aa batteries and where it enters circuit. If I start off by having battery connected, the release it slowly with the multimeter attached and without breaking circuit I get my 6ua. However after the timer runs out and the radio comes back on I'm stuck at 1ma. The radio at that point doesn't want to work and it doesn't return to 6ua


  • Mod

    @FatBeard the burden voltage of your multimeter might be too large, which would reduce the voltage to the atmega below its working level.
    You're measuring current, so the meter must be in series with the power supply. It's not clear to me how you can remove the multimeter without breaking power to the atmega.


  • Mod

    You could try to add a booster to power the Arduino or change the multimeter 😀


  • Hardware Contributor

    Hi to all!
    I have a issue reading of voltage on pin A0 of an ATMEGA 328 barebone mounted on a breadboard.

    This is the image

    alt text

    The purple pin goes to A0.

    The rail on the bottom coming direct from batteries, with a multimeter I read that they have 2.73V. On monitor serial, % of battery is about 1-2% and voltage reading is about... 0.004 and floating about 0.004 - 0.010 ....

    Can I imagine an issue with pin A0 itself? I have about 10 Atmega spares 🙂 and I will test another one... but thinking about this issue.

    I did try also removing the 0.1uF cap, without any change.

    The reading function is the same of this sketch.

    Thank you very much!



  • Hi guys, if your Arduino is equipped with an ATMega 328P then it could go down to 1.8V at lower frequencies like 1MHz (8MHz internal RC oscillator / 8 by default).
    Or you can use the internal low power 128KHz RC osc eventually ...
    It means you could power both the Arduino and the radio directly from the battery string and consume even less current.
    Just wondering if anyone tried these cases so far?


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


Log in to reply
 

Suggested Topics

50
Online

11.4k
Users

11.1k
Topics

112.7k
Posts