Would someone please illustrate for me where I solder wires to the Power shield for a battery pack if I don't use the provided battery connector?
-Steve
There are 2 pads underneath the connector itself. Or you can use "VBAT" and GND on the right of the connector.
I see them. Thanks for the clarification.
I am trying to get an accurate voltage reading from the power shield using the following code snippet from the blog:
int batteryReading = analogRead(A7);
float battV = ((float)batteryReading * 3.3 * 9)/(1023*2.976);
I'm using 3 Eneloop batteries to power the shield and the data sheet says they produce 1.2v, so I replaced 9 with 3.6. I'm not sure what 2.976 represents and if that number needs to changed in my case.
Thanks
-Steve
Hm, you could do it this way, somewhat simpler:
int V = analogRead(A7);
map(V, 0, 1023, 0, 3600) * 100/47;
You're mapping the output of the voltage divider by the divider ratio. I think this should work...
Shouldn't we map the value from A7 to the max value coming out of the voltage divider?
If vMaxBattery is 3.6V we should do something like:
vMaxOut = vMaxBattery.100/(100+47)
int V = analogRead(A7);
V=map(V, 0, 1023, 0, vMaxOut) * 100/47;
This should give the right battery level - thoughts? Seems to work in my code anyway :-)
Yes you can top it off at your max voltage and that would give you max resolution. If you exceed that then your A7 range would max out.