Best or any way to get battery before regulator
-
As I understand after some failed attempt to do a soil moisture sensor with battery check included I can't use any analog pins when using this method described in Battery Powered sensors.
My sensor looks like this:
And this does it impossible to use the VCC library since I have a regulator.
Any other way to get the batterylevel in my setup?
-
@Martin-Tellblom why can't you use analog pins? You need one of these to measure. As your battery voltage is lower than the Arduino vcc you do not need a voltage divider. Just connect the battery (+) to an analog pin.
-
If I use this code:
#if defined(__AVR_ATmega2560__) analogReference(INTERNAL1V1); #else analogReference(INTERNAL); #endif
And try to use the analog pins for this soil moisture sensor the values I get from the other analog pins goes all crazy with its values
-
@Martin-Tellblom don't use the internal reference, stick to the external (default)
-
@AWI How do I do that? This is my first battery node tryout
-
@Martin-Tellblom Try to comment out the
//analogReference(INTERNAL1V1);
-
@AWI So that should be enought? I'll try that
-
analogReference(DEFAULT);
is the alternative for using a 5v (vcc) reference.
-
@AWI But that is always 5V until the end of the battery since I use a step-up or am I thinking completely wrong here
-
If you are using the internal ref 1.1 you need to divide the voltage on the pin down to this level.
If you like in the example using a 1M and 470K you will have a approx 1Volt in the point.
-
@Martin-Tellblom The 5 volt is the reference... the analog pin is where you measure with respect to the reference. Try reading this article
-
@AWI said:
e 5 volt is the refer
Once again. Big thank you @AWI . As you understand I'm new to this battery thing and it's kind of driving me crazy