Tutorial for an Arduino RC Car?

A buddy of mine recently sent me a tweet:

RC Arduino Tweet

This is an interesting question the short answer I have is, “No.” The longer answer is a bit more nuanced, so I asked for a little clarification. This is what I got back:

RC Arduino 2

Now I had a lot more to go on. With this in mind I have something to sink my teeth into. Now we have something, so now my response is, “No, I haven’t seen anything that would fit.”

OK, now that that’s out of the way lets cover how I would tackle this problem. Tony is an awesome math teacher in Zeeland, Michigan. He co-teaches a project based math/physics class. I’m going to work from the assumption that he’s working with students starting with little previous knowledge of electronics and Arduino programming, and that he’d like to leave as much room as possible for students to explore. Everything I cover will be with that in mind.

With a project like this you need break it up into pieces. I’m going to think of this as a robot even though it won’t be autonomous because we still will have a computer controlling an independently moving device. As with any robot type project you have three fundamental challenges, the programming, the electronics, and the mechanics. However, with this project we’ll need to consider a forth part I don’t usually think about with a robot, and that is the control mechanism.

Mechanics

You could go crazy with this and start with a platform like Tuggy from the very cool OpenRC Project. While totally awesome I think this takes all of the thinking away from the students and simply turns them into mechanics. Which is fine if that’s your goal. Instead I’d start with ThinkFun’s MakerStudio collection of building sets.

macaroni box car

You can buy sets or download and print from the Thingiverse. I’d start by having students play with the gears and such and make simple cars with parts available, then begin thinking about what their RC car needs. They’ll need to make a variety of decisions. How will their cars be steered? Will they use skid steering (like a tank) or rack and pinion (like a car)? What sort of  platform will they need? I’m not sure a Mac & Cheese box is the best choice. How many motors will they need? Will they use gearbox motors or simple DC motors and then use the gears in the set? Some of these decisions might be made by the teacher and some or all might be left out the students. I’d probably go with simple DC motors and use the gears from the set.

Once these decisions have been made students can then think about the parts in the MakerStudio kits they don’t have but need. Things like motor mounts, rack and pinion mechanisms, bits to mount the gears to the platform of choice, and such. These could should all be designed and 3D printed by the students.

Electronics

Tony asked for Arduino, so we’ll stick with that. It also doesn’t hurt that I know a lot about using Arduinos with high school students. Unfortunately, you can’t run any sort of reasonable motor directly from an Arduino. You need some sort of transistor or h-bridge. Digital outputs on your Arduino only put out 40 mA, this is woefully inadequate to power a motor.


Students can wire an h-bridge themselves, but I highly recommend using a motor shield. I’ve had many students use an h-bridge and breadboard their circuit which mostly works. There are a lot of connections that need to be made and by the time students got to soldering stuff together numerous problems would typically crop up. In order to get around a lot of headaches I now have students use motor shields and skip all the complex wiring. You can buy shields from China really cheaply, but I like to use SparkFun Electronics. SparkFun is based out of Colorado and they offer an educator discount of 20% and allow you to easily set up payment accounts allowing you to pay via purchase order. The other thing I really like about SparkFun is that they include code example and/or tutorials for almost everything they sell. So I can hand a shield to a student and then point them to the product page and step back.

Most motor shields will allow you to control two motors, perfect for skid steering. If your students chose to go with rack and pinion then you can get away with one drive motor, but you’ll need a servo-motor for steering. There are lots of tutorials for controlling servos with Arduino and ideally where ever you get your motor shield will tell you how to wire your motors to it and give you a simple program to control your motor(s).

Other Stuff

At this point we just have programming and control mechanism left. I have some ideas about control mechanisms, but I haven’t done any of these in the past. When I say “I” that really means my students. So, I’m going to do a little more research and then another post. More than likely I’ll be looking at some sort of the cool BlueTooth module and an app running on a cellphone or tablet. There are other ways, but controlling a robot with your phone is just too cool.