Go Down

Topic: Multiple Infrared Sensors (Read 3 times) previous topic - next topic

mpdelbuono

Hi all,

We're having some trouble hooking up some infrared sensors to our Arduino (Diecmela, actually the Boarduino footprint found at ladyada.net ).

We have three infrared sensors hooked up to the A0, A1, and A2 pins. We are adjusting the AREF pin to be set to 3V.

We are noticing that when the infrared sensor goes out of range (that is, goes to a very low voltage), the signal becomes unstable and the results we get from analogRead() are very irratic. When in range (the voltage is higher), the signal becomes stable again. We have hooked these up to an oscilloscope to verify this problem and see a very irratic signal. However, when we hook up the sensor to a power supply and hook the signal directly to the scope, we see a perfectly stable signal even when out of range.

We came across a little phenomenon while testing this -- we had removed the sensors from A1 and A2 and began playing with just A0. We noticed that the A1 and A2 pins got pulled up to the voltage level of the A0 pin! Surely this isn't anything I haven't heard of before; I just hooked up a pull-down resistor to each and the A1 and A2 pins went to zero and everything was as expected again.

... so is this the problem we're having? We're sampling from each of the sensors at an interval of around 100ms, so could these signals be interfering?

If so, what's the solution? Just a pull-down resistor on each pin? I had tried that but the signal still seemed a bit unstable, but perhaps the 49K resistors I was using was a bit too much; perhaps 10K would work better?

Any advice would be greatly appreciated.

Regards,
-- Matt

P.S. I can post my code, but I don't think this has anything to do with it. It seems more of an electrical problem to me.

Daniel2

hi

it sounds like the intputs are floating, which would explain the "mystery" signals on A1 and A2. Arduino inputs are extremely high impedance, meaning they only take a few nanoamperes of current to activate them. This means that if they aren't properly "loaded" they tend to pick up what's going on around them, or act strangely.


What kind of sensors are you using? that's an important part of figuring out the problem. If the sensors go into "high impedance" state when they are out of range, then you would get exactly the kind of problems you describe. The oscilloscope impedance might be enough to "load" them and give you the "good" scope readings you got. I would first try a 1M or 100K resistor across the input and see what you get.

D

mpdelbuono

Unfortunately I don't have access to it until Friday evening (Eastern) so I'll post then (all locked up and stuff; don't need anyone jacking our PC/104 that's attached to it >< ). I'll pick up the datasheets then and post when I can :)

Thanks,
-- Matt

mpdelbuono

Okay, I got the datasheet. Here it is:

http://info.hobbyengineering.com/specs/SHARP-GP2Y0A02YK.pdf

Please let me know if you see anything; I don't. Today I'll be trying what you said with a resistor as well as some other suggestions I got.

Thanks,
-- Matt

Daniel2

hi

well, there's nothing special in the datasheet. You only need these connections, which you should double-check:
Sensor GND> Arduino GND
Sensor +5 > Arduino +5
Sensor out pin > Arduino analog in.

A pull-up resistor should not be necessary. I would bet that at long distances, where the gain of the sensor input stages is pretty high, that the thee sensors are interacting. Cover two up and see if the third is unstable...

D

mpdelbuono

We actually found the problem while working on something else,

The problem is that device has some really severe drops in resistance periodically (not sure what causes this, but I imagine it's somehow related to how it's taking samples). This causes a sudden drop on the Vcc line. For this device it's ok, because it's expecting it, but the other two devices are not, causing a sudden change in the signal.

We put a 10uF capacitor across from Vcc to ground on each of the three sensors (literally right next to them, as we found out placing them away from the sensors doesn't seem to help as much) and the fluctuation went away. Combine that with a 4.7uF capacitor from signal to ground and taking 100 samples and then averaging the results, we have managed to get an extremely stable signal.

Thanks for all the help. I knew it had to be something stupid.
-- Matt

Go Up