Infrared Obstacle Avoidance
This unit will detect the presence of objects at distances of between about 2cm to 30cm.
The Infrared Obstacle Avoidance Sensor will detect the presence of objects at distances of between about 2cm to 30cm.
It uses an infrared emitting diode to send out an IR signal. Should the signal hit a nearby surface, it will be reflected back to the sensor and the output will go low or to 0V.
The potentiometer is used to adjust the sensitivity of the sensor. Turning it anticlockwise will reduce the detection range so it detects closer objects, turning it clockwise increases the sensitivity and it will detect objects farther away.
How the Sensor Works
The output pin is normally low and will go high when a person or an animal crosses the sensors beam. This beam is like a 100-degree-wide fan centered along the axis of the sensor looking out from the white dome.
Note: Once the sensor is triggered it will take about 8 to 10 seconds for it to reset.
The table below lists the pins of the sensor.
Connecting the Jumpers to the Sensor
First we will connect the jumpers to the sensor. Then, we will connect it to the JackBord. The sensor needs a 5V supply to work. It needs 3 female to female jumper wires to connect to the JackBord. The output of the sensor can be connected to any of the pins on ports A, B or C.
You need the following items:
3 female to female jumper wires, 10cm or more
Follow these steps to avoid damage to the JackBord or the sensor. The jumper wires are connected to the sensor as shown in the picture below. In our case, we have used a red jumper for the 5V power, a purple one for the output and a green one for ground. Connect yours by following these steps:
Turn off the JackBord
Connect a red female to jumper to the rightmost pin of the sensor, note this is with the sensor facing up as in the picture on the left.
Connect a green or black jumper wire to the center ground pin.
Connect a jumper for the output to the left pin. In our case we used a purple jumper.
Check your sensor connections with the picture below. Here we have used a red wire for 5V, a purple one for the output and a green one for ground.
Connecting the Sensor to the JackBord
Now that we have the jumpers connected to the sensor we need to connect the other ends to the JackBord. These connections are listed in the table.
We are going to connect the sensor to port Pin A1 on port A. We will also use port A's ground and 5V power line to keep things tidy. Follow these steps to connect the sensor to the JackBord:
Turn off the JackBord
Connect the green ground wire from the sensor to the ground pin on port A.
Connect the red power wire from the sensor to the +5V pin on port A.
Connect the purple output wire from the sensor to port pin A1 on the JackBord.
Once you have made the connections check them against the pictures below and make sure they match.
Using the Sensor with the JackBord
Turn on the JackBord and go to the dashboard. We can use the button press and release commands, with this sensor so we can get the JackBord to take certain actions in response to the state of the sensor. When an object is detected the output will go high (3V) and once the object leaves the sensors view the output will go back to being low (0V).
The commands below setup the sensor on port A1 so that when an object is detected the USER LED on the front of the JackBord will be turned on, this is accomplished by the bts command. The USER LED will turn off once the object leaves the field and this is because of the btr command. If needed clear any current button setup using the rstb command.
btp a1 l1 1
btr a1 l1 0