Check Voltage Level

wafel · 4 · 6221

wafel

  • Full Member
  • ***
    • Posts: 12
    • View Profile
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.


wafel

  • Full Member
  • ***
    • Posts: 12
    • View Profile
Is there any way i can check voltage on battery pin in tinyduino?
i need the voltage value at least..


TinyCircuits

  • Administrator
  • Hero Member
  • *****
    • Posts: 108
    • View Profile
    • TinyCircuits Homepage
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










 

SMF spam blocked by CleanTalk