In late 2009 I bought an Arduino from the Maker Shed Store and began playing with it. Early on I was very intrigued by two separate projects: Karl Castleton's RoboSapienIR and the basic WebServer that came with the Ethernet library. I decided to combine the two in order to make a web enabled robot. RoboSpaienServer is the result.

Here's a quick video tour (apologies on the focus - see the screenshot below for a better view)...

Basic Hardware & Tools

On the arduino side, you will need:

  • An arduino (obviously). Personally, I have an Arduino Mega, but you can use whatever configuration you prefer.
  • A compatible Ethernet shield. Since the Mega will not take the default shield without wiring modifications, I instead bought an Ethernet shield from NKC Electronics.
  • A prototyping board and two resistors: one at 1 Kohm and another at 1.5K.

For the robot, I purchased a RoboSapien v1 toy robot on eBay. To modify it for this project I used:

  • An old extension cord for a phone cable that had both male and female ends to it (an RJ14 to be exact). However, any connector (USB, etc) would have done, as long as it has four wires and you have male and female ends.
  • To enable use of the robot when not connected to the arduino, I also cannibalized an extra male connector that I could short out. This will be used to make a "stub plug."
  • Two header pin pairs, each 1 x 2 pins. While you can use straight wire instead, these hook up more easily into the protype board (above).
  • Some sort of insulation for the cut wires. While electrical tape or shrink wrap could be used, I recommend "liquid insulation," a rubber paint you can find in the electrical section of most hardware stores.

The tools required for this project are solder, a soldering iron, and lots of patience.

RoboSapien Wiring & Modifications

The basic principle of RoboSapienIR is that you replace the existing RoboSapien infrared remote with the Arduino, sending electical impulses in lieu of the IR impulses from the remote. This is done by tapping into the connector between the motherboard and the robot's head where the IR sensor resides. There's a detailed schematic below, but this section will take you step by step through the process.

I began by taking my RJ14 cable and cutting it, making sure I had at least six inches on each end. I then removed the robot's back shell and used a soldering iron to melt a hole in the left side, symetrical with the power switch on the right. You can then thread the cable with the female connector through the hole in the plastic casing. The two photos below demonstrate what these modifications look like when the project is done (the gray wire taped to the cable on the right photo is the "stub plug" to allow operation without the arduino).

Photo of RoboSapien's Back Photo of RoboSapien's Back

You can zoom in on the above images by clicking on them.

There are three wires of interest in the connector from the head to the motherboard: a 3.3V power (red), a ground (black), and the infrared signal (white). With the cable threaded through the hole in the backshell (you can't insert it afterwards!), I connected the red and black wires to the same colored wires in my cable by burning away the insulation with a soldering iron and then soldering my cable's wires directly to the undamaged wires. However, I have since discovered at this site that you could instead pull out the motherboard, flip it over, and solder directly to solder pads. If you have an opportunity to do this, I'd recommend it as the wires on the connectors are relatively fragile and easy to break.

To connect to the IR signal, cut the white wire and strip some insulation from either end. I then soldered my new cable's green wire to the end running to the robot's head and the yellow wire to the end heading towards the motherboard. After that, I insulated all the exposed connections with rubber "liquid insulation" paint (the white stuff near the connector in the righthand photo above).

For the male end of the cable, I soldered the red and black pins to a 1 x 2 pin header and the yellow and green wires to another 1 x 2 header. For the "stub plug," I took the spare male connector and soldered together the green and yellow wires. To test your wiring, put the "stub plug" into the female connector off the back of the robot and power up the robot. This should restore the wiring to its original state and allow you to use the remote to command the robot. If this works, insulate all exposed wires and button up the robot by replacing the backplate.

Note that the red power wire and the green wire back to the robot's IR sensor are unused in this project. I brought them out anyways for future projects.

Arduino Wiring

When I first tried the RoboSapienIR hack, I had a lot of difficulties. I discovered here that while the arduino uses 5V for signals, the robosapien uses 3.3V. The subtlety is that if your ground wiring is poor the hack will occasionally work! To make it work properly, you will need to construct a voltage divider to convert the 5V signal to 3.3V. Below is a schematic showing all the connections (click to enlarge) on both ends of the cable.

RoboSapien Schematic

In addition to the above, I also cut a piece of plexiglass to fit the bottom of my Mega, drilled holes to match those in the Mega, and secured the two together with zip ties. This insulates the arduino and allows me to secure it in turn to the protoype board with more zip ties. You can see in the lefthand photo above that this makes a much more compact arrangement than having the whole thing lying around.

Arduino Software

You can now use the default RoboSapienIR sketch if you'd like. However, to make the web server work, download the sketch source code file RoboSapienServer.cpp and cut and paste it into a new sketch. Be sure to modify the ip[] array (line 21) to reflect an IP address that will work on your local LAN.


Power up the robot. When you upload the sketch to your arduino, you should hear the robot "burp" when the code runs. This is the signal from the software indicating that it is now in control of the robot. This will also occur every time you reset the board.

You should then be able to connect your Ethernet shield to the local LAN and log into the webserver. You may have to reset the board after you cable it up. Once you log in, you should see something like the screenshot below in your browser.

RoboSapien Browser Screenshot

You can now press buttons to move the robot's arms, make him roar or high 5, etc. If the robot is inactive for a period of time, it will yawn and "go to sleep" to enter a power saving mode. Press the "Wake Up" button to get it going.


The web server works by appending a question mark and a hexidecimal number to the back of the URL to send a command code to the robot (i.e. "?B1" to wake up). You can easily add more buttons or change the codes passed to the SubmitButton() call in lines 280 to 302 (I intentionally left out any movement commands because I didn't want the robot walking off the demo table I had set up for it).

You can modify the background color or make any modifications you might put on a normal webpage by playing with the HTML sent over the socket connection. Just make it reflect your own sense of aesthetics. Also, I learned from my demo at the Discovery Science Center that the buttons should be bigger if you want passersby to use the web page. You should also change the name of the webpage to remove the "Kevin's Webpage" titles at line 274 and 177. After all, it's your webserver now!

Additional mods to the actual robosapien operation are also available. You could modify the RSLoop() (lines 151-164) to read the IR sensor via the RSReadCommand() routine so that either the web server or the remote can be used to control the robot. You cold also program a long series of commands (e.g. move ten steps forward, then ten back) or add programming commands. Also, if you don't like the "burp" to signal the arduino has taken control, change it (line 144).

Finally, replacing the Ethernet shield with a WiFi module or leaving the server up and connected to the Internet so anyone can manipulate it (say, with a webcam trained on your robot) would be interesting directions to take this.

Final Thoughts

This was a pretty fun project for me and did not take all that much time to get running. In fact, it has taken me longer to document the whole thing in this writeup than it did to do in the first place.

If you have any questions or comments, please reach me via the "Contact" link at the top of this page.



Publicity about this project.

Useful links for this project.