Go Down

Topic: I think something is wrong with my analog input (Read 744 times) previous topic - next topic

david1234

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: [Select]
#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 ,

MarkT

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().
[ I won't respond to messages, use the forum please ]

James C4S

Floating inputs will give random values.  This is normal.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

david1234

"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,

zoomkat

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?
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

James C4S

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.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

david1234

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?




zoomkat

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.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

Magician

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.

MarkT

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).
[ I won't respond to messages, use the forum please ]

Grumpy_Mike

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.

Go Up