ADC Of Different Voltages

Status
Not open for further replies.
listen guys ive been working so much im lost here. is it possible someone can give me a 5v sample? Like draw it out for me. I think Radio Shack is making me stupid heh
 
You just need a simple two resistor attenuator, fairly low values if you're not using an opamp.

Assuming you're using the 5V Vdd for the reference?, you need 5V across the bottom resistor, and 5.023V across the top one - so if you make the bottom resistor 4.7K, and the top one 4.7K with a 470 ohm preset in series, you can adjust the preset to make it read exactly right.
 
how do i do this tho? like i have to have 2 resistors touching 4.7k tied together and 5v on top and 5v on bottom?
 
how do i do this tho? like i have to have 2 resistors touching 4.7k tied together and 5v on top and 5v on bottom?

AtomSoft, I'm rather confused about your Vdd and Vref requirements.
I thought that you're planning to use a PIC18LF1320 powered by Vdd=3.3V, aren't you? Look to the attached schematic.
 

Attachments

  • adc.png
    11 KB · Views: 178
I can use a 3.3v or 5v supply doesnt matter the easiest to use will be used lol

Mike i like that image so i would need like a 1k trimmer to adjust to 470ohm or until i get a straight result?

so vIn is my 9v, 5v, and 3.3v each using this design but personalized for the voltage using 1k trimmers and i correct?
 
I can use a 3.3v or 5v supply doesnt matter the easiest to use will be used lol

The values I suggested were for a 5V supply, you would need to change them for 3.3V.

Mike i like that image so i would need like a 1k trimmer to adjust to 470ohm or until i get a straight result?

No, the 470 ohm is already a trimmer, you could use a 1K but it will be more critical to adjust.

so vIn is my 9v, 5v, and 3.3v each using this design but personalized for the voltage using 1k trimmers and i correct?

No, you adjust each one to read the same voltage, 10.23V FSD on all inputs.

Easiest way is to set your program to display the value of the ADC (0-1023), and add a decimal point between the 10 and the 23 in the software - again, check my tutorial which does exactly this. Then connect a battery (say 9V) to each input in turn, and connect your multimeter across the battery (on its 19.99V range) - adjust the preset on each input so it reads exactly the same as your multimeter.

It's as simple as that.
 
Nigel the issue is do i need a 10.23v source? if not how the heck am i going to get it to read 10.23v on each.

Unless you mean if i put a 9v battery on it it should read out 0900 as the value when i adjust the resistor. Since im cutting the voltage in half it will be 4.5v so i can use the resistor to bring it higher am i correct?
 
Last edited:
Ok this is about ADC but easier project. I have a 5v supply and i can get adc value of some resistors but im scared if the vdd/vss drops a little then my whole project is done for since the values wont match and buttons will have no use.

Im using about 5x1k resistors to create the different values now how would i calculate the value based on vdd/vss ?

like im using a stable 5v supply right now (pickit 2 power) here are my results:

The ADRES result is in image and the actual resistors are all 1k each.



How do i calculate the percentage? So i can calculate for voltage drops and such?
 

Attachments

  • adc1.png
    4.2 KB · Views: 301
Last edited:

hi atom,
If you have 5, 1K resistors in series, from +5V to 0v, then each resistor junction would change by 1 volt.

The program would detect say, a +/-.2V band on the nominal voltage tap.
 
Last edited:
heh had it left justified needed to be right justified lol changed

EDIT NEW RESULTS

 

Attachments

  • adc2.png
    3.9 KB · Views: 281
Last edited:
My big question for this second project is if i change vdd to 3v will the button values stay the same like button 1 would still be 1011 ?
 
My big question for this second project is if i change vdd to 3v will the button values stay the same like button 1 would still be 1011 ?

hi atom,
Using the same 5, resistor chain the answer is no.
If you have a spare adc input, at power up, you could sample the +Vsup and adjust the software switch sampling voltage gaps to suit

If you used a fixed 3.3V it would be easy to calculate the voltage drops at the resistor chain, still use say 1K's

EDIT:
Using 1K's at 3.3V would give increments of 0.66V along the chain

For 3.0V it would be 0.6V increments
 
Last edited:
i mean since i uuse the VDD/VSS as VREF if i use a 3v supply and get a value of 1023 then when i use a 5v Supply instead of 3v will i still get a 1023 as my vdd for both?
 
i mean since i uuse the VDD/VSS as VREF if i use a 3v supply and get a value of 1023 then when i use a 5v Supply instead of 3v will i still get a 1023 as my vdd for both?

If I understand you correctly, you are using the PIC supply [internal ref] for the adc.
If you run from 5V or 3.3V you will still get 1023 for a 10bit adc.
 
Last edited:
ok cool. Thats for project 2 i have it working nicely. Its a little Clock via LCD and 5 buttons on 1 pin. Going to show it when i goto a school interview.
 

Just a note, you can increase your voltage safety margin (and decrease partscount) by removing R5. So one end switch goes to 5v and the other goes to 0v. Then you have the max voltage possible from each stage.

And I guess you know this, but if you use Vdd as the ADC reference, for examples like the one above the ADC reference voltage scales linearly with battery voltage etc, so you don't need to be worried about "battery voltage drops a little and buttons wont work".
 
thanks for the tips ill remove that other resistor tomorrow and make sure i leave the code to test for a 0 instead of 4.

I recently figured that other battery drop , linearly stuff thanks!
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…