Pi2D2 – Wifi, Webcam, Video Projection, R2D2, and You!

Hacking the 15″ Hasbro Interactive R2D2 isn’t new, especially when it comes to using a Raspberry Pi to make him do all sorts of entertaining things. Still, it looked like fun, so I decided to do my own version… despite the lack of originality.

Here’s what I features I decided to include in my hack:

  • Fully controllable over a wifi internet connection via a web browser. I wanted him to be my own little Mars Curiosity rover.
  • Webcam capabilities. I wanted to see what he sees, so that navigating him remotely over wifi to terrorize my cats would be easier.
  • Video projection. Hologram technology isn’t quite there yet, but I figured his ability to project movies on a wall would still be pretty entertaining.
  • Sound output, with a large bank of samples that can be played remotely on command.
  • Some sort of control pad, so that I can maneuver him even if there is no wifi network within range.
  • Turn him into a Roomba. Okay, not really. But wouldn’t that be awesome?

In the end, the following hardware was utilized:


1 Raspberry Pi Model B
1 8 gb SanDisk Extreme Pro SD card (for the operating system)
1 16gb HP USB Flash Drive (for storing all sound and video media)
1 Belkin 4-port powered USB hub
1 Edimax wifi usb dongle
1 SD card extender cable (optional, really)
1 USB extension cable (the shorter the better, or you can splice your own)
1 Mini PC keyboard with RF USB adapter
1 Logitech C270 webcam (this was before the Pi camera was available)
386AMP audio amplifier
Optoma PK102 PICO Pocket Projector


2 Dual H-Bridge Motor drivers (Probably a bit overkill for this project, but it was the board I was most familiar with already)
1 small 5v solenoid (more on this later)
1 TIP120 transistor (for use with the solenoid)


2 5A SBEC voltage regulators
2 Tenergy 11.1v 1150mAh LIPO rechargeable batteries with PCB protection
1 TLP-2000 Tenergy Universal Smart Charger

And last but not least, the Hasbro Interactive R2D2 toy itself. I recommend looking on eBay for a cheap, broken version. That’s what I did. And of course, you’ll need various wires, LEDs, and plenty of solder.

R2's web interface

R2′s web interface. Webcam feed is at the top, along with various buttons. W, A, S, and D on the keyboard moves him around.

How It Works:

After switching him on, R2D2 will automatically boot into a custom Python script that I wrote. This establishes a web server that can be accessed by any browser. This web page gives players the control to move him around and rotate his dome left and right. On the page itself, clickable buttons can play any sounds that are on the USB flash drive. Users can also toggle the video projector to turn on and off, and play a movie file on command. This video is projected to a surface directly in front of R2. During his operation, a webcam mounted inside R2D2′s dome will send a video stream to the web page, allowing you to see what he sees. Nifty, eh?

The Build Process:

The specifics of taking apart the Hasbro R2 have already been well documented here. The outer casing remained pretty much all the same, although I had to dremel out several pieces on the inside that were no longer needed in order to make room for the new battery and other electronics. I discarded all original Hasbro circuit boards and cables, only keeping the front mounted speaker and the three DC motors: two for each leg and one for rotating the center dome.

All connections to the LED’s and h-bridge circuits that drive the motors are hooked directly to the Raspberry Pi’s GPIO pins. Peripherals such as the webcam, RF keyboard dongle, and 16gb flash drive are hooked into the USB hub. The Pi’s RCA video jack goes directly into the projector, and the audio output connects to the 5v amplifier, which hooks up to the front speaker that was kept from the original Hasbro toy.

The first main challenge with the build was with the video projector. I found that mounting it on top of his middle support leg was the best way to fit everything inside. It also created a nice angle to project the image forward against a wall in front of R2. However, getting the projector to turn on and off based on commands given by the Raspberry Pi was a challenge. This particular pico projector (which I was using just because my wife had bought one for her classroom and didn’t end up using it) has a push button on the side that turns it on and off. I opened up the casing to see if I could wire an on/off switch to the circuit board directly, but these things are way too small and delicate to be operating on them.

So instead, I decided to attach a small solenoid to the side of the projector to physically push the button when I wanted to power it on or turn it off. The positive connection for the solenoid was attached to the 11.1v positive on one of the batteries. A transistor was used, connecting one of the 3.3v GPIO pins on the Raspberry Pi to the base signal of the transistor. (See this tutorial if you don’t know how to use transistors with solenoids.) Originally I tried using the 5v regulated power connection for the solenoid, but it wasn’t enough juice to push the button in all the way. 11.1v seemed to work, as long as I was just using it in short intervals.

The video projector mounted on R2's middle leg

The pico video projector, mounted on top of R2′s middle leg.

The other main challenge was the battery power. This was my first project using LiPo batteries (or any kind of battery, really) and if I had more experience, I probably could have figured out how to power everything off a single battery. However, I ran into quite a few complications and decided in the end to use a total of three batteries. Not ideal, but it is what it is. One 11.1v LiPo battery utilized a switching regulator to provide 5v for the Raspberry Pi and other circuits. This battery is stored inside R2’s dome. The second 11.1v LiPo battery was regulated at 6v for the three DC motors. This is somewhat similar to Hasbro’s unaltered R2 toy, which uses 4 “AA” batteries for the computer circuits and 4 “D” batteries for the motors.

So where’s the third battery? Well, again, the problem lies with the video projector. This little guy uses a lot of power apparently, and hooking it up to the same battery as the Raspberry Pi or the motors was too much of a drain. However, the pico projector already has a 3.7v 1050mAh lithium ion battery inside. Rather than try to figure out a way around this, I decided just to utilize the battery that already came with it.

Mounting all of the components inside R2 was also a challenge. I had to position things at odd angles to get everything to fit, and frankly, it’s kind of a hot glued mess. But it works. Like I mentioned above, I mounted one of the 11.1v LiPo batteries inside the dome along with one of the h-bridge boards, the webcam, and four LEDs.

R2's dome, including a webcam, battery, and h-bridge circuit

R2′s dome, including a webcam, battery, and h-bridge circuit

The main body contains the other h-bridge board, the remaining 11.1v LiPo battery, pico projector, Raspbery Pi, USB hub, audio amplifier, front speaker, and basically everything else.

R2 front chassis

R2′s front chassis, with DC motor for dome rotation, USB hub, Raspberry Pi, and various audio/video connections

R2's back chassis

R2′s back chassis, with a 11.1v LiPo battery, two SBEC regulators, h-bridge circuit, audio amplifier, and various connections.

R2 has two compartments on his front case that can be opened. The compartment on his left side provided a nice, accessible space to put the connections for all three batteries along with the SD card and USB flash drive. So if you want to change his data or recharge the batteries, all the required cables can be found in this easily-opened compartment.

R2's charging and data connections

R2′s charging and data connections

The compartment on his right side is where Hasbro placed a little arm that can hold a beer  bottle or whatever else you want. For some reason, I was determined to keep this as is.

R2's spoon is too big

R2′s spoon is too big

In terms of software, the Raspberry Pi runs the standard Raspian distribution. WebIOPi was configured to provide a web-based interface to control the Pi’s GPIO pins. Following the Cambot tutorial, MJPEG-Streamer provided the streaming video for the webcam mounted in R2’s dome. I then wrote a Python script that would set the state of the IO pins for all LEDs and motors while playing sounds and starting video via OMXPlayer. I also had the Python script register the IP address of R2D2 on my web server so that I could look up his address easily. And last but not least, I installed Pygame to handle all the key presses on the mini RF keyboard in case I wanted to control him outside of the web.

What I wish had been done better:

Like I said, using three batteries is kind of a pain, since it means all three need to be recharged for this little droid to be fully operational. His battery life is quite long though, so that’s a plus. I also slightly regret mounting the USB webcam inside R2’s dome like I did. The reason is that it’s always looking slightly up instead of straight ahead, which means obstacles on the floor can be difficult to see. However, rotating his dome left and right can usually get you a better sense of his surroundings. I also didn’t implement any kind of positional sensor inside the dome, so it can be a little difficult to know whether or not he’s looking straight forward.

Click here to download R2D2′s Python code.

33 thoughts on “Pi2D2 – Wifi, Webcam, Video Projection, R2D2, and You!

  1. The quantity of top high quality content on your extraordinary website has truly made me realize the authority your site has. Thoughts blowing posts and articles seemingly everwhere. Maintain up the good work.

  2. Pingback: Pi2D2 หุ่นยนต์เลียนแบบ R2D2 พลัง Pi | Raspberry Pi Thailand

  3. Pingback: Pi2D2 interview | Linux User & Developer - the Linux and FOSS mag for a GNU generation

  4. First off – this project ROCKS! I have totally fell in love with the Raspberry PI and have been playing countless hours with it. Your project is has been an inspiration to me and have been working on this now for the past three weeks and have found myself stuck with the H-bridge, specifically, UK1122 from Cana Kit. I am not understanding how to properly enable motor A and motor B. Could someone help?

    In my case:
    H-bridge #1
    Motor A = Right leg motor
    forward = GPIO 22 to H-bridge IN1
    reverse = GPIO 10 to H-bridge IN2
    Motor B = Left leg motor
    forward = GPIO 17 to H-bridge IN3
    reverse = GPIO 27 to H-bridge IN4
    H-bridge #2
    Dome Motor =
    Right = GPIO 11 to H-bridge IN1
    Left = GPIO 9 to H-bridge IN2

    Thanks so much.

  5. Pingback: Electronics | Pearltrees

  6. I want to know if you can build me the exact same r2d2 i am not good with electronics and dont have the time or money to experiment on this. If there is anyway you can build me the same r2d2 with rasberry pi and webcam and projector and all the other cool things you mentioned. please let me know and i would pay for what ever cost incurred by you since you are the pro and expert at this if not infact a Genius.

    Thank you

  7. Pingback: order anadrol

  8. Pingback: Trick5 – 5 Awesome TV and Movie Robots You Can Build With a Raspberry Pi – Trick5 | Trick5 Simplify The Technology

  9. Pingback: 5 Awesome TV and Movie Robots You Can Build With a Raspberry Pi - Wikitimes-Times Of New Generation

  10. Pingback: long-term hobby project – Picraft

  11. Pingback: 5 Awesome TV and Movie Robots You Can Build With a Raspberry Pi | abskillz.com

  12. Pingback: 5 Awesome TV and Movie Robots You Can Build With a Raspberry Pi – Technology and Electronics

  13. Pingback: 5 awesome TV and movie robots that you can build with a Raspberry Pi | Zahir News -

  14. i build and design robots,and like your build,since i have 3 of the r2d2 robots
    and had plan to add in a raspberry pi board

    on the projector i used a little smaller one and removed the projector module and board and i am mounting in the head

  15. Pingback: ラズパイで R2-D2!

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>