jremington:
The picture is blank for me. But no, the solution is to use the 100 nF cap, as suggested above.
A 1Meg/100nF low pass filter has a time constant of 0.1 seconds, so don't try to read the ADC faster than that.
if i use voltage divider resistor 2.2MΩ and 96KΩ, then i use cap 100nF for the filter, so the time constant became how much ? 0.2 sec ? if it yes 0.2 sec, then what i must do at my coding, should adding the delay 200ms ?
thanks for the explanation.
Wawa:
That is ALSO adding over-voltage protection, which is not needed with a 1Megohm resistor in the divider.
Just a 100n capacitor from pin to ground is enough.
What value is the other resistor.
Are you using default Aref, or the more stable 1.1volt Aref.
Leo..
my resistor divider is 2.2MΩ and 96KΩ.
yes, i'm using default Aref, but i'm planning to using TL431 for external reference.
thanks.
Grumpy_Mike:
Let’s hope you are not making measurements of mains electricity.
You need two resistors to act as a potential divider not just one. That by itself is enough, no op-amp needed.
A standard technique is to take two readings and only use the second one. This allowed the internal sample and hold capacitor to charge up after switching to that input channel. In extreme cases you wil need to put a delay between the two readings to allow even more time.
yes, i'm using 2 resistor for making voltage divider.
about "take two readings and only use the second one", i did not fully understand, how to coding it...
is it like this ?
for (int i = 0; i < 64; ++i) {
analog += analogRead(A0);
}
analog = analog / 64;
adc = (analog * 2.475) / 1023;
voltage = (adc / 0.04125)*2; // 5Vdc / 120vdc = 0.04125
delay(10);
for (int i = 0; i < 64; ++i) {
analog += analogRead(A0);
}
analog = analog / 64;
adc = (analog * 2.475) / 1023;
voltage = (adc / 0.04125)*2; // 5Vdc / 120vdc = 0.04125
thanks for the answer.
PerryBebbington:
I assume you have 2 resistors in series, with the 1MOhm resistor to the 120V and the analogue input pin, and a much lower value resistor between the input pin and 0V. Contrary to what might seem obvious, the source impedance seen at the input is the 2 resistors in parallel, so a bit lower than whatever is the value of the lower resistor.
This is because from an impedance point of view the 2 rails of a power supply, in this case the 120V, are effectively shorted together, meaning that for impedance purposes the resistors are in parallel.
yes, i use 2 resistor.
ok noted, thanks.
MarkT:
For high voltages you have to worry about resistor voltage ratings, and often its wise to use a series
string of resistors for the high voltage part of the divider, eliminating the risk of a single point of failure too.
To divide 120V to 5V is a ratio of ~24, implying 1M and 39k values or so, which is only 37.5k impedance
seen from the analog pin. Still thats higher than 10k so a 100nF cap is indicated in parallel with the 39k
resistor. That's got a time constant of 100n x 37k5 = 3.75ms
Extra diodes aren't useful/needed as the 1M resistor is limiting any current to 120µA max, which
isn't going to stress the protection diodes on-chip.
You can use two 560k resistors in series in place of the 1M for extra safety.
ok, i see, if i use 2.2MΩ and 96KΩ for voltage divider,
then for the 2.2MΩ, better i use more resistor in series for making itu 2.2MΩ, i.e. 1MΩ + 1MΩ + 100KΩ + 100kΩ so the total is 2.2MΩ.
thanks.