Lego Mindstorms have EV3 robots which can be modified to do assignments, one time or over and over. We utilize the software Lego Mindstorms which has in-fabricate alternatives to browse to help us in programming the robot. The line following program is one of the most common programs used on the industrial robots. This is exceptionally valuable when relegating an errand to the robot be it to get or drop a thing from one indicate other, or to watch the range with a camera appended on the highest point of the robot.


Explanation of line following algorithm:


There are several ways through which we can make the robot to follow a line; here I would prefer using the robot’s light sensor to follow the black line. In order to create a program for the robot to follow a black line, first thing we need to be clear is that, the robot doesn’t have to follow only the black line, it has to follow the border of the line. Which means, the robot follows 50% of black line and 50% of white background; this approach is known as left-hand approach. In the next step, we need to calibrate the robot’s sensors; we as humans know what is black and what is white, but for the robot we need to feed the data. In order to do this, we use touch sensor and light/color sensor to measure the amount of reflected light from the surface, then we use the touch sensor to record the reading of the reflection of light, first we place the light sensor on the black surface, press the touch sensor and record the reading and then we place it on the white surface and press the touch sensor and record the reading. Now we have the readings for both black and white colors. We need to keep in mind that light condition must be stable at all times for the robot to perform the task.


Now to program the robot, we use switch block which is set to color sensor mode to make the robot turn each side following the line in the loop. We can use motor blocks or move tank block to move our robot. Here, we use Motor blocks, so as the first step, select a loop block and then add switch block and place it inside the loop block. Then we add Sensor block in the loop which has color sensor to use measure color mode to measure the color and reflection. We configure the motor movement as 20% to avoid the robot deviating from the line.


We place the robot on the black line with the sensor half on the line and half on the surface, then run the code. The trick is, we don’t use the tank as the movement here, and we use the separate tires which allow the better movement of the robot. The robot senses the color differentiation and follows the line, wobbling while it does it, goes around ∞ times as we set the loop to infinite. We can also give our loop a time frame so that the robot patrols the area for a particular time.




Why does the robot wobble?


The robot tries to follow the border of the line, when it doesn’t sense the border, it moves to the other side. Most of the robots have only one light sensor laced on the far left/right end of the robot, the robot uses this sensor and starts moving forward, when it doesn’t sense any line, it moves from left to right, and vice versa. The robot keeps wobbling left and right on the surface in order to follow the line which wastes battery and time. One approach is that we can use two sensors both on each side of the robot to make it follow the line but it will still wobble and might not move fast.  There is one advanced approach to make the robot follow the line and move with very less wavering and move fast, this can be created using the PID (Proportional Integral Derivative) control for the robot.





Robot Virtual Worlds. Curriculums and training. Retrieved on Oct 27th 2016 from