CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Lm35 Adc accurate

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Onur



Joined: 11 Apr 2004
Posts: 11

View user's profile Send private message

Lm35 Adc accurate
PostPosted: Sun Jun 20, 2004 6:54 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Mon Jun 21, 2004 7:27 am     Reply with quote

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
PostPosted: Mon Jun 21, 2004 1:26 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jun 21, 2004 2:27 pm     Reply with quote

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
PostPosted: Mon Jun 21, 2004 4:42 pm     Reply with quote

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
PostPosted: Tue Jun 22, 2004 4:15 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 22, 2004 7:06 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group