Browse By

How to connect a Sharp 2Y0A710F distance sensor to Arduino


Sharp 2Y0A710F is a distance measuring sensor unit, composed of an integrated combination of PSD (position sensitive detector) , IRED (infrared emitting diode) and signal processing circuit. The variety of the reflectivity of the object, the environmental temperature and the operating duration are not influenced easily to the distance detection because of adopting the triangulation method. The sensor outputs the voltage corresponding to the detection distance. So it can also be used as a proximity sensor. In order to get readings you have to connect it to an analog pin since it is analog sensor.


And here is the code you can use:

void setup() {

int sensorValue;
int distance;
void loop() {
 sensorValue = analogRead(0);   
   Serial.print("Distance: ");


Please keep in mind that the readings are not that accurate and it might be a good idea to use it only for detecting objects within the range of 100cm – 550cm.


2 thoughts on “How to connect a Sharp 2Y0A710F distance sensor to Arduino”

Leave a Reply

Your email address will not be published. Required fields are marked *