I've been reading how to measure voltage using an arduino uno (cheap knock off) analog pin. I have a project that will be powered by a 12v SLA battery. I do have a 7805 to get 5v to the arduino and a few components. I would like to turn on a red LED when the voltage gets down around 11v as that is when the battery is considered low and should be put on a charger. I also intend to eventually use a barrel jack connector so you can use a 12v wall wart to power the circuit in addition to using the battery. The barrel jack would have a switch that would disconnect the battery when you plug in the adapter. I've read power adapters can output more than their rated voltage, some quite high. I suppose it may come down to you get what you pay for.
I plan to use a voltage divider to bring the input voltage (battery, or adapter) down to 5v max to use on the arduino pin, and I'm worried about putting more than 5v on the analog pin. A website I found shows the use of a zener diode and capacitor to help protect overvoltage on the pin. I'm still learning a lot, I'm definitely new to most electronic designs, but this seems to make sense to me after reading through it. I've included a screen shot in the attached Circuit-1.png file. I've seen some websites that just use the divider, and some that use the divider with just the zener diode. And then this one which includes the capacitor. I guess my first question is I'm just looking for confirmation/discussion if this is a decent circuit to use to measure the voltage? Seems easy and simple. I realize the addition of the adapter (or more specifically, 2 power source options with different "fully charged" values) doesn't help matters. I don't have the wall adapter so for now, I'll have to assume a maximum voltage that would supply the power and then test when I do get a 12v wall adapter.
Second question: If I over assume say 20v max input and the divider is designed to bring 20v down to 5v (20 / 4 = 5), then a full battery charged is around 13v, so would the divider read a full battery at 13 / 4 = 3.25v on the arduino input pin? I know I need to look up voltage divider calculator, I'm sure that will help me with this question. It's on my to do.
Third, do you need a resistor in series with the zener to control current through it, similar to an LED+resistor setup?
I think I'll have a transistor connected to another arduino pin to "turn on" the measuring circuit so it isn't drawing power constantly. I'm sure I'll have a few more questions down the road.
I plan to use a voltage divider to bring the input voltage (battery, or adapter) down to 5v max to use on the arduino pin, and I'm worried about putting more than 5v on the analog pin. A website I found shows the use of a zener diode and capacitor to help protect overvoltage on the pin. I'm still learning a lot, I'm definitely new to most electronic designs, but this seems to make sense to me after reading through it. I've included a screen shot in the attached Circuit-1.png file. I've seen some websites that just use the divider, and some that use the divider with just the zener diode. And then this one which includes the capacitor. I guess my first question is I'm just looking for confirmation/discussion if this is a decent circuit to use to measure the voltage? Seems easy and simple. I realize the addition of the adapter (or more specifically, 2 power source options with different "fully charged" values) doesn't help matters. I don't have the wall adapter so for now, I'll have to assume a maximum voltage that would supply the power and then test when I do get a 12v wall adapter.
Second question: If I over assume say 20v max input and the divider is designed to bring 20v down to 5v (20 / 4 = 5), then a full battery charged is around 13v, so would the divider read a full battery at 13 / 4 = 3.25v on the arduino input pin? I know I need to look up voltage divider calculator, I'm sure that will help me with this question. It's on my to do.
Third, do you need a resistor in series with the zener to control current through it, similar to an LED+resistor setup?
I think I'll have a transistor connected to another arduino pin to "turn on" the measuring circuit so it isn't drawing power constantly. I'm sure I'll have a few more questions down the road.
Attachments
-
64.3 KB Views: 18