Next project
Outreach Initiatives and Community Awareness

All On It's Own! Make Robot That Follows a Coloured Line Without Help

Video Demonstration

After completing this project, your car will operate on its own:


The manual can be used to inexpensively add features to a functioning toy car, which will:

  1. Add additional sensor circuitry to the front of the car.
  2. Add motor control circuitry to the torque wheels – the pair of wheels behind the car – and direction wheels – the pair of wheels at the front of the car.
  3. Add an arduino board connected with pre-exhisting circuitry on the car.
  4. Deactivate any RF or Wireless features – or just not use it.

Arduino eases the creation of fast and easy embedded development. Use the Arduino IDE' s C-like Processing language to write commands that will control objects connected to the arduino via the Analog or Digital terminals. It is open source and common to all computing architectures that use it. Each Arduino differ in the apps, for instance, to browse the web, do accounting, draw images, have compilers for programming languages – nevertheless, the kernel is the same. Microcontrollers are the industry industry standard for embedded systems, however necessitate knowledge of circuit analysis, digital systems, signals and systems. This makes them ideal for an institutional setting, over that of an outreach.

Unlike the Raspberry Pi, an Arduino Uno can accept analog inputs and process them to give analog or digital outputs. This is remarkably useful to make decisions about controlling the motor of the vehicle and make the steering wheels turn left or right.

Most introduction to engineering students will learn from this hands-on DIY about:

  • Sensor network basics
  • Algorithm design basics
  • Flow charting
  • Writing programmed code
  • Circuit schematics


This project explored to use an Arduino, please view it in Figure 1, which is available, but not limited, at components.

Fastech Arudino

And, a Light Dependent analog Resistor, see Figure 2, which is available, but not limited, at

Photo Resistor

Figure 1 An Arduino Uno micro-controller prototyping board with labelled terminals and i/o.It costs only $9 dollars.

The three terminals of the D18B20 – power, data, ground – are soldered carefully with Arduino's GPIO 3v3 pin, GPIO4, connect to GPIO ground pin. See Figure 3 to see Figure 4 to locate these pins.

The program for this lab at is in Python. Once is is called, it will probe the GPIO data pin at a given rate. This sampling is conrolled by the user in the programs source code. See Figure 5 to take a glimpse at the great ease with which the student can manipulate the sampling, for instance from once every hour to once every 1/1 000 0000 th of a second.


The student must check through all of the following materials. Missing components can be ordered from the websites, i.e.,,,,,, and other website that gives you an inexpensive deal on your component/parts list. The student needs:

Laptop or any computer with Linux Ubuntu - this could be installed alongside with Mac or Windows.

4 wheeled toy car that can move and turn

1 Arduino

1 Micro USB, cable that connects to the computer to power Arduino's

1 Light Dependent Resistor Digital temperature sensor

Breadboard (not bread! It has many perforations) Please see Figure 6.

Jumper wires

Figure 2 Light Dependent Resistors (LDRs) varry in resistance. The decrease in resistance is directly proportional to light intensity.

  1. Solder station with solder iron, solder, flux in your lab's station.

  2. Tape, multimeter, measuring tape, cutting tools in lab's station.


Before beginning read all the steps hereforth. Take some time to visualize the path the workflow below takes toward making the final Tempometer, start each step until the end. Pay close attention to the figures and diagrams.

FIGURE 3 Front view of the sensor module, consisting of LED emittors and photocells or photoresistors.

Step 1: Prepare Arduino

Switch off your laptop. Take out your Arduino's and put it inside your laptop's or computer's memory card reader or USB card reader.

Now, power your Arduino by plugging in the Micro USB to the, while connecting the other end to the computer's USB.

You will see Linux as you boot on your screen. Once it asks you to login, type in default authentication credentials

Step 2: Connect the LDRs

Solder carefully – do not mismatch the terminal connections – the power terminal of the Light Dependent Resistor temperature sensor to the 3V3 Pin in the Pi, the data terminal to the GPIO 4th pin of Arduino, the ground terminal to any of the GPIO ground pins of the Pi – does not matter which ground you choose.

Step 3: Check the car

Before writing yourself or using pre-written program to read direction check if your Light Dependent Resistor is working.

To do so, first navigate to the system directory where Light Dependent Resistor

has a file allocated to.

You should see two lines of text, after you have completed the commands. The first line shows temperature reading 1 second or so ago.

Step 4: Python program that makes wheels move

FIGURE 4 Battery pack powering the line following car's onboard micro-controller and motion sensor modules.

All is well! Now implement the pre-written temperature reading script written Python.

Change the variables, intv and endWhen to your custom sampling rate and end time. However, you can end the temperature logging process anytime by pressing Cntrl + C while the program is being executed.

Once the program ends after the designated end-time or your Cntrl + C signal to stop it, the program automatically saves a text file in the same folder as where you placed your

This text file has all the temperature readings. Each new line corresponds to the reading at that sample.

What You Program

Pre-made code for you are in source-code folder.

To accelerate a beginner to programming, the choice of language to do all controls and data logging on the Arduino is Python - a easy to use language where user doesn't have to control the internals of the program, like name spaces, memory allocation, data types, etc. All major Linux distributions come with the

Python Compiler pre-installed with it, making it easier to avoid the search for IDE's or rote step-by-step compiler downloads for Python.

Python is extremely powerful as a prototyping language. It is undesirable for high performance applications or extremely large software, such as an Operating System.

Figure 5 Top view of the car with mounted Arduino, rear and frontal wheel motors.

After you have completed your own data collection, you have the option to view our own test data called temperature-data.txt in the folder you downloaded from

Figure 6 You do not have to make the wirless transceiver circuitry. It will come with the RC (Radio Controlled) toy car you will be using in this lab. Your toy car's Radio transceiver may look different.

Imperative Areas in Need of Improvement

This lab ensures that an existing toy car with or without RC is converted into a line following car. The obvious limitations of this car is the elementary algorithm used to control the car through the arduino. The current limitation are the following:

  1. Car follows straight line.

  2. Turns at angled corners accurately.

  3. Turns at curved corners with very low accuracy.

  4. Stops when both sensors are out of path.

Next improvements would address the above limitations by having:

  1. The car turn at smooth angles.

  2. Let the car retrace back to the coloured line once both sensors are off the track and on ground.

  3. Increase the speed of the vehicle while it satisfies the above two expectations.

FIGURE 7 Screen shot of program controlling the Arduino Micro-controller, which directs the motion of car according to sensor readings.

Further Readings

To have a deepened knowledge in Linear Robotics, you should first gain a "knowledge scaffold and learning directions" of powerful math, science, computer technologies and engineering. Learn more as a student or teacher from free schools:

Once you feel confident, please Search with keywords "Linear Control Systems", "Robot Made with Junk Materials", "Robotics Cookbook" at UOIT Library or Open Textbooks and Open Encyclopediae:

Other Projects
Professional Circuit Drafting
Professional Circuit Drafting CAD drawing gives you professional grade circuit schematics and prototype models. Learn to communicate design of electronics and hardware innovation like the professional engineer. Continue >>
Knock to Ring Bell
Knock to Ring Bell Make a complete musical bell system that rings with your knock. Possibly, this may reduce door banging or frustration at dormitory doors that aren't allowed to have buttoned door bells, yikes! Continue >>
Raspberry Pi Tweet to my Door Raspberry Pi Tweet to my Door Raspberry Pi connected to colour display wirelessly. Show your twitter updates on a screen attached to your door at school's club office, classroom, treehouse room. Display to your audience your... Continue >>
Optical Network Made Easy
Optical Network Made Easy Optical communication is fast, cheap, and reliable. Build your own prototype of a peer-to-peer network using laser. Understand how big Rogers, Bell and use Fibre to connect you in lightning speed to... Continue >>
Pedometer for Athletes
Pedometer for Athletes Supercharge your shoe! Use it to find issues in your run during basketball, track or soccer. Or, track the distance and stats of your jog. Help keep others keep their walk at constant pace, such as... Continue >>
Broadcast Your Radio
Broadcast Your Radio Broadcast your music and voice wirelessly. Spread your news with your friends over short distance using radio. It is easy to make, free, and won't get CRT angry at you. Radio podcasts, chatroom uses... Continue >>
Networked Thermometer
Networked Thermometer Thermometers are old. They are useful: superb tool to control experiments in science labs, monitor body heat, get weather data, save devices from overheating as your flat screen tv, and car engines. Continue >>
Internet Controlled Lights
Internet Controlled Lights Use internet to make lighting during Christmas or other occasions dance! Surprise your buddies with LED sequence control. Make decoration energetic during your sweet holidays. Continue >>
Arduino Tweets to my Door Arduino Tweets to my Door Arduino connected through wire to display. Show your twitter updates on a screen attached to your door at school's club office, classroom, treehouse room. Display to your audience your location at the... Continue >>
Arduino Lilypad Remote Mouse
Arduino Lilypad Remote Mouse Control your computer's mouse with this homemade remote-control. Build touch switches completely in software and then link the remote to the computer via infrared. Continue >>
Gesture Pong Game
Gesture Pong Game Build your own motion tracked game and console similar to Kinect or Wii. Inside is code and design helping you make the classic Pong Game. Play the game as you move on your tv or monitor. See step by... Continue >>
Paper Music Player Tutorial
Paper Music Player Tutorial Play music from paper as if the paper was an "ipod". You build a system that senses capacitive touch on pencil shaded shapes on paper. With these touches music is controlled. Continue >>

Maintained by Qusay H. Mahmoud
Content Contributors: Rudy Lang, Michael Lescisin, Rahma Mahmood, Ahmad Shamshiri, Ahmad Touseef, Mirna Zohiry