Go Down

Topic: arduino with sharp IR sensors (Read 993 times) previous topic - next topic

brad

so i'm working on a basic setup with 5 sharp infrared sensors, plugged into analog pins 0-4 for control, and running off the 5V power plug.  initially i tested this setup with 1 infrared sensor plugged into analog 3, getting power from the 5V.  the code i'm using is basically this:

senAval = analogRead(0);
Serial.println(senAval);
senBval = analogRead(1);
Serial.println(senBval);
senCval = analogRead(2);
Serial.println(senCval);
senDval = analogRead(3);
Serial.println(senDval);
senEval = analogRead(4);
Serial.println(senEval);

when i was initially testing with the one sensor, it was basically just two lines of code, and the arduino was returning different values based on my proximity to the sensor (between ~20 and ~500), which seemed to be correct.  when i got 5 sensors plugged in, and duplicated the code the only response i could get back is 1023.

did i damage the sensors (all of them??  seems unlikely)?  did i screw something up when i re-connected all of the control wires to the analog pins?

retrolefty

Can you provide the part number of your sensors or a link to a data sheet for them? The 3 terminal IR receiver devices I am familiar with output a digital signal not a analog signal. Here is a project using such a sensor from the playground.

http://www.arduino.cc/playground/Code/InfraredReceivers

Lefty

brad


brad

http://www.google.ca/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fsharp-world.com%2Fproducts%2Fdevice%2Flineup%2Fdata%2Fpdf%2Fdatasheet%2Fgp2y0a02yk_e.pdf&ei=OCvHSaidD4G0sAOUpNjbBg&usg=AFQjCNHOJsUlAzPogQYz0svvgS5fRtri-Q&sig2=KLGkErvv_7_7JQbDWknKSw

retrolefty

Sorry Brad, I have no experiance with that type of sensor. Seems like does output a analog voltage. Perhaps you could use a digital volt meter to see if there is valid voltage coming out of the sensor(s).

Lefty


brad

i think i found some bad solder points, so, that may be the problem!

Grumpy_Mike

Make sure that the emitting LED is not interfering with a sensor not associated with it. As a test tape up all but one connector so no light gets out of it. See if this illimates the problem. If so you have a mechanical placement problem rather than an electrical one.

Go Up