Pages: [1]   Go Down
Author Topic: I think something is wrong with my analog input  (Read 726 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 0
Posts: 272
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have Spark-Fun Pro-Ethernet
and the analog 4,5 stop working ????
when I connect the RTC it's stuck and "freeze".
so I have wrote a simple code - just to see what there is in every analog input
and I get the same reading from 4 and 5 (nothing is connect to the output-only air....)
this is what I see on the serial :

Quote
analog 2 is 797
analog 3 is 764
analog 4 is 1020
analog 5 is 1020


this is the code :

Code:
#include "Wire.h"

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

void loop(){

  Serial.print("Analog 2 is - ");
    Serial.println(analogRead(A2));
      Serial.print("Analog 3 is - ");
   Serial.println(analogRead(A3));
     Serial.print("Analog 4 is - ");
  Serial.println(analogRead(A4));
    Serial.print("Analog 5 is - ");
   Serial.println(analogRead(A5));

  delay(1000);
}

and there is not a short circuit (A4 doesn't touch A5).

help?

Thanks ,
 
Logged

0
Offline Offline
Shannon Member
****
Karma: 214
Posts: 12424
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The pins A4 and A5 have dual-purpose, they are also the I2C bus (SCL and SDA).  So if you use I2C device like an RTC chip you cannot use the pins for analogRead().
Logged

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

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Floating inputs will give random values.  This is normal.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Offline Offline
Sr. Member
****
Karma: 0
Posts: 272
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"James C4S" - I know that it is random , but all the time it gives the same values?
I check it for 10 min every second - and it gives the same value - this is nor make any sense.

"MarkT" - I used this Analog pins to connect RTC , but it wont show me any RTC connected.
give me 165:165:165.... like there isn't any device connected to A4 and A5. So how else can I found what is my problem?

thanks,
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9675
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but all the time it gives the same values?
I check it for 10 min every second - and it gives the same value - this is nor make any sense.

Why does it not make sense? What is your expectation and why?
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you saying the value is random, but is always the same for 4 and 5?

If so, carefully inspect the bottom of your board to see if the pins have a small solder bridge.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Offline Offline
Sr. Member
****
Karma: 0
Posts: 272
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes at 5 and 4 I get the same value all the time.

no , nothing is touching the 2 analogs .
there isn't a bridge between them.
what else maybe the problem?



Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9675
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've seen chips with floating analog inputs that some of the floating pins would stop randomly floating and would display the analog input of another analog input pin when a voltage was applied to the other pin. It concerned me at first, but then i figured that with nothing connected to the floating pin, most any value might be possible. Maybe your floating pins are floating with another analog input with a voltage applied.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2602
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't get what is the problem:
- can't read RTC;
- can't read RTC when Po/Ethernet connected;
- can't read analog Value when RTC connected;
  #2 could be software library conflict, and has nothing to do with analog readings;
  #3 disconnect all shields from arduino and try to test analog port alone, connecting to 0, 3.3V, 5V and see what is you getting. Than repeat for another port (5) setting (4) to ground and vice-verse.
Logged

0
Offline Offline
Shannon Member
****
Karma: 214
Posts: 12424
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are there pull-up resistors on A4 and A5 to do with the RTC?   That would explain reading a constant high value.  Doesn't explain the RTC failing to respond though (unless its malfunctioning).
Logged

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

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 633
Posts: 34512
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
yes at 5 and 4 I get the same value all the time.
There is only one A/D converter in the arduino with only one sample and hold capacitor on the input. Therefore when you switch an outside pin to it that has nothing attached to it then it is no surprise that the A/D measure the same charge that was on that capacitor from the last time it was switched through with nothing on it.
So with nothing connected to 4 & 5 you will most likely get the same reading.
Logged

Pages: [1]   Go Up
Jump to: