Pages: [1] 2   Go Down
Author Topic: LM335  (Read 2857 times)
0 Members and 1 Guest are viewing this topic.
Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I am using LM335 Temperature sensor. Here is my code:
Code:
float celsius = 0, kelvin=0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  kelvin = analogRead(0) * 0.004882812 * 100;
  celsius = kelvin - 273.15;
  Serial.print("Celsius: ");
  Serial.println(celsius);                  
  Serial.print("Kelvin: ");
  Serial.println(kelvin);
  Serial.println();
  delay(1000);
}

Output:
Code:
Celsius: 41.30
Kelvin: 314.45

Celsius: 41.30
Kelvin: 314.45

Celsius: 41.30
Kelvin: 314.45

Celsius: 41.30
Kelvin: 314.45

41.30 degrees C is unusual. I am testing inside my room where the temperature is 19 degrees C.
Please help me correct readings.

Thanks.

Z
« Last Edit: February 28, 2012, 02:59:26 am by zeus2kx » Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2568
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Insert a Serial.print statement to knock out the analogRead(0) result.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Insert a Serial.print statement to knock out the analogRead(0) result.

Thanks for reply.
I added, here is the output.
Code:
Celsius: 41.30
Kelvin: 314.45
Analog Read: 644

Celsius: 41.79
Kelvin: 314.94
Analog Read: 644

Celsius: 41.79
Kelvin: 314.94
Analog Read: 645

What can I do to solve this issue?

Thanks.

Z
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 70
Posts: 3726
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How do you have it wired up?
Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2568
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, your analogRead result means there's about 3.1V (645 * 4.888mV = 3152mV == 310K - 273 = 42C).
Are the wires to the sensor short?  They should be as short as possible.
Try a bypass cap at the sensor, 0.1uF from +V to Gnd, too.

5V / 1023 = 4.888mV (per count)
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This way

http://imageshack.us/photo/my-images/718/lm355.jpg/
OR
http://img718.imageshack.us/img718/1821/lm355.jpg
Logged

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are the wires to the sensor short?  They should be as short as possible.
Try a bypass cap at the sensor, 0.1uF from +V to Gnd, too.

5V / 1023 = 4.888mV (per count)

Thanks.
No, wire length is almost like a foot.
Logged

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Kindly confirm the circuit so that I fix sensor on board itself.

Thanks.
Logged

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried connecting 0.1uF between +V and Gnd but no significant changes.  smiley-mad
Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2568
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You may be coupling noise into the analogRead with those 1 foot wires.
Better try as short as possible.  Your application likely requires remote placement, but try and find out if this helps first.
Your circuit looks like what I've seen recommended.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I soldered on the board but yet no change in readings.
Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2568
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you put a voltmeter to the LM335 output (right there on the board)?
If it's "3V" then maybe it's defective.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nope, I am home, don't have one now but can check tomorrow.
Logged

Israel
Offline Offline
Jr. Member
**
Karma: 0
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found the problem that there wasn't any problem just that Arduino was only connected through USB, not with AC adopter.

Thanks all for your support.

Z
Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2568
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But,... I...
Well, OK then.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Pages: [1] 2   Go Up
Jump to: