I have a circuit like this that has a 12vDC power supply. I would like to measure the voltage on either side of each of the lights with the arduino's analog input pins, but the arduino's max voltage is 5v.
How would I keep the voltage at least proportional to its value while making it less than 5v?
Normally to read voltage from the arduino, I would get the value, which is a number in between 0 and 1023, then multiply it by 5/1023 to give me a voltage between 0 and 5 volts. Could I just stick a resistor between the point on the circuit and the arduino, then multiply the value from the input by 12/1023?
-
\$\begingroup\$ This site has a built in schematic tool (Crtl-M). For future reference. =-D \$\endgroup\$Tyler– Tyler2017年01月13日 18:26:30 +00:00Commented Jan 13, 2017 at 18:26
-
\$\begingroup\$ Ok thanks, new to the electronics site. I'm usually more of a software guy. \$\endgroup\$jath03– jath032017年01月13日 20:39:51 +00:00Commented Jan 13, 2017 at 20:39
1 Answer 1
I would like to measure the voltage on either side of each of the lights with the arduino's analog input pins, but the arduino's max voltage is 5v.
To linearly reduce a higher voltage to a lower voltage requires a resistor potential divider like this: -
So if the bottom resistor is (say) 5 kohms and the top resistor is (say) 7 kohms then 12 volts in becomes 5 volts out but, you might want to give a little headroom so that 15 volts in becomes 5 volts out. so use a 5 kohm for Rbottom and a 10 kohm for Rtop.
I would also be tempted to put 100 nF across the lower resistor so that the ADC sampling operates accurately.
-
\$\begingroup\$ But the each light needs the full 12 volts, will this keep the voltage the same for the lights? \$\endgroup\$jath03– jath032017年01月13日 20:38:46 +00:00Commented Jan 13, 2017 at 20:38
-
\$\begingroup\$ The resistors will not affect the lights I.e. the resistors will not steal significant energy. \$\endgroup\$Andy aka– Andy aka2017年01月13日 21:10:54 +00:00Commented Jan 13, 2017 at 21:10
-
\$\begingroup\$ LOL this was for a science fair project and I just realized that I don't need that value. Thanks anyway for future reference though. \$\endgroup\$jath03– jath032017年01月13日 21:21:26 +00:00Commented Jan 13, 2017 at 21:21