Robotics
Level One
Lesson 1
Introduction to robotics
What is a
robot?
A robot is a machine designed
to execute one or more task
automatically with speed and
precision. They can be in any
form which include human,
animal, etc. a robot in the form
of a human is called humanoid
robot.
What is Robotics?
Robotics is the branch of
technology that deals with
design, construction,
operation, and application of
robots.
It is the field of computer
science and engineering
concerned with creating
robots, devices that can move
and react to sensory inputs.
Types of robots
• Stationary robots
• Wheeled robots
• Legged robots
• Swimming robots (robot fish)
• Flying robots
• Swarm robots
• Modular robots
• Micro robots
• Nano robots
• Soft elastic robots
Applications of robots
Robots are applied in the following ways:
• Industrial robots
• Domestic robots
• Medical robots
• Service robots
• Military robots
• Entertainment robots
• Space robots
• Hobby and competition robots
Flying robot
Wheeled Military robot
Domestic Robot Legged military
Roomba cleans the robot
floor
Space Robot
Stationary Medical Robot working with
doctors
Stationary Industrial robot
Educational robot
LESSON 2
COMPONENT OF A ROBOT
Components of a robot
• Input units: theses are mostly sensors through which the robots gets
information about its environment.
• Arithmetic and logical unit: the information processing unit of the
robot. It is governed by the code it is executing.
• Output units: these are displays, speakers, electronics, electrical,
mechanical, magnetic, electro-pneumatic and electro-hydraulic
actuators through which the robots actualizes its response to
processes.
• Control programs: these are written instructions that determines the
behaviour of the robot.
INPUT UNITS
A human has five senses and with them the human can
interact with his or her environment. A robot can have
one or more inputs (sensors) depending on the
function and purpose of the robot. The more the
sensors, the more versatile a robot can be. Input units
(sensors) are the means a robot receives information
about its surrounding.
Example of sensors
Infrared sensor is a Temperature sensors Humidity sensor
system of infrared are sensors that can senses the amount
light emitting and sense states and of moisture
receiving diodes. changes in present in the soil
They are used for temperature of their or air.
proximity and line environment.
tracking.
LIGHT SENSOR also
called LDR (Light
ULTRASONIC SENSOR Dependent Resistor)
INDUCTIVE also called range is a sensor for
PROXIMITY SENSOR finder is a sonar detecting light
for detecting the (sound) sensor for intensity. It resistance
presence of object at detecting the increases with
close range. distance of near decrease in light
object. intensity on its
surface.
GAS SENSOR is a
ALCOHOL SENSOR is
sensor for detecting
for the detection
and measuring the
and measurement
intensity of gas like TOUCH SENSOR for
of alcohol content
methane, butane, detecting touch.
of the air or
cooking gas, etc.
substance.
SPEED SENSOR for
COLOUR SENSOR TILT SENSOR for the measurement of
for detection and tilt detection and the speed of an
measurement of measurement. object or robot.
the RGB property
of a colour.
AI STARTER
SENSORS
The AI starter robot has six sensors:
1. Button
2. Ultrasonic sensor
3. Infrared sensor
4. Light sensor
5. Light sensor
6. Geomagnetic sensor
CONTROL UNIT
Control unit is the brain of a robot. It receives inputs
from sensors, processes them and returns an output in
the form of single bit, serial or parallel electrical signal
to output units. It is the arithmetical and logical unit of
the robot. It seats between input and output devices.
Its actions are governed by the control program.
Control unit can be made of:
Microcontrollers
Microprocessor
s
AI-STARTER CONTROL
UNIT
The Ai-starter control unit
is a microcontroller made
by Arduino with the name
Arduino mega 2560. it
seats at the heart of the
Ai-starter motherboard.
Arduino Mega 2560 microcontroller
OUTPUT
DEVICES
This are the robot means of response to input processes. They receive control
signals from the microcontroller and respond accordingly. These include:
1. Light Emitting Diode (LED)
2. Buzzer (produce sound)
3. Speaker (produce modulated sound)
4. LCD (Liquid crystal display)
5. Servo motor
6. Stepper motor
7. Suction cup
8. Electrical actuators
9. Electromagnetic actuators
OUTPUT
DEVICES
LCD
LED
GLCD Speakers and buzzers
Display units
OUTPUT DEVICES
Actuators are component of a robot that helps carry out the moving and controlling of a
mechanism or system.
Actuator
s
AI-starter output devices
1. Buzzer
2. LED
3. Stepper/encoder motor
4. Servo motor (to be attached)
Practical class work
Ai-starter input, output and control unit identification.
Lesson 3
Ai-Starter kit
AI-Starter kit
It is a robot designed with no-soldering assembly technique, using
brass stubs to fix control board, and ribbon cables to connect each
board, of which the layer is clear.
Parts of the AI-Starter Kit
• Mother board
• Encoder motor
• Infrared sensor
• Colour sensor
• Ultrasonic ranger sensor
• Wheels
• Cable connectors
• Screws
• chassis
1. Encoder interface- connect to the right motor.
2. Motor interface- connect to the right motor
The motherboard 3. Motor interface – connect to the left motor.
4. Encoder interface- connect to the left motor.
5. Infrared sensor interface – connect to infrared
sensor.
6. Colour sensor- connect to the right colour sensor.
7. The left colour interface – connect to the left colour
sensor interface.
8. Ultrasonic sensor interface- connect to the right
ultrasonic sensor.
9. Ultrasonic sensor- connect to the front ultrasonic
sensor.
10. Ultrasonic sensor interface- connect to the left
ultrasonic sensor.
11. Xbee interface
12. Reserved servo interface
13. Bluetooth interface, a UART interface.
14. Reserved servo interface.
15. Reserved serial interface (UART)
16. Wifi interface (UART)
17. USB interface (micro USB)
18. Power interface –connect to battery.
Infrared Sensor
An infrared sensor is built into the front-
bottom of AI-Starter, which can recognize
black line by judging ground colour for
automatic patrol. 6-channel high-precision
infrared pair tubes and 6 adjustable
potentiometers are built into infrared sensor,
which are used to adjust the distance detected
by infrared pair tube. Infrared sensor can
detect track black line accurately, the
detection range is 3cm, and the accuracy is
0.1cm.
Ultrasonic Sensor
Three ultrasonic sensors
are built into the head of
AI-Starter, which can
detect obstacle distance in
the range of 3mm to
500mm in front of AI-
Starter. There are three in
the Ai-starter: front, front-
right and front-left.
Colour sensors
Two colour sensors, left and
right, are built into the
bottom of AI-Starter, which
can recognize the colour on
the ground to execute
different task according to
the RGB properties of the
detected colour.
Practical class work
• Ai-starter parts identification
• Motherboard component identification
• Sockets
• Cables
• Screws
• Studs
• Chases
• Sensors
• Wheels
• Universal roller
Assembling the robot
ASSEMBLING DOBOT SMART CAR
Practical classwork
• Assemble the AI-Starter kit;
LESSON 4
Associated software and installation
Programming software
The robot can be programmed with any of the following software:
• Dobotblock software
• Mixly software
• Arduino software
WHAT IS DOBOTBLOCK?
DOBOTBLOCK is a graphical programming software,
based on Google’s Blockly graphical programming
framework, and developed by Dobot Team. Instead of
writing your control code in text language, it is written
with stacked blocks.
Dobotblock Graphic User Interface
project
Full screen mode Code mode
Block category
Block
Arduino text
selection
code
Device mode
Block code
Ai-starter mode
Device Open Upload Zoom tool
selection Dobot code
monitor
System interface
Practical classwork
ARDUINO, AND DOBOT BLOCK IDE INSTALLATIONS
installation requirement:
64 bit operating system
install Arduino first to provide the robot USB driver
LESSON 5
Block Coding
The control codes are
not to be written in
text form but in
blocks. There are
different types of
blocks as defined by
function.
Understanding the blocks
The blocks are shaped according to their function.
The shape of a block determines where they can be used.
Theshape also determines what other blocks they can receive as
parameter or function.
Start block
Allblock coding in
dobotblock start with the
start block. As the shape of
the block indicates, it
receives no parameter but
provides connecting point
for another block below it.
Data Block
Data blocks are
blocks that holds
Boolean (true or
false), numeric
value.
Diamond shape for Boolean
Oval shape for numeric
data. Holds true or false as
data. Holds numbers as
data.
data
Function block
Function blocks are blocks that perform actions and may return or not return
data. The ones that returns data are either oval or diamond in shape.
Example of functions that return values
Examples: Returns TRUE Returns 15
Function blocks that return no value
These blocks perform actions
and returns no value.
Some blocks take parameter(s)
A parameter is an object value that is needed by the function
to perform its action. It could be Boolean or numeric data.
Examples boolean parameter blocks:
The empty spaces are
diamond in shape. These
indicate that the needed
parameters are Boolean
(diamond shape).
Examples of numeric parameter blocks:
The required data
here is numeric
for the parameter
shape is oval.
Parts of a Program
Run once – any command
loaded into this section is
executed once in the code.
• Forever loop - any
command loaded into
the forever block is
executed continuously.
Practical classwork
Replicatethe code displayed
on your dobotblock platform.
Upload the simple code to
make the robot to drive;
Test the AI-Starter.
LESSON 6
Moving and indicating correctly
VARIABLE
BLOCK
DATA TYPES
A type, also called data type,
Tells you the possible nature of data. It also offers a
nice way to directly reserve a space with a defined
size in memory.
Data type
DATA TYPE DESCRIPTION SYSTEM RANGE
BIT SMALLEST UNIT - 0 or 1
BYTE It stores numbers as 8-bit unsigned data that means from 0 to 255. 8 BIT 0 to 255
CHAR It stores single-quoted characters such as 'a' as numbers, following the ASCII 8 BIT 0 to 255
chart
INTEGER It stores numbers as 2-bytes signed data which means from -32,768 to 32,767 it 16 BIT -32,768 to 32,767
can also be unsigned and then store numbers from 0 to 65,535.
LONG It stores numbers as 4-bytes signed data, which means from 32 BIT -2,147,483,648 to
-2,147,483,648 to 2,147,483,647 and can be unsigned and then stores numbers 2,147,483,647
from 0 to 4,294,967,295.
FLOAT It basically stores numbers with a decimal point from -3.4028235E + 38 to 32BIT -3.4028235E + 38 to
3.4028235E + 38 as 4-bytes signed data. 3.4028235E + 38
DOUBLE It generally stores float values with a precision two times greater than the float 32 BIT -3.4028235E + 38 to
value. 3.4028235E + 38
STRING It stores text strings in an array of char where the last element is null that is a BYTES
particular character (ASCII code 0).
BOOLEAN It stores false or true. BYTE 0 OR 1
Variables
A variable is a memory storage location
bounded to a symbolic name. This reserved
memory area can be filled or left empty.
Basically, it is used to store different types of
values. A variable must be assigned a data type.
example
• For all sprites – the declared variable
will be available for all the robots you
selected at a time. For use when
coding multiple robots.
• For this sprite only – the declared
variable is for use only for a selected
robot. For use when coding single
robot.
Naming rules of variables
• A variable name should not start with a number
• 2speedx
• Speed2
• It should not contain space
• Low speed x
• LowSpeed
• It should not contain any special character (+-()*&^%$£”!><;:@’}{][/.,)
• It should not be any of the reserved words (if, end, start, brake,
switch, else, return, stop, from, while, do, etc)
Practical Classwork
• Start a Dobotblock project
• Create the following variables and initialize them:
• Speed1 =30
• Speed2 =60
• Speed3 =90
• Brake = 0
• Reverse = -50
Blocks in focus:
• AI-Starter blocks
• The Motion blocks
AI-Starter Blocks
Smartbot Init- this block initializes the robot and
makes it ready to work
Set Key Init – this defines the functions of the buttons
Calibrate Run On/off
For setting the speed and drive power of the robot motors.
• KP: scale factor. Value range: 0.5 -2.5
• KI: integration factor. Value range: 0.05 -0.5
For turning on/off/blink of the LED on the left (LED1) or
Right (LED2)
Motion Blocks RPM – Revolution Per Minute
For the driving of the motor at a set speed (RPM).
When the value is positive, the motor drives forward
and when negative it drives in reverse. The speed can
be set to value between 0 to 100.
For activating the servo motor communication with the
robot.
For making the servo motor rotate as defined by the
angle
For deactivating the servo motor communication from the
robot.
Practical classwork
• Driving straight;
• Indicating with light emitting diodes;
• Changing speed.
LESSON 7
MATHS BLOCK
Maths blocks are blocks for performing arithmetical
and logical operations in the process of coding.
Maths block division
• Arithmetical process blocks
• Logical process blocks
Arithmetical process blocks
Numeric data block
For performing addition
For performing subtraction
For performing multiplication
For performing division
For picking number randomly between two defined numbers.
For picking maximum/minimum number in a set of numbers
Logical process blocks (Boolean process)
For testing if a number/data is less than a defined number. It returns
true(1) or false(0).
For testing if a number/data is equal to a defined number. It returns
true(1) or false(0).
For testing if a number/data is greater than a defined number. It
returns true(1) or false(0).
For testing if two conditions are true. It returns true(1) or false(0).
For testing if one or two conditions are true. It returns true(1) or false(0).
For reversing/inverting the result of a condition. It returns true(1) if the
condition result is false(0) and false(0) when the result is true(1).
Other maths blocks
& ( AND) (OR)
For bit operation of the
two data
For obtaining the absolute number of any giving number or data
For getting the number of byte of a number
For defining the range of a
number.
Practical
classwork
• Apply variables to arithmetical processes.
example
• Apply variables to logical processes.
example
LESSON 8
Control Blocks
What is a control block?
A control block is a block for the manipulation of the
behaviour of the robot. Control blocks are mostly
conditional and will execute when the logical test of the
condition returns true. They are used to create
conditional actions in the robot.
What is a conditional action?
A conditional action is an action that is taken only when
the defined rules (conditions) are met. This means that
the action will not be taken until the logical test of the
condition returns true. With conditional actions the
robot can respond according to the processed input
signal in order to alter its behaviour.
Waiting block
(delay)
For making the robot wait for a period specified in
seconds. During this wait, it will sustain current
action.
For making the robot wait until the given condition
is true
Repeat blocks
It is a loop command for repeating inserted blocks a number of
time specified. It can be used to make the robot execute
command or commands a number of times.
It is a loop command for repeating inserted blocks until the
given condition is true. It can be used to make the robot execute
command or commands until the specified condition is true.
It is a loop command for repeating inserted blocks endlessly. It
can be used to make the robot continuously repeat set of
actions.
It is a loop command for execution of inserted
block starting from one point of a data condition
to another in step defined.
Conditional execution blocks (IF
blocks)
For conditional execution of blocks inserted. If
the condition evaluates to true, the blocks are
executed once. It can be used to make the
robot execute commands only when the
condition is true.
For conditional execution of inserted
blocks. When the condition evaluates
true, the first blocks are executed and if
false, the else blocks are executed.
Loop brake blocks
For stopping the execution of a process or all
processes.
For breaking/getting out of a loops.
Practical classwork
Set initial speed to 20 rpm
1. Drive and increment speed by 10 rpm every 1 second, stop when
the speed gets to 80 rpm.
2. Drive and increment speed by 10 every 1 second, turn right when
the speed gets to 80 rpm and stop.
3. Drive and increment speed by 10 every 1 second, turn left when the
speed gets to 80 rpm and stop.
4. Drive and increment speed by 10 every 1 second, reverse when the
speed gets to 80 rpm and stop.
Lesson 9
Driving with senses
Robot sensors
• Light sensor
• Ultrasonic sensor
• Infrared sensor
• Colour sensor
• Geomagnetic sensor
Light sensor
This is a light dependent resistor
that is also called LDR. Its resistance
in any instance is a function of the
amount of light it is exposed to. The
more the light the less its resistance.
As light intensity decreases its
resistance increases. In other words
its resistance is inversely
proportional to exposed light.
Light sensor control block
For getting a digital representation of
light intensity on the light sensor of
the robot. The value can be between
0 to 4095. it can be used to make the
robot act with respect to light
intensity. This block can be used as
data source for a math block to build
controlled response to light.
Practical classwork
• Make the robot drive in light and stop in the dark
Lesson 10
Ultrasonic range finder/sonar
Ultrasonic sensor
Ultrasonic sensor, also known as
sonar, is a sensor with a sound
transmitter and receiver. The
sound produced is beyond the
frequency audible to humans. The
time the sound took to travel out
of the transmitter and return to
the receiver is used to calculate
the distance between the sensor
and obstacles before it.
Ultrasonic sensor control blocks
For setting the distance below which object is
seen as obstacle. The maximum distance is
51.2cm.
For turning the right-front, left-front and front
sonar sensor.
For testing if a barrier has been detected. It
barrier is detected it will return true else false is
returned.
For obtaining the barrier distance in cm.
Example:
Practical classwork
• Make the robot drive avoiding front obstacles
• Make the robot drive avoiding front or right obstacles
• Make the robot drive avoiding front, right or left obstacles
Lesson 11
Infrared sensor
Infrared sensor
For black line tracking of the robot.
There are 6 sensors and each return
true when black is detected and false
when not. With this sensor the robot
can be made to move along a black
track. It has both infrared transmitter
and receiver on each sensor block.
Line tracking with
infrared sensors
6 5 4 3 2 1
Straight
line
6 5 4 3 2 1
Turning right
line
6 5 4 3 2 1
Turning left
Infrared sensor control blocks
For obtaining the data of the sensor. This provides you with the numeric
value of the infrared sensed by the sensor.
For setting the tracking offset of
the infrared sensor. To ensure that
the mobile platform keeps running
For getting the offset value along the black line, you need to
set the 6 infrared sensors offsets to
symmetric data centred at 0, for
example: -30, -20, -10, 10, 20, 30.
the polarity of your setting will
determine clockwise and
anticlockwise line tracking.
For getting the infrared offset
For obtaining the offset value, offset after PID processing, to
be used to adjust the wheel motor speed.
For setting the line follower
proportional, integral and derivate
KP: Scale factor. Value range: 0.5-5 value. With this the robot can
KI: Integration factor. Value range: 0.05 -0.5 generate offset needed to make
KD: Differential factor necessary adjustment to make
automatic black line tracking.
Practical classwork
• Detecting black track and stopping;
• Detecting black track and turning;
• Line tracking
Lesson 12
Colour sensor
Colour sensor
For detecting colour of a surface.
With this sensor, the RGB (Red,
Green and Blue) composition of
a surface can be measured and
the robot made to act on that.
To detect red :
IF Red colour data – green colour and Red colour data – blue colour > Desired
difference
To detect green :
IF green colour data – red colour and green colour data – blue colour > Desired
difference
IF blue colour data – red colour and blue colour data – green colour > Desired
difference
Colour sensor control blocks
Turn right of left colour sensor ON/OFF.
For setting the with colour balance so that the
colour interpretation of the sensor can be
accurate.
For detecting if Red/Green/Blue is
present in a colour.
For obtaining the digital representation
of the amount of Red/Green/Blue
present in a colour.
Colour sensor white balancing
If the white balance block is used in a code, it is important that
the robot is on a white surface when the command is
executed. This will improve the colour detection accuracy of
the colour sensors.
Practical classwork
• Use photoshop or Coreldraw to check the RGB Colour mixture of:
• Orange
• Lemon green
• Blue
• Broun
• Detect Blue colour and stop
• Detect lemon green and blink once
• Detect orange and blink twice
Lesson 13
Geomagnetic sensor
Geomagnetic sensor
This is a chip on the motherboard of the robot that has the
ability to interact with the earth magnetic field and return the
angle of direction of the object in it. The angle is between 0 and
360 degrees. With this sensor, the robot can be made to move
with respect to earth true magnetic field as defined by North,
East, West and South.
Makes the robot move with
compass sense.
Geomagnetic sensor blocks
For the calibration of the geomagnetic sensor.
Calibration method: Press down the left-most key after starting
up, make AI-Starter rotate 360°around axes X, Y, Z respectively,
and then press down the left-most key to finish calibration
This command should come immediately after key-init
command.
For obtaining the geomagnetic angle
direction of the robot. Value range: 0-
360 degrees.
Note: any object close with strong magnetic field (speakers for example) could affect the
accuracy of the sensor.
Practical classwork
• Make robot turn to true 90 degrees;
• Make robot turn to true 180 degrees;
• Make robot turn to true 270 degrees;
• Make robot avoid obstacles using ultrasonic and geomagnetic sensor.
General test
Work on the following causes :
• Four obstacle course
• Eight obstacles course
• Ten obstacles course
• Obstacle causes, line tracking and colour recognition
• Ten obstacles course with line tracking at the end
• Ten obstacles course, line tracking with colour identification
Work with the following cause: