Inside Out

So, I seem to be building R2 in the reverse of how most people build their versions. Whilst I started with the dome due to finding a good deal, I’ve spent most of my time working on his internals and very little on the actual physical droid. Since my last post back in August regarding R2’s brain, I’ve done a lot of work on how everything will tie together to do the control. My current working idea is to have an i2c bus running throughout as R2’s central nervous system both sending out commands, and receiving feedback.R2D2_Electronics_Block_Diagram

The main control is still going to be a Raspberry Pi as this gives me much more range to do some interesting things later such as voice recognition, as well as letting me experiment with lots of different ways to actually control R2. I’m still thinking of using a PS3 controller as input, but also thinking of using a wii nunchuck is possible as a much smaller one to control simple operations.

The Pi will be linked via i2c to the various modules such as the servo controllers mentioned in my last post, with one in the dome and one in the body, and also to the lighting systems with Arduinos programmed to receive the signals to trigger various effects. I’m using BHD‘s Arduino code for the TeeCees lights in the dome at the moment, with just minor changes to accept the i2c signals. I may write something at a later date to do more dynamic light displays such as free form text messages to scroll across the RLD, but for now this is more than adequate.

Communication between the spinning dome and body will be through a 6 wire slip ring connector. 2 wires will be enough for the data signal, and then I will pair up the others to provide the power. I’ll probably have to go for two separate 5V supplies to the dome, one for electronics and one for servos as there will more than likely be a lot of noise coming over the servo power lines as they move.

PDUPower for all the electronics will come from a simple USB battery pack, which in turn will be plugged into the power distribution board I have designed. The PDU will take in a raw input from the sealed lead acid battery (or batteries) and produce clean 5v and 12v outputs, as well as a raw output direct to the speed controllers. The PDU also incorporates a few other features such as connectors for volt/amp meters that will be behind a panel on the front of R2, a voltage divider to allow the charge bay lights to function as a crude charge display for the batteries, and also a relay cut off for recharging R2. The last means that I can safely plug R2 into the charger (via an XLR connector), which will pull power going to the rest of the circuits. Lastly, there is the main power switch to kill power from the battery. There is a diode across the switch however which should allow any charge coming from the speed controllers to go back into the battery. This is a feature of the speed controllers to allow regenerative breaking.

The clean 12v will be used to power the audio amplifier. What is R2 without a few beeps and whistles?

I’m just waiting on the PCBs to come back from OSHPark, so I can try them out. Hopefully I managed to get most of it right and I haven’t seriously miscalculated the current draw from the batteries. I don’t want any tracks melting off the board!

Code wise, I’ve done quite a drastic rewrite of the controlling software to make it much more object oriented. Each different module (servos, audio, lights, etc.) is a module with a command keyword associated with it. This means adding new modules (LCD screen, extra lighting, drinks dispenser…) should be easy and just a case of creating a config file and possibly a class file if its a new type of module. All the code is available at github, along with the schematics and board diagrams of the PDU. The PDU is also available to get direct from OSHPark.

Fingers crossed I may be getting a few parts to build the actual droid with soon, including the feet, which means I now have to figure out a drive system for him. Mechanics isn’t exactly my strong suit, so should be interesting. 🙂