Weigh in on the discussion on Hacker News!

This post uses the Twilio Node.JS Module and the Twilio Rest Message API

Robots have fascinated me for as long as I can remember, beginning with simple circuits and eventually moving on to PIC boards. Luckily for modern evil geniuses, creating basic robots has been made easier than ever by the Arduino and its awesome community of contributors. In this tutorial, I’m going to take you through the ins and outs of building a basic robot that you can wirelessly control from your phone’s dialpad using Twilio, Arduino, Node.js, and the RN-XV WiFly module. First things first, I’d like to show you what the finished robot looks like in action:







The Parts

I have a whole slew of spare parts sitting around that I used to build my robot. However, you don’t need everything I used in order to create your own phone-controlled Arduino with different functionality.



Just a note, that the plastic chassis I’m using is no longer in production, but the one on the parts list is comparable and made by the same company. If you want to build the complete robot, you will need all of the parts listed or at least a comparable set. If you’d just like to experiment with a WiFi-enabled Arduino, you only need the required parts.

Wiring it Up

The wiring is relatively simple, and requires very little soldering.

Step 1: Plug the Wireless SD Shield into your Arduino

Step 2: Plug your LED into digital pin 13 and GND. Note that the shorter pin on the LED is GND.

Step 3a: Plug the +5V and GND lines from your two servo motors into the breadboard. I used the M/M jumpers to do this, since my servos had 3-prong female plugs to begin with.

Step 3b: Run M/M jumpers from the breadboard to the Arduino’s 5V and GND power slots.

Step 3c: Connect your left servo’s signal wire into digital output 10 on your Arduino and your right servos’ signal wire into digital output 9.

Step 4a: Connect your sonar sensor’s +5V power and GND to the breadboard. In order to do this, I soldered a set of headers onto the sonar module to make it easier to plug into. I then used the M/F jumpers to connect it to the breadboard.

Step 4b: Connect your sonar sensor’s PWM output to digital input 5 on your Arduino.

Step 5: Plug RN-XV WiFly module into Wireless SD Shield. Note that I would recommend doing this after you upload your program onto your Arduino, as I had a lot of issues uploading while the RN-XV module was plugged in.

Step 6: This is where you would screw all of your parts to your chassis. I didn’t include step-by-step instructions for this part since it will vary depending on how you wish to set up your chassis, but on my model I have two wheels, each connected to one of the motors, and one free-spinning wheel in the front. The Arduino and breadboard are sitting in a SparkFun Arduino+Breadboard Holder and taped to the top of the bot. I also have a 9V battery taped to the bottom of the bot to power the Arduino.

The TwilioBot

Software Hacking – Arduino

The Arduino portion of the software is relatively simple. We’ll begin with our basic setup() method, adding only our WiFly setup functions to it. Note that we are using this WiFly library by jcrouchley. You will need to download it and put it in your Arduino IDE’s libraries directory. Once that is done, you can create a new sketch and start it off with the following code: