Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ADC Calibration/Or Finding a unknown voltage reference

Status
Not open for further replies.

Overclocked

Member
Ive been trying to wrap my head around this, and for all intensive purposes I'll keep it generalized. All Micro's have some sort of internal ADC, and they all need a voltage reference in order to get the correct approximation of the voltage measured, ie

Vmeasured = (readvalue *500)/1024

For a 10Bit ADC and a Vref of 5V. However, what happens if you dont Know your voltage reference point? How would you calibrate it? If you only have the 10 bit number you read from the ADC, can you get the voltage reference? You can assume a ideal voltage reference of 5.00v, but whos to say it doesnt vary to 4.95 or 5.05V (without measuring-some micro's have a internal voltage reference).

Hopefully my question is clear, as the micro Im using has a internal voltage reference, but it ranges from -6% to +8%. The nominal voltage is 2.048V. Ive tried to come up with a ton of formula, but the closest Ive gotten only compensates if its less than the ideal, not more.
 
You can buy voltage reference ICs that have better than a 0.1% accuracy or better, such as one of these.
If you use one of those for the ADC reference, the converter accuracy will then be equal to the reference accuracy.
 
The whole idea of calibration is your digital representation of potential difference is calibratable..

You take a know zero and set you digital zero to suit, then you take a known voltage and set your digital span to suit..

then you can use the difference as your map..

digital_representation_of_voltage = ((( analogue_input - analogue_zero) * digital_span ) / Analogue_span ) - Analogue_zero
 
You can assume a ideal voltage reference of 5.00v, but whos to say it doesnt vary to 4.95 or 5.05V (without measuring-some micro's have a internal voltage reference).

The PIC's ADC is ratiometric, so if Vsupply is 4.9v or 5.1v it will still give 1023 counts for 4.9v or 5.1v.
 
The PIC's ADC is ratiometric, so if Vsupply is 4.9v or 5.1v it will still give 1023 counts for 4.9v or 5.1v.

Right, but how do you get back to find your reference point if it strays from the ideal 5V?

The whole idea of calibration is your digital representation of potential difference is calibratable..

You take a know zero and set you digital zero to suit, then you take a known voltage and set your digital span to suit..

then you can use the difference as your map..

digital_representation_of_voltage = ((( analogue_input - analogue_zero) * digital_span ) / Analogue_span ) - Analogue_zero

This almost seems to follow y=m*x-b. Would you mind explaining a little more?
 
Right, but how do you get back to find your reference point if it strays from the ideal 5V?

You don't, which is why you don't use the PSU as the reference - either use an external precision reference (as per my tutorials) or an internal precision reference such as available on many later devices (which is usually selectable for different voltages as well).
 
I think Ive just figured it out, and it probably goes along with what Ian was saying.

So First step in all of this is to configure my reference to output to a pin by setting a few registers. Then expose the PIC (or micro) to 32F (0C), ie a freezer. This ofc assumes my freezer isnt colder than 32F. I then also take a reading at room temp. This also assumes that room temp is stable around 75F. My thermostat says its 75F right now. Then I have some sort of range that I can compensate for. The upper range might be a little more difficult, so I would have to use a temperature sensor and outside temperature (or some how keep water at around 100F without frying anything).

Again, I would calibrate the sensor at 32F, but because its smaller, I would use water as a medium. I could compare that reading (from a meter) with the spec in the datasheet. I could then compensate the sensor and then place the micro outside and let it warm up to what ever the outside temp is. Take another reading. I have 3 data points that I can get a line fit from for the voltage reference. I wonder how they do this on an industrial scale.

This is ofc, assuming that voltage from the reference varies linearly with temperature.

Or, I could take the simple way out and just buy a $3 voltage reference from Linear. The only problem this poses is the isolation between programming pins and the voltage reference pins, but I could just use a removable jumper.
 
This ofc assumes my freezer isnt colder than 32F.
Your freezer should be way colder than 32F (typically 0F). If you want a 32F reference, use a container of melting ice.
 
Calibrate to what? It does not matter what the reference is the bits output will reflect the input compared to the reference value. A stable reference is required simply because the bits output reflect to the reference. You may have 100 v input or a 100mv input you scaling is stil a one +/- 1 bit value of the reference. for nill for full scale is ref +/- a bit
 
Or, I could take the simple way out and just buy a $3 voltage reference from Linear. The only problem this poses is the isolation between programming pins and the voltage reference pins, but I could just use a removable jumper.

$3 saves you much more than $3 in time and effort, it also gives you known long term stability from board to board and chip to chip.
http://cds.linear.com/docs/en/application-note/an82f.pdf
 
$3 saves you much more than $3 in time and effort, it also gives you known long term stability from board to board and chip to chip.
http://cds.linear.com/docs/en/application-note/an82f.pdf
Your right about this. Ive spent more time on this trying to think of a algorithm than just going with that. That time spent could have been spent on thinking of other problems that might arise. It would be one less thing to go wrong as well. Much appreciated!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top