Are we getting close? Proximity Sensors + Arduino




In past tutorials, we have covered temperature, color, time, direction, but never distance or proximity. I think I strayed away from this because most of the lower cost proximity sensors are pretty drop-dead-simple to use and thought it might not be that useful. But the time has come, I’m writing about some distance/proximity sensors. While using them is technically simple, I have 3 pretty different sensors that all have pros/cons, and none of them would make a very suitable replacement for the others, so maybe this will help you choose the right one if you find yourself in need.Are we getting close Proximity Sensors + Arduino




All 3 sensors will be outputting an analog voltage that we will be reading with our Arduino. The typical Arduino has 6 “Analog In” pins located on them. These analog inputs act just like a voltage meter, sensing the voltage on that pin, and are actually 10 bit Analog to digital converters (ADCs). The 10 bit part is the resolution of the ADC. 10bit, or 2^10 = 1024 values. That means that when we read the voltage on that pin, 0-5v value will be translated to between 0 (0V) and 1023(5V). Read our wiki article for more information on ADCs. This resolution limitation of the Arduino’s ADCs are a large part of the reason that analog sensors are often inferior to their digital counterparts. But, digital distance sensors are pretty expensive and hard to come buy. So…

The 3 sensors we will be going over are:
Maxbotix LV-EZ0 Ultrasonic Range Finder
Sharp GP2Y0A21YK Infrared Proximity Sensor
QRD1114 infrared emitter / Phototransistor combo

Hooking it up

Hooking up the LV-EZ0 up is like day one of the Arduino tutorial. The only confusing part is that it has many output types. What you want is the “AN” pin. That is the analog output. Connect this to an analog input as seen in the illustration.

What it is good/bad for

The LV-EZ0’s range is really dependent on the size of the object – About 8ft for something the size of a finger, to over 20ft for something the size of a piece of paper. The best part is that the output is linear, so something that is 6ft way will output half that of something 12 ft away. This makes it very easy to read actual distance with it.

Maxbotix says the LV-EZ0 has a 1 inch resolution and a range of 0 – 254in meaning you could track something with 1in reliability over 254in of movement from the sensor. The reality is that this guy has trouble sensing distances under 1ft, and the output can be pretty shaky especially when trying to sense objects that are not perpendicular with the sensor.

Other options

Maxbotix makes a few different versions of this sensor with various beam widths. A narrow beam is better when you only want to know about objects directly in front of the sensor, and wide is better if you need to know if anything is near. Maxbotix also offers a more precise line (XL Series) that has 1cm accuracy, longer distance, and better noise suppression (makes the read out less shaky)Schematic Are we getting close Proximity Sensors + Arduino

Sharp GP2Y0A21YK IR Proximity Sensor

The Sharp GP2Y0A21YK is an Infrared proximity Sensor. It shines a beam of IR light from an LED, and measures the intensity of light that is bounced pack using a phototransistor. If you stare at the sensor, you can see one of the LEDs glowing slightly red as some of the IR falls into the visible-light spectrum.

For more detail: Are we getting close? Proximity Sensors + Arduino




Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
ESP8266 DS18B20 Temperature Sensor Arduino IDE
ESP8266 DS18B20 temperature sensor, Arduino IDE, EasyIoT Cloud

In this tutorial we will show how to build WiFi ESP8266 DS18B20 temperature logger connected to EasyIoT Cloud. All material...

Close
Scroll to top