Automated LEGO X-Wing

by BrownDogGadgets in Circuits > Arduino

4466 Views, 18 Favorites, 0 Comments

Automated LEGO X-Wing

IMG_7758.JPG
GIF.gif
IMG_7761.JPG
Automated LEGO X-Wing - Arduino Controlled!

We absolutely LOVE the new LEGO Star Wars sets that have come out over the last couple of years. They're well designed, fun to build, and look great. What would make them even more fun is if they also moved on their own!

We took an off the shelf LEGO X-Wing set and automated it so the wings open and close on their own. Even better, we added sound effects and lighting effects! But if that isn't enough we also added a motion sensor so that it would activate when someone walks by. Overall this project isn't overly difficult to do, but does take awhile and requires a healthy amount of random Technic LEGO parts to built the gear box area.

Parts Needed

IMG_7610.JPG
IMG_7724.JPG

Electronics

LEGO

  • Poe's X-Wing Fighter (75102) or Resistance X-Wing Fighter (75149)
  • Small Beveled Gear
  • Large Gear
  • Size 12 Axel
  • Worm Gearbox
  • 2x4 With Holes
  • Various LEGO Technic Parts

If you need various LEGO Parts try using BrickOwl.com or Bricklink.com, though you can easily substitute parts you have for a lot of this project.

Video Guide

How To: Automate a LEGO X-Wing

We edited up a video guide on how to do this project as well. If you're not the kind of person who likes to read, this would be a handy resource.

Build Your X-Wing

LPXJbFqJTQRxJNDR.medium.jpeg
enY3uXGmBldIFVcm.medium.jpeg

Build your LEGO X-Wing as normal.

Remove the launchers from the wings as they look weird.

Use either Poe's X-Wing Fighter set (75102) or the Resistance X-Wing Fighter (75149). They're the same model just different colors.

Remove the Wings

MLJAGOJTUjfaQvmP.medium.jpeg
MfoQyuKWb6dGm6MJ.medium.jpeg

Take off the rubber bands.

Pull the two pins that hold the wings onto the body.

Put the wings to the side.

Remove the Bottom Pieces

ISKtusjy1TekUACx.medium.jpeg
ON122LfrKU23gJoL.medium.jpeg
joCObrW3EJPG1GMi.medium.jpeg

Start removing pieces from the bottom of the X-Wing.

Keep going until you get to the internal gear box.

Pull off the small back "storage area".

Set all those pieces aside for later.

** We found it really helpful to use a LEGO Prying Tool (which comes with the X-Wing sets) to get the pieces off. Some of them can be on there pretty tight.

Add the Bevel Gear

QB4bvXxNmrcIq4Qn.medium.jpeg
ETw4uQMaKUxCrV63.medium.jpeg
fTTvvFQsPDKqEJ1y.medium.jpeg

Insert a size 12 Axel through the back rear of the model.

Carefully, and with some luck, get a 1/2 Brush onto the end of the axel.

Lastly get the Bevel gear on.

Push the rod all the way in so that it connects with the other rod.

This is the most difficult part of the ENTIRE process. Remove more X-Wing parts if you need to.

Rebuild the Bottom

SkHN6MhaLSpvAVPe.medium.jpeg
yivRRaUtjAfoMhQ1.medium.jpeg

Rebuild the entire bottom of your X-Wing. Refer to the box and original directions.

Add Bushings to the Axel

uHmcIEZXYYYV2k6e.huge.jpeg
ihiDyeYo1FhafiHj.huge.jpeg
qaSUoSOXVlI6116I.huge.jpeg

You'll need 4 x Bushings, 3 x 1/2 Bushings, 1 x 2x4 Plate with holes, 1 x Large Gear.

Start by pushing one 1/2 Bush down to the end followed by two of the full bushing.

Add plate, which should stick on the back the X-Wing.

Then start with a 1/2 Bush, followed by two of the full sized Bushings, then the Gear, and lastly a 1/2 bushing.

Use an orange LEGO prying tool to push the parts into the X-Wing. If you pull the axel out you'll have to take apart the bottom all over again.

Our pictures are not 100% accurate to our description above. We described the order in which our final build used, which required us changing a couple things after we had originally taken photographs.

Attach the Wings

SBxauu5GXyqHj4LO.medium.jpeg
x6TNvgXmsKQjbqF4.medium.jpeg

Put the Wings back on the same way you took them off.

Attach the rubber bands as well.

Built the Base and Supports

iWkdqRvJLEMHOBrx.medium.jpeg
SmqnlU6J1CcHwrWU.medium.jpeg
FUj1cXtQMrsVNPDM.medium.jpeg

Use a large LEGO plate of some kind as your base. You'll need one with room for the gears on the back.

We used some tall 1x2x5 bricks (2454) to make supports. You can use whatever you want provided that it gives enough clearance for the wings and Servo.

Build the Gearbox

QvplJyOJN4xqNpny.medium.jpeg
EKqfLTjBPU1sctLI.medium.jpeg
EjxbYagGluY2I1Lp.medium.jpeg

We used a Gearbox for Worm Gear (6588) to translate motion from the Servo to the large gear. You'll need to build your own setup based on whatever LEGOs you have available.

You'll most likely have to fiddle around with everything to get your spacing correct. Use our pictures as a guide.

Connect the Gearbox to the X-Wing

2qyZYvyKDkeRjlvy.medium.jpeg
SgNHBtmOEwte3CM4.medium.jpeg
tPX2D4PENKqZYDuX.medium.jpeg

We added some 1x4 Technic bricks for the end of our size 12 Axel from the X-Wing to go into. Attach those to the Axel.

Place the X-Wing onto the base plate so that everything lines up.

This can be annoying. If everything doesn't line up, try again. Take it slow and easy.

Build the Servo Attachment

sgNj5U4Y2DDWRRdS.medium.jpeg
nebnBnnPqJYGGLHm.medium.jpeg
HBELfRlf6orI3NZd.medium.jpeg

We're using a 9G Continuous Rotation Servo with some laser cut acrylic adaptors. We include those in our kits, but we also have those files available for download.

Screw the Servo into a Servo Mount.

Press on the Horn.

Using a small gear, two 1/2 Bushings and some size two rods to create the horn adaptor.

Press a size 6 or 8 Axel and a full sized Bushing into the middle of the gear.

We used a couple of 1x4 Technic bricks and some 1x4 plates to space everything. You might need to use a different amount of plates.

Connect the Servo and Gearbox

3yNYVM4WvkXbaTps.medium.jpeg
xaPbvIgGwNUhuWqM.medium.jpeg

Pull the axel off the servo and push it into the worm gear in the gearbox.

Press the Bushing up next to the worm gear.

Connect everything to the Servo.

Adjust your pieces to get the spacing correct.

Build the Robotics Board Platform

WmlD41JhGVhsxvTb.medium.jpeg

Use two 1x6 or 1x8 plates to create a small platform for the Robotics Board to sit on.

We need to do this since the board won't sit flush on the base plate. Feel free to do some fun designs of your own, just make sure Ground and Pin 11 are filled with a LEGO Stud.

Add LEDs

AUETOKGxUIySQjmL.medium.jpeg
sdveFEOxFSoBsUcx.medium.jpeg
mvuAJG6aOETRGQwD.medium.jpeg

Use two Crazy Circuits SMT LED boards to add lights to the bottom of your X-Wing. Make sure you're using Nylon Conductive Tape as regular tape will break as the wings move.

Place your boards on the bottom of each wing.

Run Conductive Tape from the Positive on one board to the other board.

Run Conductive Tape from the Negative on one board to the other board.

Don't cover up the spots where the supports that go from the X-Wing to your Base go.

Connect LEDs to the Robotics Board

dxROB1IN4Ap1DyNS.medium.jpeg
G1OEGbXbVxmeTsKX.medium.jpeg
QHfKsm2Kwpyg6WmT.medium.jpeg

Connect your X-Wing back to the base.

Run Tape from Ground on the Robotics Board to the Ground on the LED Tape.

Run Tape from Pin 11 to the Positive LED Tape.

Since Conductive Tape is not reliably conductive on the bottom you'll want to fold over the end that connects to the LED Tape. Then tape that down with another piece of Tape.

We found it helpful to attach the lines of Tape BEFORE we reattached the X-Wing. We just cut really long lines of tape and left them hanging while we set the X-Wing on the base. After that we connected everything.

Connect the Servo and Gearbox

xKus5KBCLI6IHfc2.medium.jpeg

Plug the Servo into the D3 Pin set.

Connect the Range Finder

jgT13l1CfKUuOCPL.medium.jpeg
GUK6hIvYVr2LBetn.medium.jpeg
Screen Shot 2017-12-18 at 1.35.42 PM.png

Reference the Diagram above for the next two steps.

Connect VCC to a 5V Pin.

Connect Trig to A4.

Connect Echo to A5.

Connect GND to a GND Pin.

Connect the MP3 Player

42iFQ15RVpHKkjf1.medium.jpeg

Use the diagram again to help you out.

Connect GND to a GND Pin.

Connect VCC to a 5V Pin.

Connect TX to 5.

Connect RX to 6.

Online documentation for this board is weird. Trust us, this is the correct wiring.

Find a Sound Clip

bPPYQ1cXDRr6HBxL.medium.jpeg

We grabbed our sound clip via a YouTube Video. You can use any sound file as long as it's a .WAV or .MP3. (We can't give you a sound clip for Copyright reasons.)

You'll want to use just one sound clip for our code. Once you find one put it on a micro SD card formatted in FAT.

Put the Micro SD Card into the MP3 Player.

Make sure you take note as to how long your clip is, as it will be quite helpful when modifying the code.

X-Wing sounds are great as well as some classic Star Wars music.

Modify Your Code

2HOpWlwVMf2fl3u5.medium.jpeg
yBB6DbmmmNAd4vMO.medium.jpeg

If you've never used our Robotics Board before you'll need to read the user guide and install the right software and drivers.

You'll also need to grab and install the NewPing library as well.

New line. Open up your Arduino software and copy our code into a new project window.

Lines 30 & 31 control how long the Servo will move when opening and closing the wings. We find that 20000 ms is about right. You can change the time by changing those values.

Line 91 controls how long the Servo pauses to wait for your audio clip. Our Sound Clip is about 25 seconds so we have it set to 25000 MS.

The code has the LEDs come on once the wings open, then turn off once they're closed.

Have Fun!

ajNR3fXovvBDNUPF.medium.jpeg

Attach some Speakers to the MP3 Player and run the code. (Powered Speakers with some Volume Control work best)

The Servo will sound horrible. Thats expected.

You'll most likely have to modify your code several times to get the timing correct.

You'll also most likely have to go back and modify your gearbox or servo holding areas. The strain may push things apart on you, so modify where necessary.