Re: Maths help for the terminally dim please
Alain, hes basically got a circuit for mesuring voltage using a voltage divider so that the voltage going into the ADC is a fraction of what is going into the voltage divider. I have near the same type of setup, I have a circuit measuring my AC wall voltage, I have to rectify it first using a bridge rectifier, and add a capacitor to that and then a load resistor to discharge the cap. that gets me about 170 VCD, I dont want to put that into a ADC channel but I can use a POT or 2 resistors to define the proportion of that voltage that I want to read and then do some math to make the PIC appear to read the higher voltage, the problem you have to watch out for is to set up the voltage divider so that your max reading is still lower than your max input (5 volts) since there could be voltage spikes that are well above what your wanting to read. a possible option is to use a zener diode 5.1v on the actual ADC pin to help voltage spikes, but this doesnt cover 100%. He alread said though that he is on a isolated circuit so that helps. my only question is why is it non linear? Im not sure of his circuit but he should be able to get a 95% or greater linear reading using a voltage divider, he could even use a multiturn pot to tune the voltage to his circuit (code math) if theres a minor discrepency. his accuracy is based on the Mathamatical voltage and his ADC resolution, at 10 bits his 5 Volt ADC is 5v/1024 there are huge amounts of sample code for voltmeters out there, but even if we use his voltage numbers and add a bit for possible voltage spikes, lets use 377Volts as the max (5 volts acutual) then we just do the math 377/1024, this is going to give approx a .3% accuracy, but its still going to be innacurate if his circuit is non linear. i would look at the circuit and try to figure out a way to make it virtually linear. otherwise its going to be very hard to get the math and reality to line up together.
Chris
Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."
Bookmarks