Pages: [1]   Go Down
Author Topic: Problem using more analog inputs at a time  (Read 747 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

I am trying to do this project where I read a temperature from LM35 on analog pin 0 and an electrical resistance (like a photoresistance or potentiometer) on analog pin 1 and display the values on an LCD.
Everything works fine with a tiny bit of a problem: when I change the value of the potentiometer on pin 1, the temperature changes a little. Do analog inputs influence each other? The LM35 is connected to 3V3 pin of the Arduino (do you have any idea why it displays ten Censius degrees more than normal when I connect it to 5V?). I might be using more analog pins in the future and this is annoying.

Thank you!
Logged

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

1.
the LM35 likes a lot of voltages... 4V to 30V...
but not 3.3V...

2.
can u make a painting of ur cabling?

3.
what if u do 10 analogRead(P)-s from the same pin P with a delay(200) between each?
do the values change then?
Logged

-Arne

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

1. If I connect the LM35 to 5V, it outputs 37 degrees C instead of 27 and so on, with 10 degrees more than normal;
2. I will draw a schematic and...
3. I will try using delay tomorrow when I'll get to the lab.

Thanks for the answer! Delaying might be the solution for my problem.
Logged

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

1.
maybe u touched the sensor shortly before u read its output? smiley
3.3V is definitely not within its normal parameters...

2.
or ur Vref is lower than u think?
what formula do u use?
what program do u use?

3.
did u try another Vref?
with analogReference(INTERNAL)?
http://arduino.cc/en/Reference/AnalogReference?from=Reference.AREF
Logged

-Arne

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

My understanding is that there is one analog to digital convert that is switched between the 6 analog inputs. If you switch between two inputs, the second reading can contain a residual from the first, this is what you are seeing. The simplest solution is to make a dummy reading every time you switch to a new analog input i.e.

analogRead(TEMP_INPUT); // dont use this one, its the dummy
int nTemp = analogRead(TEMP_INPUT);

analogRead(POT_INPUT); // dont use this one, its the dummy
int nPotValue = analogRead(POT_INPUT);

Duane B

rcarduino.blogspot.com
Logged


Pages: [1]   Go Up
Jump to: