Germany
Offline
Newbie
Karma: 0
Posts: 17
|
 |
« on: July 06, 2012, 10:00:35 am » |
My Problem is that my LM 35 DZ is not working right. Serial Monitor: 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 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
Edison Member
Karma: 9
Posts: 1001
|
 |
« Reply #1 on: July 06, 2012, 10:17:34 am » |
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
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #2 on: July 06, 2012, 10:18:46 am » |
Sorry, i connected it do A5. I've corrected it on top.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 2
|
 |
« Reply #3 on: July 06, 2012, 10:50:14 am » |
|
|
|
|
|
Logged
|
|
|
|
|
Germany
Offline
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #4 on: July 06, 2012, 10:56:36 am » |
I know this link. But it dont helped me...
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 9
Posts: 1001
|
 |
« Reply #5 on: July 06, 2012, 11:20:24 am » |
Can you measure the output voltage of the sensor with a multimeter ?
|
|
|
|
|
Logged
|
|
|
|
|
Germany
Offline
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #6 on: July 06, 2012, 01:11:34 pm » |
Its 0.45 Volts
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 9
Posts: 1001
|
 |
« Reply #7 on: July 06, 2012, 02:08:46 pm » |
Its 0.45 Volts
If that is stable, the analogRead() must be stable. Can you try this: 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
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #8 on: July 06, 2012, 02:14:04 pm » |
Yes, voltage is stable. When i take the LM in my Hand it raises constantly. So everything looks good. But in Terminal: 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
Edison Member
Karma: 9
Posts: 1001
|
 |
« Reply #9 on: July 06, 2012, 02:27:17 pm » |
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
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #10 on: July 06, 2012, 02:27:46 pm » |
 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
God Member
Karma: 4
Posts: 596
|
 |
« Reply #11 on: July 07, 2012, 02:23:07 am » |
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
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #12 on: July 07, 2012, 02:39:56 am » |
Thank you for all help. I've managed it! - The Problem was a hair thin wire with connected A0 AND A1.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 9
Posts: 1001
|
 |
« Reply #13 on: July 07, 2012, 03:29:37 am » |
I'm glad you found it !
|
|
|
|
|
Logged
|
|
|
|
|
|