Go Down

Topic: Arduino testing its own power source ? (Read 1 time) previous topic - next topic



I wave a 5V Arduino Pro Mini powered from 3 AA NiMH batteries. Is there a way to sense the power with the Arduino and switch a LED on when the voltage drops below a specific value ?

Thank you in advance.


What you do is to switch the input of the A/D to the referance voltage and measure this with a referance voltage of the supply voltage ( the normal state).
Then you can work out the exact value of the 5V from what you measure the known 1.1V to be.


I don't get the idea. Do you mean I should simply connect the power source to an analog input of the Arduino ?


You can measure the internal 1.1V reference voltage relative the AVcc (which is normally connect to Vcc).  If the supply voltage is 5V you would get a reading of about 225 ((1.1/5.0)*1024) if the supply voltage drops to 4V you will get a reading of about 281 ((1.1/4.0)*1024).

Unfortunately you can't use "analogRead()" to read the internal voltage standard.  You will have to set the ADMUX register to 14 by direct port manipulation.  Here is a tutorial that covers the ADC: http://fivefive.wordpress.com/2008/01/23/avr-tutorials-adc/
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


no external connections necessary,  it even works with the attiny series with a little modification



Couldn't you also use this?


you could with external components and change the reference but, the link I had has code for arduino to do it without any external components


Thanks a lot everyone ! This is very interesting.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131