How it's done
Node sending
signal if ‘Battery Low’.
I built a DIY
cheapest node as published by Martijn Quaedvlieg (no, we are not
related).
The node is powered
by a Lipo 3.7 V cell. Because the Lipo will be damaged if it’s too
deeply discharged and I
don’t like the effects of a ‘starving’
node, I wanted to have a signal if the voltage is getting below 3.5
V.
General warning:
The
application of batteries, especially rechargeable types, is not
without danger.
Be aware of
the specific issues, risks and recommendations for the chosen battery
type.
The choice is
your own responsibility and if you are not qualified, please consult
an expert.
With just 2
resistors and a few lines of code it’s realized.
The internal 1.1 V
Reference of the AT328p is used.
Here is the
circuit:
Here is the code:
int batt = 100; // define batt
in the SETUP:
analogReference(INTERNAL); // Reference Voltage to measure Analog Input
pinMode(A0,
INPUT); // A0 is used to measure the 3.3+ Vcc as an indicator for
“BatLow”
in the Main
Loop:
int batt =
analogRead(A0);
if (batt < 680) {
// Voltage LiPo
below 3.5 V (devided 27K to 100K on Vcc, Vref = 1.1 V)
strcpy(mySdata
,"X");
// mySdata =
the message that will be send
}
How it can be done
if the 3.3 V node is powered by different batteries:
The threshold is
determined including ‘prevent discharging the battery too deeply’
After publishing this I got a valuable comment:
The continuous current through the resistors is approx. 40 microamps, I want less.
For those who are keen on keeping the current as low as possible there is a 'better solution'.
I chose the resistor values in this example because I wanted the minimal number of components.
If the resistor values are increased like *10 or even *100, then a little capacitor (10 nF) has to be added
between the Analoginput and GND. The higher impedance increases the sensitivity for noise.
Peter Quaedvlieg