Is is Possible to check the Supply's power level by connecting the 4V (via a 10K resistor and a LED) to an analog pin, where you read it using the analogRead ?
I am asking this because I do not want to break my Arduino
Thanks in Advance!
ikkentim
Is is Possible to check the Supply's power level by connecting the 4V (via a 10K resistor and a LED) to an analog pin, where you read it using the analogRead ?
I am asking this because I do not want to break my Arduino
Thanks in Advance!
ikkentim
What 4V? What power supply?
majenko:
What 4V? What power supply?
The arduino's power supply
You want to measure the Vcc (+5V) line, or the incoming voltage (Vin)?
majenko:
You want to measure the Vcc (+5V) line, or the incoming voltage (Vin)?
The arduino's power supply which is being supplied at the Power jack.
You will need to pass that through a voltage divider. I would recommend something around a 1:3 ratio.
First get a 220K? and a 470K? resistor. Measure their resistances and make a note of them - they won't be quite what they claim to be.
Connect the 220K? resistor between the ADC input and ground. Connect the 470K? resistor between Vin and the ADC input. Be sure to do it in this order if the power is connected, or you will instantly kill you chip.
Now calculate the multiplier for the potential divider. This is the sum of the two resistances, divided by the resistance of the 220K? resistor - so, for example, (465000+218000)/218000 - the result should be somewhere around 3.
You can now read in the value from the ADC. Divide it by 1024.0, then multiply it by 5.0*. That is the voltage read by the ADC pin. Now multiply that by the multiplier calculated above. That should give you the voltage of the input.