I use a voltage divider (110K - 10K Pot) to measure 0-60V.
At low voltages it works very good but as I increase the voltage the error increases. At >40V the error starts to get big (several volts).
I can adjust the divider with the pot but it does not help.
So my question. Is it a dead end to use a simple voltage divider + internal 10bit ADC to measure 0-60V with max 0.5V accuracy?
I think my code is good. I use the internal 1.1V reference to get the actual VCC when calculating the ADC voltage.
I use the ADC on the ATMEGA328.
The potentiometer are low quality, I had to measure a couple to find one that actualy was 10K.
I thought it was a good idé to have a pot for calibration.
Hi, with your divider 10k/120K you are dividing by 12, so 60V will be 5V at the arduino input, now you say you are using the 1.1V reference.
?????
You analog count will be 1023 at 1.1V input, so your 5V for 60 will also show 1023.
Broadburner2 and JohnLincoln have also valid points that would contribute to the non-linearity.
By the way the pot in your circuit does nothing in the way of adjustment, the wiper is open circuit.
"I use the internal 1.1V reference to get the actual VCC when calculating the ADC voltage."
You can use the internal 1.1V reference voltage to calculate the actual VCC voltage instead of guessing and assume the voltage is exactly 5V.
I think it is a great feature that some of the Atmega and Attiny mcus support.
I use a voltage divider (110K - 10K Pot) to measure 0-60V.
At low voltages it works very good but as I increase the voltage the error increases. At >40V the error starts to get big (several volts).
I would not discard heating: although the power you generate is less than a mW, common resistors and pots are very sensitive to temperature.
Does the measured voltage vary as time passes?. Does it stabilize finally at a -wrong or not- value?
Thanks again guys for your help!
Now it works perfectly.
First I followed Boardburner2 advice and changed the resistors to a lower value. The measurments was good up to ~52V.
I then understod that the zener had started to conduct as JohnLincoln mentioned and I removed the zener.
After that the measurments was good up to 60V .
I only print the voltage to my LCD with one decimal and it shows exactly the same voltage as my multimeter and bench power supply.
Thanks I forgot about that.
But it's ok because I put a fixed 5.1K resistor + 10K pot in series.
The pot was good because I had to fine adjust the resistance as the resistors was heating up.
The 10 k resistor should be rated at 1/2 W if you have not already noticed.
Just to insist: 0.3 W will heat the resistors & pot and they will vary their (nominal or calibrated at Tamb) values substantially; the accuracy of the whole system will be poor.
I don't think that the heat are going to be a problem because the resistor and pot will always have the same temperatur.
All I have to do is to calibrate with the pot when the resistor and pot have reached maximum temperature.
I tested yesterday for 40 minute and the accuracy was acceptable.
I am measuring a 48V battery bank so the voltage don't change much.
But if I measured a voltage that changed much over time I would have a problem with varying temperature.
I don't think that the heat are going to be a problem because the resistor and pot will always have the same temperatur.
All I have to do is to calibrate with the pot when the resistor and pot have reached maximum temperature.
That's the point: temperature coefficient will probably be much different from resistor to pot (even temperature will be different; the one that counts is the temperature inside the component). I do recommend you (if accuracy is a goal) to 1) verify carefully accuracy and, if it is the case 2) using low temperature dependant resistors (they are unexpensive).
I have done a lot of measurment (with two different multimeter) and I get 0.1-0.2V accuracy, I have put alot of "heat glue" around the components, maybe that helps to keep the temperatur more stable between the pot and resistors (I don't know).
But for future project I will try and get better accuracy. I did not know that it existed low temperature dependant resistors.
Should get some.
I also read that the internal 1.1V reference actually can vary between 1.0-1.2V so a good external voltage reference should improve the accuracy even more when calculating the VCC.