Obstacle Avoiding Robot
Obstacle Avoiding Robot
INTRODUCTION
LEGO MINDSTORMS is a series of kits that contain the software and hardware to
create customizable and programmable robots. They include an ‘intelligent’ brick computer
that controls the system, a set of modular sensors and motors, and LEGO parts from the Technic
line to create the mechanical systems. Technic is a line of LEGO interconnecting plastic rods
and parts. Lego Mindstorms EV3 is the third generation robotics kit in Lego’s MINDSTORMS
robotic line.
There are two sets of kits under the EV3 edition namely, the home set and the education
set.
An expansion set for the Educational Core Set, which can be bought separately contains
853 Lego elements.
ROBOTS MADE USING EV3 KIT
The Lego MINDSTORMS EV3 kit has inbuilt instructions to build 5 models namely
SPIK3R: It is a complex robot that crawls and turns to search for targets. It can attack with
its claws and shoot with its tail.
TRACK3R: It is an easy to create and command robot and has a lot of tools like Bi-blade
Blender, Gripping Claw and Heavy Hammer.
EV3RSTORM: It moves around on tracked skates and can attack with his Spinning Tri-
blade or Blasting Bazooka. It can detect objects, follow the Infrared Beacon and receive
commands remotely.
R3PTAR: It is a tall, long and powerful robot which moves like a snake and can strike
with its Fearsome Fangs when it detects an object.
GRIPP3R: It is a strong robot that can lift and carry heavy things with its Grasping
Grippers and can be controlled remotely to pick the desired objects.
EV3 BRICK
The ‘intelligent’ brick forms the brain of the robot. It interprets signals from the various
sensors and operates the robot based on the written program. The Lego Mindstorms’
programming is command box programming. Fig. 2 shows the intelligent brick used in EV3
kit.
SENSORS USED
The sensors act as input devices for the robot. The various sensors available in the EV3
kit are
1. TOUCH SENSOR: It checks the condition of the touch sensor block at a specific point in
the program. If the sensor has been triggered, it sends out the logic signal ‘TRUE’ and if it
is not triggered, it sends the signal ‘FALSE”.
2. COLOUR SENSOR: It can detect the colour or intensity of light that falls on the sensor.
It can distinguish 7 colours and can be used to follow a specific colour path or detect the
room light intensity.
3. GYROSCOPIC SENSOR: It detects rotational motion of the robot. It detects two data
namely, the rotational angle and rate. The Gyro sensor can detect motion only about a single
axis of rotation which is indicated on the sensor by means of arrows.
4. ULTRASONIC SENSOR: This sensor is used to measure the distance of an object in
front of it by employing ultrasonic waves. High frequency sound waves are sent out by the
sensor and the time taken for the sound to reflect back to the sensor is measured.
5. INFRARED SENSOR: It can detect Infrared light signals that are sent from the Remote
Infrared Beacon and can also send its own infrared light signal and detect the reflection of
this light by other objects and sense the distance between the sensor and the object.
Fig. 3.1 to 3.5 show the various sensors used in Lego Mindstorms EV3 kit.
PROGRAMMING
The programming language used in Lego Mindstorms EV3 is an icon-based drag-and-
drop programming language. Programs are created by dragging the programming blocks from
the program palette onto the program canvas.
ACTION BLOCKS
The action block is used to command the robot to perform some work. It includes the
following blocks to control the motors and output signals
MOTOR CONTROL
The programming of small and large motors is similar as they both have the same
options. Fig. 5.1 and Fig. 5.2 show the program block of a small motor.
OPTIONS: the options include the input for the motor which are
OFF: to switch off the motor
ON: to run the motor continuously until it is stopped
ON FOR SECONDS: to run the motor for the required number of seconds
ON FOR DEGREES: to run the motor for the desired amount of rotation
ON FOR ROTATIONS: to run the motor for the required number of rotations
POWER: It is used to select the percentage of power required to be given to the motor
INPUT DURATION: It is used to mention for how long the motor is to be powered. The
input duration is given in number of rotations, number of seconds or degrees.
STOP: It contains two options namely brake and stop which describes how the motor
should stop after completing its work.
PORT: It is used to mention the port to which the motor is connected to. The signals or
instructions are given to the motor from the programming brick via that port.
Fig. 5.3: Program block of large motor
Fig. 5.3 shows the program block of a large motor which is similar to that of a small
motor and contains the same options.
Fig. 5.4 shows the program block of steering through which both the motors are
simultaneously controlled by the brick to provide the specified direction.
Fig. 5.5 shows the program block of a move tank through which two large are controlled
simultaneously by manually providing the amount of power input for the individual motors.
WAIT
This block makes the program to wait for an input before continuing to the next block
in the sequence. The wait can be for a certain amount of time, for a sensor to reach a certain
value or for a sensor value to change.
NOTE: The Wait block does not make the robot stop. If any motors are on at the beginning of
the block, they will stay on during the wait.
Fig. 5.7: Program block for wait
LOOP
The loop block is a container that can hold a sequence of programming blocks. The
block will make the sequence of blocks inside it repeat. The blocks can be made to repeat
forever, a certain number of times or until a sensor test or other condition is true.
In the Fig. 5.9, the loop condition is to repeat the loop 5 times. The program blocks
inside the loop are wait block which makes the robot to wait for 2 seconds before making one
rotation forward and stops before the commencement of the next cycle. After 5 rotations, the
program exits the loop and the robot makes a right turn for 2 rotations.
SWITCH
The switch block is a container that can contain two or more sequences of programming
blocks. Each sequence is called a Case. A test at the beginning of the switch determines which
case will run. Only one case will run each time the switch is executed.
LOOP INTERRUPT
The loop interrupt block makes a loop block end. No more blocks in the loop sequence
will be executed and the program will continue with the blocks that are after the loop. The loop
to be interrupted is specified in the loop interrupt block by using the loop name. The loop
interrupt block is used to make a loop exit sooner than it normally would or in response to
different condition.
The loop can be interrupted from inside the loop itself or from another block sequence
that is running simultaneously.
In the Fig. 5.11, the loop 01 is programmed to run 5 times. Simultaneously, a second
running sequence waits for a colour sensor to detect red colour and uses the loop interrupt block
to stop the loop early if red colour is detected.
PROGRAM
PROGRAM