#Robotics Designing and Building a Line Following Robot

David Meego - Click for blog homepageThis is my third article in a series on robot design and programming techniques. In this article I will be discussing how to design a line following robot including the positioning of the sensors.

Disclaimer: This article will use Robocup Junior Australia‘s Rescue (Line) Challenge with a Lego Mindstorms based robot as an example.

If you have not read the previous articles, please do so before continuing:

In the previous articles, we covered single and dual sensor line following programming techniques. In this article I wanted to discuss the importance of the hardware side of designing your robot. It is the combination of good hardware design and good software design that together creates a great robot.

The design of your line following robot should cover the following aspects:

Function and design

Think about the functions that the robot needs to be able to perform. For Robocup Junior Australia, depending on the division (Primary, Secondary, Open) to might need some sort of claw or lift mechanism.

Make sure that the controller buttons are accessible and that the battery can be charged and/or changed easily. Depending on your controller and programming, make sure you can read the screen if you need to.

Will the robot use wheels or tracks? If the robot is using wheels, will it be front or rear wheel drive? What will you use for the other wheel(s)? Will a small trolley wheel, caster, omni wheel (I like the ones from Rotacaster), skids, etc. work best? What will provide the best grip and be able to go over any bumps and debris on the course?


For Robocup Junior Australia, make sure the robot can fit easily through the appropriately sized gateway. The gateway limits width and height, but does not limit length. However, if a robot is too long it will have difficulties staying on the tiles while making the sharper turns.

A robot that is too large could have issues navigating around objects or making turns that are near the edge of a tile, especially if there is a raised tile next to that edge with support pillars.

Ensure all cables are short and tied down to avoid catching on the doorway or other objects.

Check the length of the wheel base to ensure that it is not exactly the same as the speed bumps. The robot will have difficulties pulling both sets of wheels up over bumps at the same time.


Make sure the chassis is robust and does not flex. No parts should wobble or be at risk of falling off.

Always make sure fixed parts have more than one point of connection to prevent movement. It is also best to keep the robot “square”. This does not mean you cannot use diagonal beams, but keep the component parts (motors, controller, sensors, etc.) on the square angles. This will help make it strong.

Keep axles short and make sure that the wheels cannot work their way loose.

Use frames and cross joined parts to make the robot strong. For example: The combination of the frame and the red beam in the image below means that the only way the motors will separate is if you break the actual plastic. There is no way to accidentally fall apart because the parts are joined at perpendicular/right angles.

Weight & Centre of Gravity

Keep the chassis as compact as possible with a low centre of gravity. If you can see through the centre of the robot then it is not as compact as possible. The low centre of gravity is import to make the robot stable and ensure it does not topple over when going over the see-saw obstacle.

Keep as much weight as possible over the drive wheels. This is really important to make sure the robot can climb up ramps or go over the see-saw without slipping.

Sensor Positions & Mounting

Based on the previous articles on programming a line following robot, it is suggested to have two sensors mounted so they are on each side of the line.

Don’t mount them too close together otherwise the robot will be continuously making adjustments even on straight lines.

Don’t mount them too far apart as this can mean that the robot fails to follow the line closely enough and on tight turns the sensors might go over other sections of the line and cause the robot to lose the line.

The sensor should be mounted about a finger’s width (approx. 15mm) above the surface of the course: Further away and the readings between black and white will have less difference between them. Closer and the sensor will start touching the speed bumps and ramps. If it is so close that it is touching, then everything will read zero.

The sensors should be mounted just in front of the robots “pivot point”. This is the point around which the robot spins when motors are powered in opposite directions at the same speed. You can find it by drawing diagonal lines from corners of powered wheels or tracks. The pivot point for wheeled and tracked robots is different as shown by the red dot in the examples below:

If the sensors are mounted too far in front of the pivot point, they will move too fast when the robot turns and can either lose the line, or on a tight hairpin turn they can end up with both sensors on the line rather than one each side of the line.

If the sensors are mounted too far behind, then the robot will already lose the line before the correction to direction can be made.

One last hint: You can mount your sensors so that they can move up and down and use skids to keep them a fixed distance from the ground. This will help with any challenge or obstacle where the ground level changes, such as speed bumps, ramps and see-saw.


Here are some conclusions and thoughts to finish with:

  • Creating the robot, both hardware and software is an iterative process. Some ideas will work for some situations and fail for others.
  • Each change to hardware might require software changes to adjust the behaviour.
  • Some software requirements might demand changes to hardware.
  • Every time a change is made … test the robot in as many scenarios as possible.
  • Only make one change at a time, so you know exactly what effect that change has.
  • Document every change in a log, so you can reverse changes if needed. The log is also required for Robocup Junior Australia and will be reviewed prior to the competition.
  • Use a modelling tool to keep a history of your robot designs. For example: Lego Digital Designer for Lego robots.

More Information

For more information on robotics and the EV3 Basic extensions to Microsoft Small Basic, check out the following links:

In the next article, we will discuss how to get full RGB readings from your EV3 Colour sensors.


This article was originally posted on http://www.winthropdc.com/blog.

Please post feedback or comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.