3
\$\begingroup\$

I am working on a DC voltmeter for monitoring my solar panels. Total voltage of my panels can go up to a maximum of 50 volts. I designed a voltage divider with 100k and 10k resistors. For full voltage it gives 4.54 volts on arduino pin.

The problem that I am confronting is that the behaviour of the voltage is not linear. It gives perfect value for one input voltage but changes drastically for other input voltages. I have seen some pages on instructables that suggest that I am neglecting the something related to impedance issues of arduino pins but I could not get it. My simulation on proteus works perfectly but in practical design I could not got to any point. Kindly help me regarding high impedance voltage reading on arduino pins.

\$\endgroup\$

2 Answers 2

5
\$\begingroup\$

The ATmega based Arduino boards (ATmega328P for instance) use a capacitive sample and hold circuit for the ADC inputs. This has two implications for your applications:

  • There is a delay between initialization of the ADC and availability of a stable analog datum
  • While overall input impedance of the ATmega328P is stated in the datasheet as 100 MOhms, the actual current drawn for charging the sampling capacitor requires an output impedance of the order of 10 kOhms from your signal source, for fast stable analog reading.

To address the first issue try the AnalogRead() 3 or 4 times in a row, and see whether the final value stabilizes to the range you expect. Just discard the first few readings each time around.

For the second issue, a 10 k / 1 k voltage divider should work better: This will however draw more current (4.545 mA), and hence the 10 kOhm resistor needs to be rated for more than 207 mW. So a half-watt resistor would be my choice. After doing this, you may be able to obtain stable AnalogRead() results without having to delay on the reading, so the previous point becomes void.

A third issue to consider: Is there a capacitor on the voltage divider messing up the works, by any chance? If so, remove that capacitor.

\$\endgroup\$
4
  • \$\begingroup\$ As long as the ADC has a low duty cycle, you can also just buffer the analog input pin with a 10-100 nF capacitor. Put that capacitor in parallel with the lower 10 kOhm resistor in the divider; it will significantly improve the readings if you wait a few milliseconds between each! \$\endgroup\$
    – Jon Watte
    Aug 26, 2013 at 21:08
  • \$\begingroup\$ Anindo Ghosh & @JonWatte - could you please take a look at electronics.stackexchange.com/q/103542/20778 ? I would still like to take the voltage divider approach. In addition to what I wrote in the question, I would add maybe a 7805 voltage regulator (with 2V dropout for a longer time-span, filtering caps for stabilization and of course different resistor values) or a diode to protect the Arduino pin. Several ideas were provided, but nobody validated if my divider calculations and approach is correct or not. My purpose is learning, not just completing the project. \$\endgroup\$
    – binar
    Apr 2, 2014 at 23:13
  • \$\begingroup\$ A voltage regulator is entirely wrong -- it will drop the voltage that you read, and will work to prevent change in voltage. If you want to protect the input, add a 5.1V Zener instead. Note that my proposal to add a capacitor in parallel with the lower 10 kOhm resistor still uses the voltage divider -- it just makes sure the input impedance of the ADC isn't a problem for single readings. Right now, it's likely that the problem in your system is that not enough current can flow into the ADC input when it samples the voltage. \$\endgroup\$
    – Jon Watte
    Apr 3, 2014 at 19:04
  • \$\begingroup\$ Separately, your other question says "completely independent" for the voltage divider. That cannot work, because there needs to be a common reference for a proper voltage to develop. Thus, you need to tie the ground of the voltage you measure to the ground of the Arduino. If you have not done this, then that's your problem. If you don't want to do this, look into getting an instrumentation amplifier as a buffer. \$\endgroup\$
    – Jon Watte
    Apr 3, 2014 at 19:06
0
\$\begingroup\$

The open circuit voltage from a voltage divider will be linear with the input voltage.

When run directly into the A/D input of most CMOS processors, that should work fine. It may be that your arduino thing has some stuff on that pin. This is really a arduino user question. Go check the arduino schematic.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.