💬 Battery Powered Sensors
-
@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)
@Oliviakrk Look in comments in the code
// 3.44/1023 = Volts per bit = 0.003363075if 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
-
@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).@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
-
@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
@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.
-
@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?
-
@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?
-
@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.
-
@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.
This post is deleted! -
@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.
-
@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
-
@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
@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. -
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

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