View previous topic :: View next topic |
Author |
Message |
nina
Joined: 20 Apr 2007 Posts: 111
|
measure Resistance |
Posted: Fri Jun 22, 2007 9:26 am |
|
|
hi
How can I display the resistence value over a LCD?
The reading of ADC do not mean resistence.
Does anyone here can explain how work it?
Thanks
NIna |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Fri Jun 22, 2007 9:42 am |
|
|
If you know the current flowing through the resistance then the resistance can be easily determined...
V=I/R
You must pass a constant current through the resistance, then read the ADC voltage, and use the above formula to calculate the resistance..
thanks
arunb |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Fri Jun 22, 2007 12:05 pm |
|
|
First you need to understand Ohm's law. Then realize that the A/D only measures voltages. Then it will all make sense. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 22, 2007 1:41 pm |
|
|
Hey Arunb, V=I*R not V=I/R |
|
|
nina
Joined: 20 Apr 2007 Posts: 111
|
R |
Posted: Sat Jun 23, 2007 6:32 am |
|
|
sorry...let me explain better my doubt.
when we use a LM35 we need write a formula to convert input ADC to temperature. I would like know how can I do for a potentiometer.
After conect a pot 1k and a lcd over pic, it show the values
1,102,205,307,409,511,614,716,818,921,1022.
I using this line to write over lcd
printf(lcd_putc, "Pot = %f",pot);
where pot is reading from ADC
tks
nina |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Sat Jun 23, 2007 4:50 pm |
|
|
oops sorry, you are right treitmey, I gues I was thinking of something else.. thanks for pointing out the mistake..
But the method was right I suppose ??
thanks
arunb |
|
|
nina
Joined: 20 Apr 2007 Posts: 111
|
pot |
Posted: Mon Jun 25, 2007 5:11 am |
|
|
Does anyone here had already this problem?
tks nina |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Mon Jun 25, 2007 7:04 am |
|
|
WHY DOES THIS THIS SAY SPAM WHEN IT IS POSTED?!! I HAVE NEVER POSTED ANYTHING OBJECTIONABLE.
Greetings,
The LM35 is a temperature sensor which produces an output voltage which is 10mV / degree C. The formula is in the datasheet of the LM35. Please describe your setup in more detail. What resistance? Why?
Cheers,
JMA |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
|
inservi
Joined: 13 May 2007 Posts: 128
|
|
Posted: Mon Jun 25, 2007 8:27 am |
|
|
Hello Nina,
if you connect you pot between VDD and Gnd (+5v and 0v), and the ADC is 10 bits resolutions, the results are between 0 for 0v and 1023 for 5V.
So the results you get are normal!
For convert to volts, you need to devide the result by 1024*5, or simply by 204.
If you need to mesure a resistor then you can use a know resistor connected between pin of the ADC and VDD, the resistor to measure between the pin and 0v. then if R1 is the know resistor connected to VDD, R2 is the unknow resistor, U is VDD, U2 is the voltage mesured, then:
R2=R1 / ( ( U / U2 ) -1 )
You can use the value measured directly without convert it to voltage.
example for a R1 = 1K, U=1024, U2=512 then
R2 = 1000 / ( ( 1024 / 512) -1 ) = 1000
Best regards,
dro. _________________ in médio virtus |
|
|
nina
Joined: 20 Apr 2007 Posts: 111
|
lcd y pot |
Posted: Tue Jun 26, 2007 5:28 am |
|
|
great...its working now..
I changed pot by MPX4250 and there is a difference between MPX4250 and LCD.
IS this difference the offset?
Can I decrease this difference using numeric calculus or just changed the PIc by another whit higher ADC?
tks
nina |
|
|
|