Build Your First Robot - Part 3

Build Your First Robot - Part 3

Sense

In previous articles, we looked at how a robot system works by following a simple Sense-Think-Act cycle. We also looked at motors and how they constitute the act part of the cycle. We also built a robot base using these motors and learned how to control the direction of motion using H-bridge circuits and motor controllers.

In this article, we will look at ways to sense the line that the robot can follow it. We will use an simple IR module to accomplish this task. The IR module detects the difference between bright and dark backgrounds.

Infra-Red (IR) Sensor Module

There are two green lights on the IR module. The one on the right shows that the module is powered up. The green light on the left is the one that detects whether the background is bright or dark.

IR sensor module used to detect a dark line

As we move the IR module over the dark line, the green light lights up when passing over the dark line showing that it can detect the line.

IR sensor module detecting the dark line

How does it work?

The IR module performs this task by detecting the amount of light reflected from the surface. Brighter surfaces reflect more light than darker ones. To avoid interference from ambient light, the IR module uses its own light source (IR emitter). Infrared light is invisible to the human eye, but cameras can capture some of it. For example, the pink glow in the bottom right image is the infrared light emitted by the module.

Digital vs Analog

The IR module provides both digital and analog outputs. The detection light is linked to the digital output pin, which turns on when the amount of light detected crosses a certain threshold. This threshold can be adjusted using a potentiometer (similar to a volume knob) on the IR module. However, if you want to monitor the changing values to detect when the robot starts crossing a line, you can use the analog output instead.


Inspecting the analog output from the IR sensor module using an oscilloscope

The inset video displays the output of the analog pin connected to an oscilloscope. As we move the IR module over the line, the green line on the oscilloscope shifts up or down, indicating a change in voltage. We'll start by using the digital output to build the line-following robot, and later, we can transition to using the analog output for more precise control.

That brings us to the end of today's article. Tomorrow we shall tackle the think part of the Sense-Think-Act cycle.


要查看或添加评论,请登录

Srinivasan Vijayarangan的更多文章

社区洞察

其他会员也浏览了