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.

Using a voltage reference

Status
Not open for further replies.

SMUGangsta

New Member
Hi

I want to build a data logger, so i have a question about voltage references.

For my analogue inputs - do i connect the reference voltage to all my sensors and to the VREF+ chip on my pic processor?

I have wrote the code and it works well, i just want it to be a bit more accurate (I have been using the internal connections to vss and vdd thus far)

The thing is that ive never used a voltage reference before, could someone point me to an example of how to use an external voltage reference for say 2 analogue inputs to a pic.

Thanks
 
A voltage reference is simply an accurate voltage generated by a temperature stable Zener or a voltage reference IC. You use it wherever you are doing accurate voltage measurements. In your case I would assume you would connect it to any sensors that are sensitive to voltage and also to the VREF on you pic.

Be aware that most reference sources have a limited current capability so you have to make sure your total load doesn't exceed that value.
 
Hi

thanks for your reply, i think your point about current sourcing is what i was getting at, eg could i use just the voltage reference for all my sensors.

What current capability are we looking at for a typical voltage reference chip - and could you suggest one - i expect that i will be using all the available channels on my 16f777.

what is the formula to calculate the current draw in a potential divider? and would i need any kind of resistor to limit current going to the adc channel of the pic.

just now i have one leg of my pot connected to v+ (5v), one to gnd and the wiper connected to the adc - would this still be the same with the vref (only using the vref instead of the v+.

thanks
 
Hi,
for getting accurate results, an ic voltage reference will be a better option, lots of them are available in various ranges (check out the Analog Devices and Maxim websites, for example)

Refer to the datasheets for selecting capacitors to be used with the reference generating ic, to keep the output stable in presence of noise.

Usually, the voltage reference ic outputs are very low current, hence, it's advisable not to use them as supply for other components on the board as they may add-up noise in the reference level.

One reference ic is sufficient for all the channels of a microcontroller ADC. And u need not connect any resistor there to limit the current..

--------------
Design with Microcontrollers
 
so would this be a valid circuit - does it need anything else.

does it matter what pots i use (values)

eg. will it make a difference between a 1k or a 500k, i know voltage wise it will probably be fine but what about current?

thanks
 

Attachments

  • circuit.GIF
    circuit.GIF
    6.1 KB · Views: 251
so would this be a valid circuit - does it need anything else.

does it matter what pots i use (values)

eg. will it make a difference between a 1k or a 500k, i know voltage wise it will probably be fine but what about current?

thanks

hi,
The datasheet for the PIC's adc input states that the input resistance/impedance must be =< 10K for specified accuracy.

10K pots are the max value for adc inputs, no series input resistor is required.

The PIC expects the +Vref to be => 2.5V or =< Vs
 
Last edited:
Thanks eric, that is great.

The Voltage Reference is 4.096V and the PIC supply voltage is 5v.

I chose this one for easy maths, as its 10bit ADC, therefore 1024 possible values, or 0.004 volts between each division.

I tried looking at the pic datasheet (im a hobbiest, so not up on the technical stuff) but couldnt find a preffered value, will any value under 10K be fine, or is there a particular value that will be best for the pots.
 
Thanks eric, that is great.

The Voltage Reference is 4.096V and the PIC supply voltage is 5v.

I chose this one for easy maths, as its 10bit ADC, therefore 1024 possible values, or 0.004 volts between each division.

I tried looking at the pic datasheet (im a hobbiest, so not up on the technical stuff) but couldnt find a preffered value, will any value under 10K be fine, or is there a particular value that will be best for the pots.

Presumably you didn't check my tutorial as I suggested?, which overcomes all these problems.
 
i did, but it said that i required lots of bits that i dont have at the moment. Very good tutorials though - I will need to collect all the bits and work my way through them.
 
Thanks eric, that is great.

The Voltage Reference is 4.096V and the PIC supply voltage is 5v.

I chose this one for easy maths, as its 10bit ADC, therefore 1024 possible values, or 0.004 volts between each division.

I tried looking at the pic datasheet (im a hobbiest, so not up on the technical stuff) but couldnt find a preffered value, will any value under 10K be fine, or is there a particular value that will be best for the pots.

hi,
Be aware that its 1023 counts[divisions] for 10 bit, 4.88mV/bit for 5Vref

You could use the internal +Vref, the sums are easy to do, look at Nigels tutorials.
 
hi,
Be aware that its 1023 counts[divisions] for 10 bit, 4.88mV/bit for 5Vref

You could use the internal +Vref, the sums are easy to do, look at Nigels tutorials.

Another thing to consider is the scaling of the result - which again I cover in my tutorial - basically you don't want to scale at all (apart from a decimal point), which is why the tutorial is designed to measure 0V-10.23V and not anything else.

Scaling it is simple, but means you don't get a smooth change of the least significant digit. For example, if you scaled by two (to give 0V-20.46V) the last digit would only display even values, 0, 2, 4 etc. Personally I find that objectionable, so choose 10.23V range to prevent it, and it still gives you 10mV resolution (roughly 0.1%).
 
Hi Nigel, I will wait a few days before building the circuit so that i can collect all the bits to build it as in your tutorial.

Could i use 13 channels just by adding more of the input modules from your tutorial (attached) or would i need to add additional parts?

Thanks
 

Attachments

  • ADC.gif
    ADC.gif
    2.8 KB · Views: 165
Hi Nigel, I will wait a few days before building the circuit so that i can collect all the bits to build it as in your tutorial.

Could i use 13 channels just by adding more of the input modules from your tutorial (attached) or would i need to add additional parts?

Thanks

hi,
Whats the circuit diagram you posted supposed to represent.?:)
Its possible to add more analog source inputs by using analog selector ic's.

BTW: conventionally circuits are drawn the other around, input on the leftside.

EDIT: I also prefer the 1023 scaling when using the LM35/OPA to give 0 thru 102.3Cdeg
 
Last edited:
hi,
Whats the circuit diagram you posted supposed to represent.?:)
Its possible to add more analog source inputs by using analog selector ic's.

Some PIC's have 14 analogue inputs anyway (just happened to notice while looking at 18F series chips), so 14 buffer amplifiers could be connected to one PIC - or, as you say, switch them to a smaller number of inputs.

BTW: conventionally circuits are drawn the other around, input on the leftside.

My fault - but it's not like it's a conventional circuit with an in and out, it's was added on to a previous tutorial board, which is why it's that way.

EDIT: I also prefer the 1023 scaling when using the LM35/OPA to give 0 thru 102.3Cdeg

Makes sense - I hate the LSD not changing one number at a time.
 
Hi, sory for the confusion.

The circuit i posted was part of nigels 0-10.23v analogue board, which i have attached so it makes more sense.

I was just wondering if i could use more of the input stages to feed more analogue inputs.

The pic i have is 16F777 which has 14 analogue inputs but i believe one is used for the external vref+
 

Attachments

  • analogue1.gif
    analogue1.gif
    7.3 KB · Views: 179
Last edited:
Hi, sory for the confusion.

The circuit i posted was part of nigels 0-10.23v analogue board, which i have attached so it makes more sense.

I was just wondering if i could use more of the input stages to feed more analogue inputs.

LIke I said, yes you can.

The pic i have is 16F777 which has 14 analogue inputs but i believe one is used for the external vref+

That's true :(
 
Thanks Nigel, Thats great, hopefully my bits will be here tuesday, and I can make a start.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top