Hi,
I'm powering my Pro Mini and supporting circuit all with a 7805 reg. Not using the Vin of the Mini... feeding the Vcc with the 7805 Vout.
This is for an automotive project, so the 7805 Vin is generally between 13.6-14.7Vdc.
I'd like to measure the automotive voltage and display it.
I've set up a voltage divider circuit using 560k (R1) for the voltage feed and 200k (R2) for the divider.
Based on the standard formula this gives me a maximum reading limit of 19v.
I'd just like some feedback on this, specifically regarding two areas:
Is the resistor divider circuit values appropriate. I've read a number of posts regarding these values and just want to make sure I'm using the correct size? Should I use a 10k for R2 and adjust the R1 appropriately? Did I pick too large of values?
Is there a feedback (or other ) issue in reading the 7805 Vin with the Arduino being powered by the 7805 Vout?
Thanks and I apologize if I missed any protocols in how I framed this question.
HI,
I would do it in this way. Use the battery voltage as 15 volts. Them I would use a resistor of 10K connected to the battery in series with 5K resistor to ground The middle point goes to input of the Arduino. Then batt_volts = ((5/1023) * analogRead(Ax) ) *3.0;
A 1:2 resistor ratio is ok, but has no over-voltage protection.
Could be dangerous for the Arduino in an automotive application if the picked values are low.
Better to use the the internal ~1.1volt reference. Then you can use a ~1:15 divider.
This sketch uses the ~1.1volt Aref, and averaging. Read the comments.
Leo..
/*
0 - ~17volt voltmeter
works with 3.3volt and 5volt Arduinos
uses the stable internal 1.1volt reference
10k resistor from A0 to ground, and 150k resistor from A0 to +batt
(1k8:27k or 2k2:33k are also valid 1:15 ratios)
100n capacitor from A0 to ground for stable readings
*/
unsigned int total; // holds readings
float voltage; // converted to volt
void setup() {
analogReference(INTERNAL); // use the internal ~1.1volt reference | change (INTERNAL) to (INTERNAL1V1) for a Mega
Serial.begin(9600); // ---set serial monitor to this value---
}
void loop() {
total = 0; // reset
analogRead(A0); // one unused reading to clear any ghost charge
for (int x = 0; x < 64; x++) { // 64 analogue readings for averaging
total = total + analogRead(A0); // add each value
}
voltage = total * 0.0002567; // convert readings to volt | ---calibrate by changing the last three digits---
Serial.print("The battery is ");
Serial.print(voltage); // change to (voltage, 3) for three decimal places
Serial.println(" volt");
delay(1000); // use a non-blocking delay when used with other code
}