Go Down

Topic: gp2y0a710k - Getting strange readings (Read 86 times) previous topic - next topic

K00PER

Hey everyone,
I want to use the voltage results of a Sharp IR Sensor GP2Y0A710K and use the voltage readings to drive how a light blinks. During testing I am getting some strange output to the Serial Monitor. Using the code below the numbers tend to stay at the 130 then drop down to Zero when I move close then back up to the 130s and stabilize there. Looking at the other topics on the forum it looks like when working correctly the serial output should follow the curve and give a farily consistent result depending on the distance.

Thanks for your help.

#define sensorPin 0

int sensorValue = 0;
// this is called on startup
void setup() {
 
 beginSerial(9600);
   pinMode(sensorPin, INPUT);

}

void loop() {
   sensorValue = analogRead(sensorPin);
   Serial.print(sensorValue );
   Serial.print(' ');

}

knut_ny

U run the sensor from 5V ?
White surface 1m from sensor shall give you a raw reading of ca. 500
Try a short delay between radings (eg 20ms)
Ny

K00PER

Yeah I am running it off 5V.
 
My readings look like this:
130
131
132
129
130
130
131
50 (When I move forward they drop)
21
20
20
21
19
45
130 (Even if I haven't moved)
131
130
132
129
...


knut_ny

which direction is forward - relative to sensor ?
note: Sharp GP2Y0A710K Distance Sensor (100-550cm)

I cannot explain those enexpected readings.. sorry
Ny

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy