“Magic Eight-ball”-Style Lego Darth Vader

November, 2014

My wife is a huge Star Wars fan and her favorite character is Darth Vader.  I’ve given her many Star Wars-related gifts over the years, and I was trying to think about a unique gift I could make for her.  I came across the Lego Star Wars Darth Vader minifigure clock, and got the idea of hacking it.

darth_vader_and_stormtrooper_lego_minifigures_alarm_clocks_3

I bought one from Amazon.com for less than $25 USD and when to work on it.  I was happy to discover that this is a very well-made device with pose-able (but not motorized) arms and legs.  This is not a small toy – it’s over 23cm (9″) tall.  The head is a push-button used to stop the alarm.  It has some buttons and a switch on the back to control the clock functions.  It has a battery door on the back that holds 2 AA batteries.

Mechanical

I started by disassembling the clock and was happy to discover that it was made with a modular design – very easy to disassemble and reassemble.  The head pops off with some force, and the collar unscrews.  4 screws hold the torso together and the legs slide into grooves in the torso to hold them together.  I ripped out all the clock circuitry and used my Dremel to cut out all the excess plastic – there was a LOT of excess plastic.  I had to cut a lot to make room for the new components I wanted to include, without jeopardizing too much of the structural integrity.

IMAG0244 IMAG0245

I found some great Hitec servos that were small enough to fit inside the body and still had the torque I needed to move the parts.  The Hitec HS-65HB “Mighty Feather” servos use Karbonite gears and offer an impressive 31 oz-in.  They only rotate 90 degrees, but that was good enough for my needs.  I did have one malfunction (loud clicking noise) and had to replace it. They are reasonably priced ($22 USD), so it didn’t break the bank.

I used one servo for each arm, and a third servo mounted in the leg to make Darth bend at the waist.  The Arm servos were pretty straight forward.  I used a Dremel to cut away some of the excess plastic on the shoulder ball joint and drilled an under-sized hole in the center of the shoulder.  I pressure-fit the servo gear directly into the shoulder hole and they worked perfectly.  I fabricated 2 small plastic strips and superglued them into the front and back of the chest to keep the servos in place.  The leg servo was a bit trickier.  I finally settled on a design that used a wire to extend the servo movement to the rotating hip joint.  I fabricated a small brace to keep the servo in place.  I am not getting as much movement as I would like out of this, but it’s good enough.

IMAG0284 IMAG0281

While testing the servos, I found that they chatter if I keep them “on” – this is not uncommon for servos. My solution was to adjust the source code to detach the servo objects after each move in order to eliminate the chatter.  I was concerned this might take too long, but I don’t see any impact in response time for the movements at all by using this approach.

I also found it useful to have a servo tester so I could test the range and center the servos.  I could have just built one with an Arduino, but I wanted something that was packaged and had lots of functions.  My research lead me to the Vexa Control servoXciter.  It had some nice features including a knob, LCD screen, and lots of functions.  The $70 USD pricetag was a bit steep, but t was easy to use and I’m sure I’ll use it again on future projects.

Base

In order for Darth to bend at the waist, I needed to ensure that his legs were fixed on a base that would not move.  For this, I went to work in my garage using some scrap Red Oak wood planks.  I used my bandsaw to do a resaw cut, then made small blocks to create a cavity inside the base for the plastic tab to fit inside.  I left a notch on either side of rear of the plastic tab to catch on the inside wood sides keep it from coming out completely.

IMAG0289 IMAG0291

I used a 1/2″ round router bit to give a fancy edge to the top lip of the base platform.  I drilled holes in the top for mounting the feet, and then counter-sunk the holes to allow the plastic tab to slide freely.  My son picked out the Minwax Red Oak 215 wood finish stain.  After staining all the pieces, I glued it together and clamped it tight until the glue dried.

Sounds

My goal was to have an equal number of positive, neutral and negative responses for Darth to speak.  I would use the Arduino “Random” function to randomly select one of the sound files to play back.

Rather than attempt to replicate James Earl Jones’ iconic voice, I thought it better to just play back actual sound clips from the Star Wars movies.  My first challenge was to find voice clips that fit well into the “Magic Eight-ball” response.  IMDB ended up being invaluable for this since they had a list of all his famous quotes from the movies.

I learned quickly that Darth is kind of a negative guy – he doesn’t say a lot of positive things in the movies and generally tends to lean heavily on threats.  So, there was lots of negative response material, but I had to get a bit creative to get enough positive responses.  For the neutral responses, I thought it would nice to pull some sound-effects from the movies that are generally associated with Darth.

My web searches revealed lots of web sites with free .WAV and .MP3 downloads of Star Wars movie clips.  I did some editing using Audacity and got what I needed.  I found the mono configuration with a 11025Hz sample rate worked best. I also used the conversion utility to convert the .WAV file to a proprietary .AD4 format which worked better on the WTV020SD chip.  On the PC, they all sounded great, but after playing them back through the custom electronics in Darth, I found I had to go back and adjust the volume on some of them to make them louder/quieter to balance the sound output.

In the end, I settled on 5 sound clips for each category.  I created this graphic in Powerpoint and put it on the plastic slide-out insert in the base in case there was a question about how his response should be interpreted.

Capture3

Electronics

For the “brain”, I opted for an Arduino Nano since I had a few extra from an earlier project.  The small size was necessary for fitting inside the chest cavity, but it still gave me enough IO pins to drive all the electronics.  I also used a surplus WTV020SD module from a previous project to play back the recorded .WAV files.  I had dozens of these left over from the Talkbot project.  Finally, I re-purposed an old oval PC speaker from a laptop I destroyed.  As it turned out, this speaker was a perfect fit for the opening in the chest where the clock face used to be – I really could not have planned that any better!

IMAG0279IMAG0285

After building the prototype on a breadboard using an Arduino Uno, I cut a perf-board to size and soldered down all the electronics and moved to the Arduino Nano platform.  The key was to keep the boards as small as possible and the wires as short as possible to minimize the room required inside the chest cavity.

This is where I hit my first major hurdle.  The 5V 2A wall wart I was using should have provided plenty of power to run the 3 servos and the WTV020SD module.  Everything worked fine on my bench power supply, but for some reason, I could not get the audio to play back while even one of the servos was running when running it from the wall wart.  I tried all kinds of stuff including adding a bunch of capacitors and still could not get it to work!  I suspect that the WTV020SD was demanding a spike of power to start playback that my instruments were not sensitive enough to detect.  The Servos pulled up to 1.3A (depending on how far they moved), so they could have been draining just enough power to prevent the WTV020SD from starting the playback.  I finally settled on a separate 9V battery to power the Arduino Nano and the WTV020SD module, and using the 5V wall wart to run the 3 servos.  While the on-board voltage regulators on the Nano could easily step down the 9V input power, I had to add a LM7805 5V regulator on the perf board to avoid frying the WTV020SD module.  I chose a 9V battery over other options because it was the smallest battery package that got me above 5V.

Now I had to figure out how to find room to stick all the electronics, plus a 9V battery inside the body cavity, and still be able to get to the battery easily for replacement.  I discovered that the battery door was not big enough to easily pass the 9V battery, even with all the plastic inside cut away.  In the end, I finally decided to just velcro the 9V battery to the outside lower back of the torso unit and extend the wires inside.  This didn’t look great, but it met all my space and maintenance needs.

Now that i had 2 power sources, I realized I couldn’t re-use the slider switch on the back as I hoped.  I pulled it out and replaced it with a DPDT slider switch I scavenged from a surplus store.  Now I could control both the 5V wall wart and 9V battery supplies from a single switch.  Again, it didn’t look great, but it met my needs.

To conceal all this ugly stuff on the back of the torso, I decided that Darth needed a cape.  I mean, c’mon!  What’s Darth without his cape?  After I thought about it, I realized I probably would have gone with a cape even if I didn’t have stuff to hide on the back of the torso.  I know Lego needed the back to be free to allow easy access to the buttons on the back, but I did not have that requirement.  I found a scrap piece of felt (a bit thicker than I wanted, but it worked fine), and cut it to size.  I used black yarn to secure it around his neck.

IMAG0299

Final Fitting

With the electronics and mechanical components all tested, it was time to fit everything together.  Cramming in all the wires (especially the long servo motor wires) ended up being the hardest part.

While the speaker was a perfect vertical fit for the front gap where the clock LCD screen once was, it was not a perfect horizontal fit – there were .5 inch gaps on either side of the speaker that needed to be filled.  I fabricated 2 small panels using scrap 1/8″ thick HDPE.  I cut it to size using my Dremel and put black electrical tape on the front to match the shiny black of the rest of the torso.

IMAG0311a IMAG0298a

I used 6-32 x 3/8″ screws and nuts to secure the speaker to the plastic panels.  I thought about painting or attempting to hide the screw heads, but then realized it fit well with the electronic chest-piece look of the costume, so left them untouched.  Since it is a PC speaker, there was no magnet on it for dampening, so I didn’t have to worry about it corrupting the files on the MicroSD card in the WTV020SD module.  Also, it was designed to be very thin, so it took up very little space inside the chest cavity, which is what I needed.

After much trial-and-error, I found space for all the electronics and the Servo motors inside the chest cavity.

IMAG0308a

Finishing touches including using black electrical tape to cover the holes in the back, and printing new on/off labels for the power switch.  The end result looks great and performs flawlessly.  I hope Darth makes my wife very happy.  By looking at the final result, you’d never know that Darth has gone through extensive surgery.

IMAG0312 IMAG0313

IMAG0314  IMAG0315a

Source Code

Video

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s