Simple obstacle avoidance sensor for free-running robots

Check out the new site at https://rkblog.dev.

Free-running robo-car must has some obstacle sensor to avoid hitting walls. I've described ultrasonic distance sensor that can measure the distance to an obstacle, but there are simpler sensors that use infrared LEDs. They can't measure the distance but they can indicate that the distance is short. Those are so called obstacle avoidance sensors. They can be used in robots to avoid hitting obstacles or as sensor indicating for example if the doors are open or closed.

Obstacle avoidance sensor

Those sensors are made in China and on dx.com they can be bought at a low price. They should be available locally too - via stores that import electronics from China. The sensor has three wires - red (VCC +), green (GND -) and yellow signal. The signal wire must be connected to a digital pin. Then you read the state of the pin - if it's high there is no close obstacle, if low - there is one:

from time import sleep

import pymcu

mb = pymcu.mcuModule()
mb.digitalState(1, 'input')

while True:
    print mb.digitalRead(1)
    sleep(0.1)

The distance at which the stat changes depends on the surface of the obstacle. Dark mat surfaces trigger the sensor from closer distance than bright and more reflective. On the back of the sensor there is also a small screw controlling a potentiometer which may increase or decrease the signal level at which the sensor is triggered.

The housing is threaded and has two nuts that can be used to mount a bracket to it. It makes mounting it to a robot chassis much easier.

Sensor with a mounting bracket
Sensor with a mounting bracket
RkBlog

Check out the new site at https://rkblog.dev.
Comment article
Comment article RkBlog main page Search RSS Contact