Pages: [1]   Go Down
Author Topic: Y is this happening?  (Read 814 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would be glad if anyone can help me with this..
I have connected a temperature sensor(LM35) to analog pin 1 and a potetiometer to analog pin 0. When the potentiometer reads zero on my serial monitor I have no problem with the LM35. But when i start varying the pot the LM35 values changes even when my room temperature is constant. when i bring back the pot to 0, it reads the correct values. What could be the problem??

Thanks,
SANJAY 
Logged

SW Scotland
Offline Offline
Edison Member
*
Karma: 17
Posts: 1404
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How many terminations does your LM35 and your potentiometer have  (3 each?)  so how about a wiring diagram showing where all 6 terminals are actually connected.  You might then get some sensible responses to your rather vague question.
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also, post the sketch that illustrates the problem.
Logged

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

I have attached a picture of how i've connected the pot and the lm35. i have connected the positive terminal of the lm35 to pin no 3 and also made it high in the program. I have done this because there is only one +5v on the board. Other connections are as usual.
this is my coding:


void setup()
{
  Serial.begin(9600);
  pinMode(3,OUTPUT);
  digitalWrite(3, HIGH);
  pinMode(0,INPUT);
  pinMode(3,INPUT);
}


void loop()
{
  delay(500);
  int i=analogRead(0);
  int j=analogRead(3);
  float k=(j*5.0*100.0)/1024.0;
  Serial.println(i);
  Serial.println(k);


* IMG_0656.jpg (2011.11 KB, 2592x1936 - viewed 24 times.)
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  int i=analogRead(0);
  int j=analogRead(3);

I thought it would look like that. There are side effects from successive analogRead()s on different pins, where some charge remaining from the first read gets mingled with the incoming voltage, after the multiplexor has switched to the second pin. A recommendation is to read the second pin twice, and ignore the first reading.
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe a short (i.e. some ms) delay could be put between the two reads ?
Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12489
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Delay won't help, the sample/hold capacitor is isolated at that point, it gets connected to the input multiplexer for 12us before each conversion.

Normally there should not be any problem if the input impedance is 10k or less as the sample and hold cap will charge fully in that 12us.
The LM35 has low output impedance though...  Try putting a 10nF or 100nF to ground from A3, that ought to eliminate noise and stiffen up the voltage there.  The long unshielded cable to the sensor is going to be picking a lot of noise from the computer.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Full Member
***
Karma: 2
Posts: 213
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
pinMode(3,OUTPUT);
  digitalWrite(3, HIGH);
  ...
  pinMode(3,INPUT);

The Vs pin of the sensor should be high all the time.
You read the value of the sensor on the same pin as Vs?
The output of the sensor is the middle pin.
Logged

It's not my fault when my Posts are full of Errors. This stupid autocorrection from my browser is set up for german grammar.

Offline Offline
Newbie
*
Karma: 1
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do not use USB supply for LM 35 and potentiometer use external supply and make conman ground of both
Logged

Toledo, OH
Offline Offline
God Member
*****
Karma: 36
Posts: 514
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I would be glad if anyone can help me with this..
I have connected a temperature sensor(LM35) to analog pin 1 and a potetiometer to analog pin 0. When the potentiometer reads zero on my serial monitor I have no problem with the LM35. But when i start varying the pot the LM35 values changes even when my room temperature is constant. when i bring back the pot to 0, it reads the correct values. What could be the problem??

Thanks,
SANJAY  

Nice descriptive tread subject, could you be anymore general?  Seriously people, make your subject descriptive!

How about this for a subject: "Temperature sensor (LM35) reads wrong when pot changes".  Wouldn't that make more sense and allow people with some kind of knowledge into your problem better help?  It's not too late!  Change it!

Sorry, it's Friday and this is huge pet peeve of mine, and WAY to common.

Tim
« Last Edit: September 21, 2012, 09:51:25 am by teckel » Logged

Arduino - Teensy - Raspberry Pi
My libraries: NewPing - LCDBitmap - toneAC - NewTone - TimerFreeTone

Pages: [1]   Go Up
Jump to: