Go Down

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

amundsen

Hello,

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.

Grumpy_Mike

Yes.
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.

amundsen

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

johnwasser

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: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

winner10920

http://code.google.com/p/tinkerit/wiki/SecretVoltmeter
no external connections necessary,  it even works with the attiny series with a little modification


BulletMagnet83


winner10920

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

amundsen

Thanks a lot everyone ! This is very interesting.

Go Up