Short Range Proximity

This sensor uses an infrared transmitter and receiver to gauge the distance between the sensor and an object near it. It has a digital and an analog output which can be used to control things in response to the presence or absence of an object.

Short Range Proximity

This sensor uses an infrared transmitter and receiver to gauge the distance between the sensor and an object near it. It has a digital and an analog output which can be used to control things in response to the presence or absence of an object.


Quick Commands


To get the sensor working, assuming the analog pout is connected to port A a1 and the digital output is connected to a2, enter the commands below at the command prompt.


gvr a1 0 100 get a2


The gvr a1 0 100 will result in the value of a1 increasing as an object moves away from the sensor. You can see this change on the LIVE page.


Buttons


The button press btp and button release btr commands can be used with this sensor. This example uses a button on port a pin a2 and turns the USER LED (l1) on when the sensor detects an object. Removing the object turns it off.

btp a2 l1 1 btr a2 l1 0


Videos


Getting Started

Using the Sensor


NOTES AND CAUTIONS:

  1. This sensor needs to be adjusted if you want to use the digital output

  2. It's maximum range is about 5cm

  3. Ambient lighting can affect the performance of the sensor


Parts of the Sensor



Power LED - Turns on when the power is applied.

Detection LED - Turns on when an object is detected.

Variable Resistor - Used to adjust the sensitivity of the digital output.

Transmitter - The infrared transmitter.

Receiver - The infrared receiver.


How it Works


The transmitter sends an infrared signal and the receiver receives any signal reflected by an object nearby. The closer the objects the stronger the infrared signal that's returned and the lower the output voltage on the analog output. The digital output will go high (3V) when an object is detected and the blue variable resistor sets the trigger threshold for the digital output.


Input and Output Pins

The sensor has two output pins described below:



Connecting the Sensor to the JackBord



  1. First bolt the sensor onto port A using an M4 nut and bolt. This is because we're going to use the pins from port A to control the sensor and specifically we need the analog inputs on port A.

  2. Take a green jumper wire and connect it to the ground pin on the JackBord and take the other end and connect it to the green ground pin on the sensor.

  3. Connect a yellow jumper wire to the 3V pin on the JackBord on port A and then connect the other end to the 3V power input on the sensor.

  4. Connect a black jumper wire to the digital output of the sensor and the other end goes to port A pin a2.

  5. Connect the analog output of the sensor which is the white pin onto port pin a1 of the JackBord.

When you are done it should look like the picture below: