I am new in this Arduino world. I have a sharp GP2Y0D805Z0F sensor, however, I cannot find any code that works. The sensor has a specification distance that goes from 0.5 to 5 cm.
I have tried the following code, but I don't understand why the output is in volts and not in cm. Is there a way to convert the volts into cm. Sorry if I lack technical knowledge, I am just starting at this.
I am new in this Arduino world. I have a sharp GP2Y0D805Z0F sensor, however, I cannot find any code that works. The sensor has a specification distance that goes from 0.5 to 5 cm.
I have tried the following code, but I don't understand why the output is in volts and not in cm. Is there a way to convert the volts into cm? Sorry if I lack technical knowledge, I am just starting at this.
Code: [Select]
The output is in volts because of the code that you wrote. An analogue input measures a voltage in 1024 steps. You convert the measurement to volts.
Looking at the datasheet of the sensor, the sensor provides either high or low, not a linear voltage indicating distance. So its output indicates presence or no presence of an object inside its range.
It is not very clear but it seems to produce negative-going pulses, the width of which indicates the distance. I think you would read the pulse with "unsigned long pulseWidth = pulseIn(DataPin, LOW, timeout);". The default timeout is 1,000,000 microseconds (1 second) so you should probably pick something shorter. Some experimenting should allow you to determine the distances associated with various pulse lengths.
Hello Arduino Forum. I hope you can help me with a question. I have a project where I need to measure the distance from an RGB colour sensor to a reflective surface. I want to vary the distance of the surface to see how it affects the reading of the colour sensor. I am using this one TCS34725 RGB Color Sensor For Arduino - DFRobot.
Other posts/duplicates MERGED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.
Continued cross posting could result in a time out from the forum.