Main »

Project: Build Cool Computers!


edit SideBar

This semester we are planning to have some optional design projects to give you a hand on things that are not only in books, creating "smart devices". During this project, you will learn how to integrate mechanical and electrical systems, in order to create "smart devices" that interact with the world around us. The TAs are Karu are available for consultancy and feedback through this entire project. Ask for help if you need it!


  1. You are provided 5 different topics that you can choose one to do in groups of four or five people.
  2. For the project you may combine with people who are NOT your project partner.
  3. Both people in a HW team need NOT necessarily take on the project.
  4. I would like to restrict members to all be in the same section.

All hardware will be purchased and paid for by instructor.

All emails regarding the project must include the instructor and all TAs. None of us will respond to any individually addressed email.

It is just impossible for the 6 of us to coordinate on who should respond if you send an email to just one. By CCing all you help us all help you better. Here are the addresses.,,,,,

1.  Grading

This is completely bonus points. A total of 5 points added to your final score out of 100.

2.  Logistics, Deadlines etc.

You are welcome to drop out at any stage without any negative impact on your grade. You must have some kind of working demo in the end to qualify for any bonus points :)

2.1  Choose Project: March 16th

You must decide which project you are interested in doing and email the instructor and all 5 TAs.

2.2  Project proposal: March 21st

This proposal must include the 3 sections listed below and be no more than 2 printed pages. Email PDF to instructor and all TAs.

  1. Team name
  2. List of people in project team, email address of all team members
  3. Describe in your own words the project.
  4. List of hardware components you need
  5. Detailed milestones with at least 5 intermediate steps and a final deadline of May 14th
  6. On a separate page (not counted towards your 2 page limit) include this info for each team member:
    • previous programming experience (if none, say none)
    • status: freshman, sophomore, junior, senior
    • what CS or ECE courses you have taken so far
    • if you have declared a major what is it.

2.3  Progress report 1: March 30th; due 5pm

  • Email me (CC all TAs) a plain text file describing what progress you have made. If all you have done is collected hardware just say that. For teams that got a poor proposal score, I highly recommend that by this state you should have a revised set of detailed milestones - include that in your progress report email. Say CS/ECE 252 project progress report 1. Only one team member must send the email.

2.4  Progress report 2: April 13th; due 5pm

2.5  Progress report 3: April 27th; due 5pm

This progress report must include the list of names of students who are still in the team and contributing to the project. It should have a separate section listing the names of students (with email address) who have dropped out of the project.

2.6  Progress report 4: May 4th; due 5pm

2.7  Final demo: May 14th

Demo will be in the CS Lobby area. The demo is from 4pm to 5pm. Please report by 3:50pm and make sure you are set up by 4pm.

Details on what will happen at demo is pretty simple - I will show up and you should demo your project. You should have your source code on your laptop. Some other CS faculty may show up also and ask to see your demo, source code etc. If your demo works, you will get the 5 bonus points.

Instructions for each project:

  • Twitter: We will have a couple of tables and the router in 1325CS will be moved outside. You should be able to demo your twitter display and any other extensions you built
  • Angry birds: You should set up your target and be able to hit it. Setting up on the floor would be best.
  • Tic-tac-toe: You don't need much set up. You should be prepared to demo the single-player and two-player wireless version. Before-hand, check the range of wireless and how far apart the players can be.
  • Maze: I will have one or two mazes out on the floor. Your bots should be able to navigate them. I plan to use complex-0 and complex-4 from the mazes provided. Please confirm before-hand i.e. by Friday that your bots work on the carpet and can track without problems.
  • Obstacle avoidance: We will set up some of the furniture to create obstacles. If you want to bring your own props to show off your obstacle avoidance you are welcome :-)
  • All: make sure you have enough battery power.
  • You should have a laptop handy to show the source code and be able to explain what all design and coding you had to do

Instructions for submitting source code

Email me the source code. You should email the .ino which includes the source code. One email per project team.

Returning hardware

Please be prepared to return all your hardware to me at the end of the demo. Email me if you want to hang on to it for any reason. You can return it in its assembled form. Any hardware that I gave and you did not use, bring with you.

2.8  Final report and Project survey: May 14th

This is primarily for my benefit, so I can fine tune this project component for future semesters.

  1. You should write a short project report with the following sections and I am expecting a 1 or 2 page document.Use this word document template.. One report per team.
  2. Please fill in this survey by May 14th. Survey.
    You can fill it anonymously or with your name. One survey per person i.e. each person in a project team must individually submit this. I plan to read all of them in detail - so please use this opportunity to help me improve this course :-)

3.  Background Information: Read this FIRST!

  • What is an Arduino?
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
  • How to Start?
    1. Get to know a little bit about the Arduino microcontroller. The Arduino webpage has a getting started section. You can search on YouTube for a number of how-to videos and cool projects built using the Arduino.
    2. Look at the projects below.
    3. Form a team.
    4. Come talk to the TAs to talk more about these projects/the arduino/other projects you might be interested in.

4.  List of Projects

4.1  Maze Navigating Robot


Maze navigating robot is a type of robot that can navigate itself in a maze and finally can get out of the maze. The robot enters a maze from its entrance, then exits the maze after navigating for some time either via exit of the maze if there is exit, or via the entrance if the entrance is the only opening of the maze. Mazes can be categorized into several branches among others:
  1. simply connected maze without any branch, in other words, there is only one path (correct path) in the maze that leads to exit; (assume path has width of 1)
  2. simply connected maze with branches, or we can say, there exists an optimal path leading to exit, but that is not the only solution; (assume path has width of 1)
  3. Open maze that is simply connected which has varies path widths which are greater than 1. You can think of it as a maze that has large open space in which robot can freely move.
  4. A maze that is not simply connected, in other words, the maze has one or more mazes inside all of which do not connect with each other. You can think of it as if the largest maze has many small "islands" in it, the entrance of the maze is in one "island" whereas the exit of the maze is in another "island".
In this project, you will design a robot that traverses a maze with all the 4 cases above. It is recommended to build it step by step. This project can be implemented based on line following robot.
Line following robot is a type of robot that basically follows an arbitrarily drawn path. There are different types of such robots in terms of the complexities of the paths they can follow. The paths might be straight lines with sharp turns, or they might be simple curvy, closed loops or there might be a path with lots of branches. Line following robot is a great starting project for anyone who dreams of making robots. Each year, many line following-robot competitions are being held around the world that students like you take part in and their robots compete with each other in terms of their speed and how fast they can handle the complexities of paths.
In this project you will design a robot that follows an arbitrarily drawn black path in a bright background. You will develop a full-functional line-tracking robot that can handle any path complexity.

How to do it

Your robot should be able to follow a dark line on a bright background. Your design utilizes a set of infrared (IR) diodes and sensors placed on the bottom of the robot that positioned roughly orthogonal to the line on the ground. Infrared sensors placed at various locations will pick up the reflected signal and activate the motor that controls the front wheel to keep it aligned with the path. An electric motor will power the robot forward at a pace that will keep the robot on track with the line.


  1. In the first phase you design a robot that can follow a simple arbitrary path of straight lines with 90 degree turns. Your robot should be able to detect the end of the paths and stop. The end of the path is represented by a T marker.
  2. In the second phase you have to change your robot design in a way that it can follow a simple path of straight lines with turns of arbitrary angles. Your robot should be able to detect the end of the paths and stop.
  3. In the third phase you have to change your code in a way that your robot can follow any simple curvy path. Your robot should be able to detect the end of the path and stop.
  4. In the last phase, the paths are not any more simple. Some loops and branches would be added to the paths and your robot have to decide on any junction which path to take and remember the paths taken that in case of a loop it does not circle forever in a loop.

What you need

  • What is an IR diode?
An IR diode shines on the surface of the road. The IR diode needs to be strong enough to generate a readable signal for the IR sensors to the left and right of the diode to detect.
  • What is an IR sensor?
An IR sensor receives reflected light from the arbitrarily drawn strip on the ground and generates voltage. The sensors can be analog or digital. For example, if you are using analog sensors and providing 5V to the sensors at Vcc, and you encounter a dark surface, that sensor will output a a voltage close to 5V. Conversely, if the sensor encounters a very reflective (bright) surface it will output close to 0V.
  • What is a motor?
An electric motor will power the robot forward at a pace that will keep the robot on track with the line. Motors come in many different types, shapes, and sizes. Most of the motors used in motion control can be divided into two categories: stepper motors and servo motor. The former is cheaper than he latter but the movements looks smoother when controlled by servomotor. For this project you are provided a 2 wheel drive robot assembly. As you can see, the 2 wheels are attached to dc motors. You can control (individually) the speed and direction of these motors.
  • Where to start?
There are many books and online sources on how to build a line following robot. For getting an idea on how to begin your project, you can start by looking over the following links:
Once you made a line following robot, you are half way done in making a maze navigating robot.

4.2  Obstacle Avoiding Robot


An obstacle-avoiding robot is a type of robot that uses active range sensors such as ultrasonic sensors, laser range finders and infra-red sensors to detect how far away an object is to avoid it. The mechanisms it uses to avoid obstacles is widely used in vacuum cleaning robots, soccer-playing robots and some types of maze-navigating robots.
In this project you will design a robot that moves straight until it detects there is an obstacle close to it, then according

How to do it

To perform obstacle avoidance, a robot needs to know the distances to the objects around it. The most common method of extracting depth information is to use the ultrasonic sensors . Your design utilizes a set of ultrasonic sensors that positioned roughly around the robot that act like the "eyes" for it. You need to poll on the value returned by the ultrasonic sensors periodically. When it hits a certain threshold indicating that it is close to an object, then change the direction of the robot, then check the value of the ultrasonic sensor again to see if it is still near an object. Keep in mind that obstacles are not necessarily stationary, so the robot needs to periodically check its distance with the objects around it. You will develop your obstacle avoiding robot in two phases:


  1. In the first phase, you will design a robot that can move in a space with stationary obstacles.
  2. In the next phase, you will change your code to detect mobile obstacles, calculate their distances and speeds and decide accordingly when and how much changes its direction .

What you need

  • What is an ultrasonic sensor?
An ultrasonic sensor works by transmitting an ultrasonic (above human hearing range) burst, burst travels through the air, hits an object and then bounces back to the sensors. By measuring the echo pulse width the distance to target can easily be calculated.
  • What is a motor?
An electric motor will power the robot forward. Motors come in many different types, shapes, and sizes. Most of the motors used in motion control can be divided into two categories: stepper motors and servo motor. The former is cheaper than he latter but the movements looks smoother when controlled by servomotor. For this project you are provided a 2 wheel drive robot assembly. As you can see, the 2 wheels are attached to dc motors. You can control (individually) the speed and direction of these motors.
  • Where to start?
There are many online sources on how to build an obstacle-avoiding robot that you can get the idea from on how to start your project:

4.3  Tic-Tac-Toe


In this project you will be creating your own handheld game console. You get to design the game, the input and output interface (we will get you a touch screen LCD). Whats more? you get to add a wireless module and a multi-player mode over two devices.

How to do it

Ideally this will be a 3 team project. The following task separation is just a suggestion, your team will be working very closely with the other two teams.
Team 1 : Game Designers
Designing the game : Choose your game, draw out your screens. You will write the brain behind the game. Using interfaces team 2 will create for you, you will “draw” your game screens on the LCD, and process inputs from the touchscreen.
Team 2 : User interface Designers
All about the user interface : You will do two things : 1) “Draw” on the screen 2) Convert inputs coming from the touch screen into a format team 1 understands.
Team 3 : Wireless Designers
Wireless team : You get to decide and design how the two devices talk : the language.


Team 1 : Game Designers
  1. First think of the game. You should decide and draw what happens at each phase. example : when the device is switched on the user sees a screen with 2 buttons : 1-player and 2-player. When the “1-player” button is touched it takes you to a screen with 9 cubes. etc.,
  2. For the single player mode write code that will be the computer’s brain.
  3. Find who won.
Team 2 : User Interface Designers
  1. Understand how the touch screen works : By the end of phase 1 a user should be able to draw a line on the touch screen.
  2. Pick up the design from the game designers and draw it on the screen. Also divide the screen into 9 squares : when the user touches a square send that square’s number to team 1’s code. Come talk to us about what API’s are.
  3. Add color and make the game more fun.
Team 3 : Wireless Designers
  1. Connect two boards to two wireless modules. Test sending 1 byte of data from one board to the other and back.
  2. You will be enabling the two modules to talk to each other. ie., you will define the language and the grammar. Ask team 1 what information they would like to send to the other board decide how you would send that.

What you need

  • 2 Arduino Boards
  • 2 Touchscreens
  • 2 Wireless modules
  • nrf24l01 : 2.4GHz wireless module.

Where to start

4.4  Twitter Display


Let’s make a door display for Karu. A 2 line LCD (or a much cooler graphical color LCD) powered by an arduino connected that will read and display messages off his twitter feed.

How to do it

Arduino comes with a good range of “shields” : hardware modules that you can mount on top of the arduino for added functionality. The ethernet shield lets you connect the arduino to the internet. Once connected, you can use twitter’s API’s to read and write to feeds.


  1. Get the ethernet shield working : Connect the shield to the ethernet port, run a few codes from the examples, get acquainted with the environment. You will learn a little bit about how the internet works, whats HTTP and what happens when you type “” in your browser.
  2. Write code to read from a twitter feed and display it on the serial port.
  3. Interface the LCD. Write code to display messages on the LCD
  4. Add more features : example : Parse Karu’s calendar and update “252 class : 9:30 AM-1 PM” automatically.

What you need

4.5  Physical Angry Birds


In this project - you will use a sensor to determine how far the target is, and hurl an angry bird at it.

How to do it

To implement the angry bird, you need ultrasound sensors to detect the distance from the target and then use the aurdoino microcontroller to calculate the velocity at which you need to throw the angry bird at the target. This information has to be fed in terms of voltage to a servo motor which has a spoon-like rod connected to its shaft that holds the angry bird. When you rotate the motor with a controlled speed, it shoots the angry bird to the target.


  1. Physics first : Figure out a system (on paper) that will work. We will be using a servo motor, you can vary the speed at which it turns. Think how your mechanical system would work.
  2. Connect the ultrasonic sensor to the Arduino. Calibrate it (ie., the ultrasonic sensor will give you values between 0 and 255 : map that to 0 feet to 6 feet).
  3. Control the servo motor. We plan to give you a motor shield and a servo motor. Make your mechanical system (it may be as simple as a spoon tied to the motor).
  4. Experiment. Hurl the bird at various speeds and see how far it lands (you can use your ultrasonic sensor to find the distance). Once you have these values, you know what speed to throw at to reach the distance.
  5. Play!

What you need

  1. A servo motor
  2. A motor shield (the motor takes too much current that'd burn the Arduino if connected directly). The shield basically acts as a driver.
  3. An ultrasonic distance sensor.
  4. Angry birds stuff toys.

5.  General Tutorials on Arduino

5.1  Tutorial 0 : Installing the software and getting the blink demo to work

  1. Get familiar with the website/environment.
  2. Download the software. You can run the software from most computers with an USB port. I recommend downloading the latest version : Arduino 1.0.
  3. Open the Arduino software : Do you remember what the top 2 buttons are?
  4. Hook up the board to your computer. You will have a USB connector, plug the ends into the USB port on the Arduino and your computer. You should see a few LEDs (lights) on the board blinking.
  5. Examples page has a tutorials on basic functions. We looked at the Blink example in class. Its now your turn to get this working.
  6. Click on File > Examples > 1.Basics > Blink. You will see a new window with the Blink "sketch" (Arduino guys call the code sketch). Does this look familiar? What do the functions setup and loop do?
  7. Click on the first icon on the top to compile this code. Internally, the compiler converts the sketch into machine language that the AtMega processor (the chip that you see on the board) understands. You should see "Done Compiling" at the bottom of the window. This area reports errors/warnings : You should always check this before downloading code.
  8. Click on the second icon : This is going to upload the code from your computer through the USB cable to the Arduino's computer. Again check for errors. Tip : Your computer might confuse which port the Arduino is connected to. You can specify the port by clicking on Tools > Serial Port > <your port>. If it is difficult to tell your port correctly, try each one :)
  9. Check that the LED on board (an orange one) near the USB port blinks at 1 second intervals. Yay!
  10. If you feel adventurous : Get a few LEDs to "dance". Watch this video, to get to know the basics of how to wire up stuff to the Arduino. Once connected write your first sketch. In the setup() function, tell the Arduino where you have connected your LEDs (example : pinMode(12, OUTPUT); etc., ). In the setup, write your sequence of how you want the LEDs to go on and off. you can vary the delay between your lines of code.

Deliverable: set up a meeting with TAs or Karu during their office hours and show your working blink demo. Modify the existing source code to humanize :-) your led demo - it should "blink" with a random delay. Suggested completion: well April 1st.

This is NOT required but highly recommended, even if your project has nothing to do with blinking LEDs.

5.2  Tutorial 1 : Web/internet access

You will find you cannot get web/internet access from the department's ethernet ports. You'll need to go through a proxy server (, port 3128). See Section 6.4

5.3  Tutorial 2 : Getting more Digital Ports

The Arduino has 14 digital ports. If you want access to more ports you can use the 6 Analog ports in their digital mode. Analog ports are accessed by using port numbers 14-19 ie., Analog port 0 is digital port 14, Analog port 1 is digital port 15 and so on. Try if this works using the mircoswitch and the debounce example.

5.4  Tutorial 3 : Getting 2 Arduinos to talk to each other

If you are using the Touchscreen LCD, you are left with just 4 ports (A5, A6, D2 and D3). If you want more ports one option is to use another Arduino (lets call it Ard2) and run code that talks to Ard1. Follow these steps :

  1. Connect A5 to A5 and A6 to A6.
  2. Connect a Gnd Pin from each Arduino together. The Gnd pin acts as the voltage reference. When we say 5V, we mean 5V above the Gnd. For both Arduinos to communicate, they should see the same voltage levels : above the same reference. Hence we connect the grounds together.
  3. Use the Wire library. There is an example code which you should get working first.

5.5  Tutorial 4 : The black motor shield

Hints on using the DFRobot motor shield

  1. You do not need a library to control the motors : Look for the Manual in this website, it gives you details on how to run your motors.
  2. Leave the jumpers as is : You will be using PWM mode and Vin power supply.
  3. Make sure you connect the 9V adapter to the Arduino : The motor shield will steal this supply and use that to power your motors.
  4. Pin 4 and Pin 7 control the direction of the motors. You can play with the speed by analogWrite(5, speed); //PWM Speed Control

analogWrite(6, speed); //PWM Speed Control where speed is a number between 0 and 255. Read about PWM if you are interested.

6.  Project Cookbook

You will find a step-by-step guide for each project below. We have broken it up in individual components.... more detail.

6.1  Maze

1. You first need to figure out how the IR sensor works. First connect the IR sensors to the arduino board and report the values through the serial port (monitor) on the computer. Make sure it gives different values for white and black. Check this documentation.

2. The second step is to learn how to steer the motor on the straight line and how to control your speed. Concentrate on the motor-shield.

3. The third step is to learn how to turn : If you move the two motors in opposite directions you move forward/backward. If you move them in the same direction, the robot just keeps spinning around itself. Look at the tutorial on the black motor shield to get an idea.

4. Now, you know where the line is (interpret this from step 1) and how to control the robot. Try putting a black tape on the ground and see if you can follow that tape.

5. The last step is to build the "intelligence" into your robot. Figure out a way to remember the path you have taken, so that you do not re-traverse the same path over and over again. Watch this video and this tutorial on how a maze could be solved.

6. Thats it!

Example mazes

We have provided you a bunch of example mazes. These are all in PDF format. Its one large printout broken into multiple (total of 64) A4 sheets. Print single sided on a standard printer and paste sheets together. The first page is for reference on what the maze looks like printed on one page (ignore this).

To assemble the maze paste the remaining sheets together, using the following info. The sheets all have a coordinate at the bottom-left corner. Basically a (0,0) to (1,1) box is split into a total of 64 sheets. Page-1 is (0,0) to (0.125, 0.125). Page-2 is (0,0.125) (0.125,0.25) and so on...

Mazes with increasing complexity:

6.2  Obstacle avoidance

1. You first need to figure out how the ultrasonic sensor works and how to use it to measure the distance. First connect the Ultrasonic sensor package to the arduino board and try to measure your distance from an stationary obstacle. Check this video and this wikipage.

2. The second step is to learn how to steer the robot on the straight line and how to control your speed. Concentrate on the motor-shield.

3. The third step is to learn how to turn : If you move the two motors in opposite directions you move forward/backward. If you move them in the same direction, the robot just keeps spinning around itself. Check the sample code here to get an idea.

4. The forth step is to combine previous steps to calculate your distance from the obstacles around you while you are moving and steer your robot among the stationary obstacles. The

5. Now, you know how to steer your robot around when the obstacles are stationary. The last step is to build the "intelligence" into your robot, while the obstacles are moving around. Figure out what the best strategy is when different objects are moving from different directions towards you.

6. The last step is to test your robot in a field with other obstacle-avoiding robots moving around.

6.3  Tic Tac Toe


1. Get the touch screen working. Download the library and get the examples working. To install a library download and extract the files into <your arduino folder>/libraries/ The library's directory name should not have special characters and spaces. I would just name it LCDLib or TouchScreenLib. Once you do that and restart the Arduino IDE, you should see examples in file drop down menu on the top. Try a few.

2. Write your own code : Go through the examples and try to draw a box, display strings etc.,

3. Understand the touch interface. When you "read" the touchscreen, you will get 3 values : x, y locations on the screen and a pressure value. Print those values on your computer (use Serial.print() and the serial monitor), and calibrate the device (your target is to be able to map a value you read to an exact location on screen).

4. Write an API (see step 3 in Wireless). Tell the game developers what functions they can call : what the inputs and outputs are.


1. The wireless devices we will be using is the nrf24l01. Maniacbug has written a library that helps multiple modules to talk to each other. Install his rf24network and rf24 libraries and go through the helloworld_tx and helloworld_rx examples (on two different Arduinos).

2. Decide on how you want to communicate between the two consoles. Modify the message struct accordingly.

3. You should write a function, that the game programmers can call when they want to send a message to the other console. Document the function well. Send them a note on what parameters they need to pass, what values they should set. This document is called an Application Programming Interface.

Game Development

1. Draw the game "screens". What do the users see when they first switch the device on? what happens when they press "start" etc.,

2. Talk to the touch screen guys and now get these on the Arduino and touchscreen.

3. Create a 2 player - one console - no intelligence mode : split the screen into 3x3 parts, assume alternate taps are 'x' and 'o'. At the end of this step, you should be able to play the game just as you would with a pen on paper.

4. In your previous step, you should have stored the current state of the game. example : square row 1 column 2 is 'x' and row 2 column 2 is 'o'. Talk to the communication guys and tell them you want this information transfered to the other console. You should now be able to play the game over 2 consoles.

5. Add intelligence. Creating a vs-computer mode will be a good challenge. Also you could add code to detect when a player wins, provide hints etc.,

6.4  Twitter

1. Mount the ethernet shield and bring up the WebClient example. Connect the device (using an ethernet cable) to a router. With little change to the code you should display the HTML of on your computer using the Serial Monitor.

2. The computer science department does not allow direct access to the internet. Instead you go through what is called a proxy server. Changes below will help you connect through the proxy.

 IPAddress server(128,105,7,25); // Proxy server instead of google
 if (client.connect(server, 3128)) { // 3128 is the "port" 
     client.println("GET HTTP/1.0"); // A get request to the proxy server

3. Once you know how to "GET" information from websites, you can parse this information to extract content that you want in particular. Twitter gives you an API that gives you clues on how to generate machine readable content which is much simpler to decode by a program. For example is much easier to parse than!/raghuraman.
Changing the GET request in the previous step, extract the xml from a twitter feed, parse and display the latest message on your computer.

4. Now that your message is ready, lets get started with the LCD. Get it soldered (we can help you with that). Follow this LCD tutorial and get your line printed on your LCD.

5. Advanced features time!

6.5  Angry birds

1. You first need to figure out how the ultrasonic sensor works and how to use it to measure the distance. First connect the Ultrasonic sensor package to the arduino board and try to measure your distance from an stationary obstacle. Check this video and this wikipage.

2. The motor shield you have is the Arduino motor shield. It can drive 2 DC motors or 1 stepper motor. Talk to us about your physical designs and we can discuss what motors will fit your needs best.

Page last modified on May 08, 2012, visited times

Edit - History - Print - Recent Changes (All) - Search