Infrared Sensor Basics and Robot Autonomy
Programming Using Simulink
By Jose Avendano
© 2019 The MathWorks, Inc.
1
Agenda
▪ Introduction to the BEST IR Sensor
▪ Sensor Applications
1. Object Detection
2. Line Detection
3. Motor Encoders
▪ Autonomy Integration
1. BEST SimBot
2. Joystick Triggering
3. Sequences of Commands
2
BEST Robotics IR Sensor Kit
3
BEST Robotics Infrared (IR) Sensor
▪ 2 Sensor components
Receiver
Beam
Field
Projection Area
Of
View
Transmitter Receiver
4
Sensor Detections
1. IR Beam cannot be
obstructed
✔
IR Beam must be within
X
2.
detection distance
X
5
Sensor Testing
▪ Transmitter LED indicates power
▪ Receiver LED indicates detection of IR beam
IR Beam Active (LED ON) IR Beam Broken (LED OFF)
✔ X 6
Sensor Sensitivity
▪ Adjust potentiometer to
change sensitivity
▪ Somewhere in the middle
(not either extreme) is the
highest sensitivity
7
Sensor Sensitivity
8
Sensor Application 1
Object Detection
9
Object Detection
▪ Bouncing light from an object
▪ Place transmitter and receiver
facing in the same direction
▪ Reflected light will be detected
and indicate an object
✔X
10
Object Detection
11
Simulink Example 1
Object Detection
12
Simulink Example: Move Until Object is Detected
13
Sensor Application 2
Line Following
14
Line Detection
▪ Same as object detection, place X
✔
transmitter and receiver facing the
same direction
▪ Light will be reflected by bright
colored surfaces and absorbed by
dark surfaces
▪ Place the transmitter and receiver
strategically
▪ Make sure to calibrate the sensor
sensitivity
15
Line Detection
16
Line Following
17
Simulink Example 2
Line Following
18
Sensor Application 3
Wheel Encoders
19
Motor/Wheel Encoders
▪ Place the transmitter and
receiver so the detection is
interrupted by a rotating
wheel
▪ Resolution of encoder
depends on number of
detections per rotation
▪ Use black paint and adjust
sensitivity to help reduce
false detections
20
Motor/Wheel Encoders
▪ Derive distance traveled
with robot geometry 9
8
7
6
5
4
3
2
1
360°
▪ Derive robot orientation
using multiple encoders
21
Simulink Example 3
Wheel Encoders
22
Autonomy Integration
23
Intro to SimBot
▪ Robot designed for teaching BEST workshops
▪ Built with BEST components
▪ Robot controller is a VEX Arm-Cortex
Microcontroller
24
SimBot Components
A
A. 1 Servo Motor
B. 3 DC Motors B
– Left Wheel
– Right Wheel
– Arm
C
C. 2 Contact switches
D. 2 Potentiometers D
E. 1 InfraRed (IR) Sensor
25
Fetching an object Autonomously
26
Simulink Example 4
Trigger Autonomous Behavior
27
Simulink Example 5
Sequencing Commands
28
MathWorks Student Competitions
Mobile Robotics Tutorials
▪ Control of robot motion
▪ PID Controllers
▪ Line Following
▪ Obstacle Detection
▪ Path Navigation
29
Robot Autonomy and Control Webinar
▪ Intro to Robot Autonomy
▪ Motion Control
▪ Using VEX Sensors
▪ Control Algorithms
▪ Navigation Logic/State-Machines
▪ PID Control implementations
30