R2D2 toy shell brought to life using a Raspberry Pi Zero W.



My daughter got an R2D2 toy believing it was electronically controlled, just to find out that it was only an empty shell. She was very disappointed, so I said I could probably make it come alive. So this is where it all started.

The R2D2 is made by JAKKS PACIFIC.


The challenge was to add the mechanical component that were missing inside the shell. Thankfully, I have a 3D printer, I really love it!

I had to print a few parts and put together some electronics. Here is the breakdown:

Head Gear and Head Optical Interrupter

The head gear is mounted on a geared DC motor (bottom left) I got off ebay. The motor are controlled using a DRV8833 H-Bridge circuit via the PCA9685 I2C PWM drive circuit.

The optical beam interrupter (top right) is used with 3 optical switches. The switches provide travel limits to the head. The optical switches are wired to regular GPIO on the RPi.

Battery Charger Mount

For this project I purchased an off the shelf lithium battery that provides a 5V output. I took the cells out and the charging circuit and I made some mounting hardware and a button to be able to push it to see the 4 LED indicating the state of charge. I also added an On/Off circuit to control cycle the RPi on or off. The motors and all the circuits that needs a lot of current are wired directly to the 5V supply.

Raspberry Pi, PCA9685 and DRV8833 Board Mount

The RPi, PCA9685 and the DRV8833 circuit are mounted on an adapter inside the shell.


Leg Motor Mount

One of the leg has the ability to go up and down. So I used an HS-422 motor and removed the internal drive circuit and made an adapter to hold the motor and an optical switch. The motor has a CAM mounted on it. The CAM has a beam interrupter build-in to detect when the leg is in the bottom position.

LED Board (No 3D Print Here…)

I added 4 LED (2 x Red, 1 x Green and 1 x Blue). These LED all came from a defective Christmas light string. Can go cheaper than that!

So I assembled the LED on a proto board and made sure they were allign along with some mounting holes.



Having sound does make this project a lot more fun! So I bought once again an off the shelf (cheap…) speaker that had an amplifier in it as well. The one I bough was battery powered with 3 AAA battery. I took out the unnecessary hardware and glued it on the inside shell.


User Buttons

There was also a spot to add a couple of push button switches. I assemble them on a proto board an made some spacer (3D printed of course!) to give the proper clearance for the switches.


Power Management

Since this is a battery powered toy using a rechargeable lithium battery, I added a circuit for allowing to turn on and off the RPi in a clean way. The circuit uses a push button switch to latch the power on. To turn off the button is pressed again an the state of the button is sensed by the RPi (GPIO04) to trigger a clean shutdown.

All the power hungry circuits are wired directly to the 5V supply. This is to prevent any voltage drop that would cause a reset of the RPi. The PCA9685 and the DRV8833 are both disabled when the RPi is off. They are enable after the program runs. The DRV8833 circuit is used to control both DC motors and also it controls the power to the speaker and the optical switches. The LED are controlled by the PCA9685.

Adding Audio to RPi Zero

We need to add an external circuit to add audio to the Raspberry Pi Zero W.

Electrical Circuit


For controlling the R2D2pi I used NodeRed with the following Nodes:

1 – node-red-contrib-pca9685 (Control the PCA9685 board)

2 – node-red-contrib-speakerpi (Send audio to the speaker)

3 – node-red-dashboard (Used to build a web GUI)

About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Scroll to Top