View previous topic :: View next topic |
Author |
Message |
Onur
Joined: 11 Apr 2004 Posts: 11
|
Lm35 Adc accurate |
Posted: Sun Jun 20, 2004 6:54 am |
|
|
I'm using lm35 and adc answer changing like this.
25-26-25-32-25-26-20-26-25
I can't read properly lm35 directly connected to pic.
I used 10 bit res. and adc clock divide 32.
When I use pot nothing change.
(I used ds1820 perfectly working).
Have you got any other idea about temperature measurement. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Mon Jun 21, 2004 7:27 am |
|
|
Is the power supply clean? The LM35 is basically just a shunt so ripple on the powre supply will come right on through to your measurement.
The LM35 datasheet has some suggestions for noisy environments, as I recall.
Also, the noise might increase if you are current starving the shunt because the resistor is too large. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
>>TechDesign Guest
|
ADC erratic |
Posted: Mon Jun 21, 2004 1:26 pm |
|
|
yes, try to put an elco (10-100µF/16V) across the power supply (after the voltage regulator if there is one, even when you use batteries). I had the same problem with an LM335 recently. See? |
|
|
languer
Joined: 09 Jan 2004 Posts: 144 Location: USA
|
|
Posted: Mon Jun 21, 2004 2:27 pm |
|
|
I have used the LM335(derivative of LM35) and one of the most important things was the current drive. It wants to operate between 400uA and 5mA, so you want to make sure you select a (bias) resistor that assures this.
For example if you were to operate at +5VDC:
Rmax = (5-4)/(0.0004), where 4 is the device voltage at maximum temp
Rmin = (5-2)/(.005), where 2 is the device voltage at minimum temp
such that,
Rmax = 2.5kohms
Rmin = 600ohms
Selecting 1kohm(for example) in this case makes sure that you operate it in the middle of its range.
On top of this, you have to make sure that what it drives is as high impedance as possible, such that it does not alter its operating point (specially if you're operating in one of the corner cases). Interfacing ADCs directly to such analog(low impedance) sensors is always a cause of grief. The ADCs inherent sampling operation will cause variations in the operating point of the sensor. ADI and TI have excellent notes on this (see Sensor Signal Conditioning form ADI as reference).
To overcome this you need to buffer(condition) your sensor. You do this using OPAMPs, or you can use a simple RC network.
Hope this helps. |
|
|
jay miller Guest
|
lm35 |
Posted: Mon Jun 21, 2004 4:42 pm |
|
|
Like others have said, add some good C across teh power supply and add a buffer op amp between the LM35 and the PIC. I've used the LM34 for years in this setup doing remote energy control systems.It's been rock stable.I actually use 2 10R in series with 10Mfd caps at each junction.
hth
jay |
|
|
A user Guest
|
LM35 acc |
Posted: Tue Jun 22, 2004 4:15 am |
|
|
i use LM35 and 0.1 C resolution.
0...102.3 C
lm35 + filter +5X gain (OP07) + filter
very good result...
set_adc_channel(0);
delay_ms(1);
this code very important. For charge cond.
Bye's... |
|
|
alexbilo
Joined: 01 Jun 2004 Posts: 39 Location: Trois-Rivičres
|
|
Posted: Tue Jun 22, 2004 7:06 am |
|
|
Quote: | set_adc_channel(0);
delay_ms(1); |
Actually the delay you must use after the call to set_adc_channel() depends on the device you use and the clock frequency. A PIC18xx2 with 10MHz crystal + PLL needs about 10µs to sample the channel. _________________ Alex |
|
|
|