I’ve had so many people ask me how I went about building the full size R2-D2 remote control system. So today, I will take you through what I have done so far and what I plan to do in the future. When I first started my R2-D2 building adventure I read all the R2-D2 forums and Reddit posts on how others have done it. What I found was a little disappointing. Most of the builders were just rehashing 10 year old plans that others had made using model airplane remote control systems. I wanted to put together something much more modern that I could build on and have APIs for integration into other things.
For example, I wanted my home automation system to be able to do things with R2-D2 like wake him up or turn him off. R2-D2 is going to live in my theater room and I wanted him to come alive and go to sleep before and after movies but to be silent during them. The best way to do this is to have some sort of computer or micro-controller inside him.
Full Size R2-D2 Control System Video
Raspberry Pi Controlled R2-D2
- Low Power – The Raspbery Pi is a lower power device. Since R2-D2 is battery operated, saving power is critical. A full size PC was just not going to be an option for something that I hope to run 8-12 hours on a single charge.
- GPIO – The RPi has GPIO for controlling servos, relays, and other device.
- I2C – The I2C protocol is a serial bus protocol that allows multiple devices to talk to each other over just two wires. This means I can control Arduinos, motor controllers, and anything else that supports I2C remotely.
- Bluetooth – Since the RPi has integrated Bluetooth, I can use a Playstation 3 or XBOX One game controller with the Raspberry Pi to drive and operate R2-D2.
- Wi-Fi – With Wi-Fi on the RPi I can have R2-D2 on my home network and also develop iOS and Android applications to control him.
- Python – With Python programming I can simply automate and control R2-D2 and make changes to how he operates quickly and without much development effort.
There are however some downsides of using a Raspberry Pi over the traditional model airplane remote controllers:
- Reliability – Let’s be honest. Computers crash and software has bugs. It’s certainly possible I will have programming and stability issues with the full size R2-D2 remote control system running on a Raspberry Pi. Time will tell, but I hope it will be rock solid.
- Complexity – This type of system adds a lot of complexity that average DIYers might not be able to do themselves. After all I am writing the Astromech Operating System to control R2-D2. Clearly not everyone can do this.
Initially when I dreamed this up I somehow had it in my mind that I would just need a single Raspberry Pi to run things, but after putting together my initial R2-D2 project plan I realized there were going to be far too many devices that would need to be controlled. There are over 20 servos in the dome alone, almost as many in the body. Then add on the dome motor controller, drive motor controllers, lighting displays, screens, etc. I realized quickly I would need to expand on this design.
Arduino Controlled R2-D2
Enter the Arduino Mega 2560. This device basically an expanded Arduino Uno and is based on the ATmega2560 micro-controller. It has a whopping 54 digital I/O pins. I placed one of these in the dome of R2-D2 and another one in the body. For now I think that will be plenty. However, since they are connected over I2C adding additional Arduino’s is super easy should I ever decide I need to do this.
The Arduinos also offer something that the Raspberry Pi couldn’t offer me (at least not easily in Python). PWM in hardware! PWM or Pulse Width Modulation is a way to pulse voltage on a pin creating something called a square wave. PWM is very useful for controlling servos and stepper motors. With hardware PWM you get a far more stable and smooth result from those devices. A lot less jitter on the operation.
Full Size R2-D2 Remote Control System
So let me show you what I have created. I think you’ll find this at least somewhat useful if you decide to build your own. Inside R2-D2 is a master brain if you will, and connected to it are multiple Arduinos, motor controls, etc. over the I2C bus. The Raspberru Pi is responsible for controlling and monitoring everything within the R2-D2. However, for certain things, it just sends commands (more on that further down) to slave devices and they are responsible for executing on their own. For example, the RPi send a command to the dome motor controller over I2C to turn left at a speed of 100. The motor controller is expected to keep the dome spinning left until it receives another command to do something different.
Astromech Command Language
In order to make all of this work simply, I created something called an Astromech Command Language. It’s very simple. Within the Astromech core software is a mapping file that maps each command to a button, sensor, or other input. When a button is pressed the RPi will break the command down and process it.
Every command starts with a # (or hashtag for you young people). Following that is a single letter that designates something specific. D for dome, B for body, M for media, and Z for motor controller. I’m sure I will add more as I go. I’ve just recently added S for a sequence of commands so I can make R2-D2 do little shows.
Followed behind the command is a string of parameters. For example #DDP01OP is the command to open dome panel one.
Eventually there will be an API to allow literally anything (via authentication) to command R2-D2 to do something. This could be a home automation system, an iOS or Android app, or even a webpage. All without any need to understand how R2-D2 works internally.
Here some examples of other commands:
- #DHP02CT – Center Holoprojector 2
- #BDD+055 – Turn the dome left at a speed of 55
- #M010 – Play Media file 10 (a song)
- #BBP05– – Toggle body panel 5 (if its open, close it / if its closed open it)
- #S004 – Run a sequence of commands – Allows me to combine a sequence of commands with music so R2-D2 can “dance”
At some point in the coming months I will be open sourcing my Astromech Operating System to anyone who wants to use it help me expand it. For now, it’s in too much of a state of disarray to do so. Far too early in its development cycle.
If you’d like a tour of my R2-D2, see the video above. I give a complete tour at the end of the video. If you’d like to read more about my R2-D2 Build you can see them all here. You might also find the R2-D2 Parts List helpful.