Hackable Badge Battery Voltage on Display?
shawnerz
Posts: 6
Hello all.
I've got a newbie question. I have my badge. Played with the code. Everything works great. I thought I read a forum post that someone was able to get the badge to display its battery voltage. The gist of the thread was that it was not measuring properly.
I have searched but I cannot find that thread. I would like my badge to display the battery voltage as well. Oh, I poked around in github as well, and didn't find what I was looking for.
Is it a register I have to read from? Is there an ADC to query?
And just to verify, the Hackable Badge is built around a Propeller I, right?
Thank you very much in advance,
-Shawn
I've got a newbie question. I have my badge. Played with the code. Everything works great. I thought I read a forum post that someone was able to get the badge to display its battery voltage. The gist of the thread was that it was not measuring properly.
I have searched but I cannot find that thread. I would like my badge to display the battery voltage as well. Oh, I poked around in github as well, and didn't find what I was looking for.
Is it a register I have to read from? Is there an ADC to query?
And just to verify, the Hackable Badge is built around a Propeller I, right?
Thank you very much in advance,
-Shawn
Comments
I/O pin 0 (P0) of the Propeller is connected to an RC network with a 0.01uF capacitor charged from the battery through a 300K resistor. P0 is connected through a 1K resistor to the capacitor. You can set P0 to output a zero which will discharge the capacitor, then change P0 to input mode and measure how long it takes to charge up to the switching threshold of P0 (until P0 becomes a 1). There's some variation in the switching threshold from device to device and it will also change with the supply voltage. Best thing to do is to use an accurate voltmeter to calibrate this battery voltage measuring setup. There's a discussion of this technique in the Basic Stamp Reference Manual under the RCTIME statement and some discussion here.