Inconsistent input values on analog pins

So, this is the issue:

When neutral, analogRead on any of my analog inputs produces something around 525.

When any pin goes high, it pulls the voltage up on all other pins somewhat (i.e., A0 will be 1023, A1 will be 900, A2 will be 876, etc), regardless of if there's anything connected to that pin or not.

I've tried solutions I see elsewhere, like inserting a delays before reading the pins to allow the MUX to settle. Doesn't work. This code:

analogValue1 = analogRead(0);
analogValue2 = analogRead(5);

produces the same output as this code:

delay(50);
analogValue1 = analogRead(0);
delay(50);
analogValue2 = analogRead(5);

Both 0 and 5 have a circuit hooked up, but if I were to read the other non-active pins, they would all have readings 300-ish too high.

Any thoughts? Help would be appreciated, from a relative newbie.

Duemilanove 328, btw.

Any thoughts? Help would be appreciated, from a relative newbie.

Let me get this straight. You are concerned and/or curious about the value returned on reading analog inputs pins that have nothing wired to them? If so, why?

Lefty

I don't, I'm only interested in things that have something attached. I added the info on empty pins because I was using it to debug the situation -- its happening everywhere, not just on stuff thats connected.

Right now I just have two pins I'm trying to read, and when one goes high it interferes with the other.

Good, so lets just deal with pins that have something wired to them. What exactly is wired to them? Do the two signals have a driving (source) impedance of 10k ohms or less? Do the signals you have wired to the pins also have a ground return wired to a arduino ground pin?

Lefty

To make it simple, lets just say its a simple switch setup attached to both. either the circuit is open, or its closed, and i'm trying to determine if none, one, or both are closed on each loop.

I'm probably doing something stupid, because it was working before, and when I tried to backpedal, it no longer works at that point any longer. But I can't figure it out, for the life of me.

noodle_:
To make it simple, lets just say its a simple switch setup attached to both. either the circuit is open, or its closed, and i'm trying to determine if none, one, or both are closed on each loop.

I'm probably doing something stupid, because it was working before, and when I tried to backpedal, it no longer works at that point any longer. But I can't figure it out, for the life of me.

Well a open switch contact wired to a analog input pin is the same as having nothing wired to the input pin at all. That would create a 'floating input pin' condition and is not a valid signal to read. One wouldn't normally wire a two position switch (on/off) to a analog input pin anyway as that would be more fitting for a digital input pin.

There are ways to utilize pull-up or pull-down resistors to prevent floating input pin problems. But first we need to know more about the signal, what voltage does it create when the switch is on?

You may need to post a electrical drawing to clearly state what you are trying to do.

Lefty

Fair enough, I was trying to keep it easier without going into a huge discussion on what I'm doing. And I think you're right, I'm probably hitting a floating input pin.

Here's a better question, then -- the switches are more like potentiometers that go from open, to some level of resistance, to closed. I only want to consider a switch "closed" if the resistance is approximately low enough. I was trying to use the analog inputs to approximate that (working with what I have on hand).

I could switch it to digital, but I won't have the same level of control, will I? But even so, I'd still have a floating input pin when the switch is open.

the switches are more like potentiometers that go from open, to some level of resistance, to closed.

I would have to see a datasheet covering the electrical specification of this switch/pot device before I could be of any further help. There is lots of information of how to deal with floating inputs if you search on pull-ups or pull-down resistors, I'm sure that would be part of your ultimate 'solution'.

Good luck;

Lefty

Yeah, I was trying to work with some pulling resistors to make it work, but I couldn't quite get it operating as I wanted. I have a few new ideas I'll try today.

I can't give you a specific spec because its not built with standard components. Whats in on the line can change a lot from one minute to the next. Current flows through various materials, wire, solid metal, conductive fabric, etc., and they're all interchangeable. The point of using the analog input is to kind of simulate an ohmmeter, making sure that once the switch closes, the line isn't too resistive.

I appreciate the help