Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 10 months ago.
Reading supply voltage?
Is there a simple way to read the supplied voltage on the LPC11u24 ?
2 Answers
10 years, 10 months ago.
I assume you refer to a voltage on the Vin pin. Use a simple voltage divider to make sure the measured voltage is between 0V and 3V3 and connect that voltage to one of the AnalogIn pins.
10 years, 10 months ago.
Ok, thats what I was thinking. What resistance values would you recommend for that job, considering I am connecting a battery?
You need to calculate the resistance based on maximum battery voltage, the maximum voltage of 3V3 on the AnalogIn pin and preference to use relatively large resistance values to keep current low since you are running on battery. Suppose you have 12V battery, series resistors R1 and R2, with R1 connected to battery and other end to R2 and AnalogIn, other end of R2 to GND. You get:
R2*12 / (R1+R2) = 3.3 Aiming for a current of 1mA gets you: R1=(12 - 3.3)/0.001 = 8K7 and R2 = 3.3/0.001=3K3. Round to nearest values and check again.
posted by 20 Jan 2014