TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: wafel on October 17, 2013, 05:58:45 AM

Title: Check Voltage Level
Post by: wafel on October 17, 2013, 05:58:45 AM
Guys,
how do i check the voltage level of my baterry in Tinyduino?

I want to know when my batter is low, so i can blink the led.
Title: Re: Check Voltage Level
Post by: wafel on October 25, 2013, 12:13:53 PM
Is there any way i can check voltage on battery pin in tinyduino?
i need the voltage value at least..
Title: Re: Check Voltage Level
Post by: TinyCircuits on October 26, 2013, 07:02:08 PM
Hi Wafel,

By default the battery voltage is not directly connected to a readable pin, however this is certainly possible to read using some simple circuitry.  You can get access to the VBATT voltage on any of the prototyping boards - you'll need to route this into one of the analog pins in order to read it.  However the voltage will need to be divided down in order to get it lower than the analog voltage reference.

Here is a simple resistor divider circuit that will do this for you, comprised of two resistors, one 100K ohm and one 25K ohm.   


VBATT      100K          A0           25K         GND
    |-------/\/\/\/-------| -------/\/\/\/\-------|


The voltage at A0 will be equal to VBATT * (25K / 125K).  Or 0.2 * VBATT

Set the analogReference to use the internal 1.1V value, and using an analogRead() on A0, you will get back the ADC value of A0.  The battery voltage will equal 5 * ( ADC_VALUE / 1023 ) * 1.1. 

Thanks,

Ken
TinyCircuits







Title: Re: Check Voltage Level
Post by: wafel on October 28, 2013, 06:13:35 AM
Thanks :)
Perfect!