Pages: [1]   Go Down
Author Topic: LM 35 DZ + Arduino  (Read 1551 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My Problem is that my LM 35 DZ is not working right. Serial Monitor:

Quote
3.42
11.23
38.09
24.90
0.00
115.72
118.65
33.20
13.67
43.95
25.39
27.83
16.60
100.10
112.79

example code
Quote
float temp;
int tempPin = 5;

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

void loop()
{
  temp = analogRead(tempPin);
  temp = temp * 0.48828125;
  Serial.println(temp);
  delay(1000);
}

I've connected it like described on the data sheet. Flat surface on top. Left = VCC (5V) center = Data (A5), Right = GND
I've tested 5 of them with the same result.

What is wrong?

« Last Edit: July 06, 2012, 10:19:16 am by heckmic » Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1018
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you connect it to digital input 5, while you are reading analog input A5 ?

It looks like if the input A5 is not connected.
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, i connected it do A5. I've corrected it on top.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

This link will help you.
http://www.ladyada.net/learn/sensors/tmp36.html
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I know this link. But it dont helped me...
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1018
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you measure the output voltage of the sensor with a multimeter ?
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Its 0.45 Volts
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1018
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Its 0.45 Volts

If that is stable, the analogRead() must be stable.

Can you try this:
Code:
double temp;
int tempPin = 5;

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

void loop()
{
  int rawADC;

  rawADC = analogRead(tempPin);
  Serial.print("rawADC = ");
  Serial.print(rawADC,DEC);

  temp = (double) rawADC * 0.48828125;
  Serial.print(", temp = ");
  Serial.println(temp);

  delay(1000);
}

If that doesn't work well, try a different analog pin and perhaps upload a photo of how it is connected.
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, voltage is stable. When i take the LM in my Hand it raises constantly. So everything looks good.

But in Terminal:

Quote
rawADC = 48, temp = 23.44
rawADC = 54, temp = 26.37
rawADC = 65, temp = 31.74
rawADC = 73, temp = 35.64
rawADC = 0, temp = 0.00
rawADC = 61, temp = 29.79
rawADC = 91, temp = 44.43
rawADC = 112, temp = 54.69
rawADC = 73, temp = 35.64
rawADC = 61, temp = 29.79
rawADC = 78, temp = 38.09
rawADC = 9, temp = 4.39
rawADC = 66, temp = 32.23
rawADC = 29, temp = 14.16
rawADC = 50, temp = 24.41
rawADC = 45, temp = 21.97
« Last Edit: July 06, 2012, 02:16:18 pm by heckmic » Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1018
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks.
So the sensor is good. And your readings are all over the place.

I can't think of anything else than that the wiring is not right.

(1) try my little sketch -> check, you've done that
(2) upload a photo of your wiring.
(3) try a different analog input pin
(4) Use a power supply for the Arduino (not just the USB power).
(5) Connect all digital and analog pins one by one to ground, while the sketch is running and see if something changes.
(6) try a different Arduino
(7) connect a potmeter to the analog input pin and vary that.
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset



on the right my relay connected to my fans for cooling my reef tank.
Another analog input is used now (A0).
« Last Edit: July 06, 2012, 02:32:22 pm by heckmic » Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

what if u disconnect A0 and pull it high internally?
pinMode(14,INPUT); digitalWrite(14,HIGH);
http://arduino.cc/en/Reference/DigitalWrite
Logged

-Arne

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for all help. I've managed it! - The Problem was a hair thin wire with connected  A0 AND A1.
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1018
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm glad you found it !
Logged

Pages: [1]   Go Up
Jump to: