Pages: [1]   Go Down
Author Topic: arduino with sharp IR sensors  (Read 713 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 16568
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

GP2Y0A02YK0F
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 16568
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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.
Logged

Pages: [1]   Go Up
Jump to: