Introduction: $25 Robot Platform for Teaching Programming

About: Maker that likes to build Arduino for STEM. Many project are used in CoderDojo mentoring. See the following github repositories: https://github.com/dmccreary/moving-rainbow https://github.com/dmccreary/cod…

I am a mentor at our local CoderDojo chapter. CoderDojo teaches kids 8-17 how to program using a mentoring system. We have noticed that many of our students LOVE motors and simple robots that move around and avoid obstacles. Our challenge is that many of the robot kits are too expensive for our students to purchase, take home and show their friends. Most other kits typically range from $100 to $300. By designing a low-cost "build and take home" kit we promote "social constructivism" where students take their robot home and to their school to show their peers. They frequently return with new friends that all want to learn to code!

After about two years of trying different designs we have a finally settled on a "open platform" design that our students can afford to purchase for under $25. We call it an "open platform" design because we have ample breadboard space for adding new components. To achieve this we used a small footprint Arduino Nano and we positioned the heavy batteries under the chassis and between the wheels for good balance and low center of gravity. We encourage all our students to start with a similar base design but at the end of this instructable we show you many variations and enhancements of that basic design.

Before you begin a few words of caution:

  1. This kit requires some minor soldering. If you don't know how to solder try to find someone who can help you solder the four motor wires and the power switch wires.
  2. The motor driver board has some small screws for tightening down the wires in the header. A 3/32" flat head screwdriver will be needed. A flat blade eyeglass screwdriver will also work.
  3. To program the $2 Arduino Nano we get from China you will require a working CH340D driver on your computer. Despite the popularity of the low cost CH340D serial USB interface chip, the Arduino IDE does not include the driver since it is not a "genuine" Arduino device. Some older computers many not work with the CH340D driver. For details search for "Arduino Nano CH340D driver" and your operating system name. If you are unsure your computer supports this driver you may have to purchase an alternate version of the Arduino Nano that has a genuine branded chip. These versions include the FTDI serial interface chip that has drivers included in the Arduino IDE. The price on the Arduino site is $22+shipping. You can see why the ones from China are preferred!

Step 1: Order Your Parts

Here is the bill of materials:

  1. 2 Wheel Robot Smart Car Chassis Kit with 4AA battery holder $11 (sample item on e-bay)
  2. Arduino Nano $3 (sample item on e-bay)
  3. 1/2 Size Solderless Breadboard $1 (sample item on e-bay)
  4. L293D Motor Controller $2 (sample item on e-bay)
  5. Mini solderless breadboard for mounting ping sensor $1 (sample to item on e-bay)
  6. Ping Sensor $1 (sample item on e-bay)
  7. M-F Dupont Connectors (6) $1 (sample item on e-bay)
  8. Power Switch $1 (sample item on e-bay)

I have a full e-Bay collection you can use here.

All prices are approximate. If you don't have a USB connector with a "USB to Mini-B port" you should also purchase one of these. (sample item on e-bay)

For my CoderDojo students I usually purchase the parts in quantity 10 and I get a bit of a discount. You may also need some additional screws, double sided tape or hot-glue to mount some of the components.

Step 2: Assemble the Chasis

When you get the chasis you need to assemble it. The first step is to peel off the protective film on the plexiglass and look for two holes about 1/2 inch apart. These are the holes you will mount your motor posts using two screws each. The kits often come with a screwdriver that you can pull the bit out and reverse for both a blade and a Phillips head.

Next, solder the red and black wires to the small copper loops on the motors. Do this BEFORE you mount the motors on the Chassis. I also put a small cable tie around the wires so they don't get pulled by the students.

After you solder the wires, then you can put the long screws through the motors to the posts and attach the nuts. Make sure the screw heads are on the outside and the nuts are on the inside. This is so the nuts don't interfere with the wheel motion.

Step 3: Mount the Motor Controller and Breadboards

Nest we mount the motor controller and switch on the chassis. I prefer put the L293D motor controller on the top with the breadboards for easy access. I put the battery pack on the bottom of the chassis and I move the trailing wheel back to the very back edge of the chassis to accommodate room for the battery pack. Be careful not to mount the batteries too far forward since the weight will cause the robot to tilt forward.

The second image show that I drilled a 1/4 inch hold in the right rear corner of the chassis. This is to put the power switch in. You will need to run the positive (red) wire from the battery to the switch, and then run a wire from the other end of the switch to the VCC of motor controller.

Step 4: Wire the Motor Controller to Motors and the Breadboard

The L293C board that I have suggested is perfect for this project. You run the battery (via a power switch) to this board and it then converts the 6 volt power from the battery down to a regulated 5 volts which is ideal for the Arduino Nano. This keeps the "dirty" noisy motor power away from the Arduino Nano.

The Motor Controller has a green "header" with a "v+" and "v-" for each motor. It also has a VCC and GND that connect to the battery.

One the other end of the motor controller there are six pins. They go to the breadboard.

Remember to have the power switch turned OFF when you are connecting to a computer via the USB port.

Step 5: Wire Main Breadboard and Ping Sensor

I like to mount the main breadboard in the back of the robot with the USB connector facing the rear. This makes it easier to plug and unplug. The two GND and VCC wires from the motor controller will go the the red a blue power rails on the right side of the breadboard. You will need a small red and black wire to connect the power to the 5V and GND pins on the Arduino. These are in rows 19 and 17 if you place the Arduino Nano at the bottom of the breadboard.

The motor drive signals will go into pins D3, D5, D6, and D9 on the Arduino that correspond to rows 21, 23, 24 and 29 on the breadboard.

The ping sensor will need three wires. One +5 volts (VCC), one ground (GND) and one data connector. I use a red wire for the power, a black wire for the GND and a yellow wire for the data. The echo and trigger pins are also jumpered together. I run the yellow data wire to Arduino pin D2 (row 20).

Note that you can use other pins for the Ping sensor, just make sure you change your code.

Connect the VCC and GND from the Ping Sensor to the red and blue columns on your main breadboard.

Step 6: Download Software and Test

The last step is to download the sample program and see if your robot works. The code is available on the CoderDojo Robot site here:

https://github.com/dmccreary/coderdojo-robots

There are two programs you can start with. The first is a simple "wheel test" program.

Motor Test Program

It drives each of the wheels (right, and left) both forward and backwards in succession for two seconds. Note that the five volts from the USB connector may not be enough to make the six volt wheels turn. To test the program you may need to unplug the USB and turn on the battery power. Note: never have the power switch on when you are connected to the USB port!

The second program is a collision avoidance program:

Collision Avoidance Program

Note that this version uses the LED strip to show how close the robot is to the wall.

Step 7: More to Explore

You now have all the components of a robot learning platform. This is just the beginning! This robot is designed to be easy to extend and enhance! Here are a few suggested items that our CoderDojo students have done:

  1. Add an LED strip to show the distance to the object in front of the robot
  2. Add mini-speaker to signal an object is in front of the robot
  3. Add multiple ping sensors (left, center and right)
  4. Add a servo to change the direction of the ping sensor
  5. Add a LCD display to show the distance and status of the motors
  6. Add an OLED face to show the robots mood
  7. Add a MP3 sound player and play robot sound effects
  8. Add a bluetooth controller and control your robot from your phone
  9. Add an infrared LED and a remote control keypad to drive the robot
  10. Program your robot with the MIT Scratch language. Programs like mBlock generate Arduino code.

See the CoderDojo source code for sample code.