Update: this project is now available on LEGO Ideas -- so be sure to support it if you'd like to see it sold in stores someday!
Built originally for Star Wars Day 2014, I present to you a project that I've been constantly revising and making additions to since spring 2014 -- into a near-final refined form as you see now. This is a life-size replica of Han Solo's iconic weapon à la Star Wars, recreated with LEGO bricks, and fully rigged to light up and play sound effects with triggered! This particular model -- a prototype with crude electronics -- may seem rough around the edges, and even uses a lot of improvised jury-rigging in its functionality, based on what LEGO pieces and electronics I had available. Building this project was a challenge to say the least, and had more electronic malfunctions than you can shake a stick at! I ran into multiple issues with the Arduino code, the problems with the breadboard parts experiments, wiring the circuit, and of course designing the physical LEGO portion itself. In making this creation, I've taught myself how to program with Arduino, as well as I've improved my electronics savvy so that subsequent electronic LEGO models of mine will be more sophisticated. Consider this project to be an instructional guide for the everyman, with its elaborate functions simplified. Rather than necessarily being a verbatim step-by-step guide, this is more of a chronicle to my experimental prototype, so that you can see my work, make feedback on my design, and even make your own changes if you wish to attempt build this yourself.
In this tutorial, I'll show you exactly how to construct the LEGO frame, where to obtain pieces, how to program the sound/LED functions, how to go about rigging up the electronic components, and finally pointing out some important notes involving the design and engineering. I encourage you to make your own improvements where applicable, as in, if you have any better solutions for engineering and ascetics -- as well as for the electronic functions -- feel free to deviate from my design. Although this is an elaborate build from the LEGO standpoint, for the electronic portion I'm going to illustrate it in very basic beginner terms, so that anyone can replicate the electronics and program the coding with ease.
What you currently see is the Mk. II version of the design. The Mk. I edition of the LEGO DL-44 blaster was built by me throughout April 2014, and used a very crude and inefficient electronics/sound system that was slapped together from hacked Radio Shack parts, and was more or less rushed for Star Wars Day 2014. I didn't promote the project on the internet very much, as I was going to wait until I could retool the project with a custom circuit board and more efficient layout. That being said, this is the second draft of the blaster project, which uses its own custom circuit chip and Arduino programming.
To get things started:
What you'll essentially be doing is building each segment of the gun individually, inserting the electronic parts where needed, then sealing the whole thing up. Naturally of course with the magic of LEGO bricks, you can always remove/dismantle certain parts of the gun to make any repairs with electronics or to swap out the batteries, and you can even make substitute color swaps like a bright orange gun instead of black. Also, since this is a prototype design, it has its flaws, and isn't recommended to be used a legitimate toy gun; most likely if you run around with it in your backyard or take it with you to a 501st Legion parade, some of the pieces could fall off -- hence this is more of a permanent display model, like those expensive Force FX Lightsabers versus the cheap "expandable sword" Lighsaber toys you see at Walmart! If/when this ever becomes a real marketed LEGO toy via Ideas, it'll most likely be a master-build, and something you'd want to keep on a pedestal or in a case out of harm's way.
Please refer to my HTML 3D guide for a list of parts (found on the last step of the HTML page). In this section you'll see the gun's chamber, firing mechanism, magazine, and handle: in the LDD file, follow the steps from the beginning, and when the gun's frame and handle are built, attach the handle to the rear of the gun. The handle of the gun serves as the housing for the battery, which uses wires channeled across the gun's trigger guard into the magazine. Within the magazine will eventually be the speaker and sound chip -- hence in this portion, the gun's sides, roof, barrel, and scope are missing -- as they'll be eventually attached to seal off the whole project.
The firing mechanism uses a small system of miniature Technic axles, pulleys, and rubber bands to make the firing pin spring forth and reciprocate when the trigger is pulled; the firing pin slides across a smooth panel of tiles. As the firing pin slides down a track, it'll strike a momentary pushbutton to be later attached. When the firing pin makes contact with the button, it will eventually control the circuit's function to launch the LED/sound code. Although LEGO group does in fact manufacture tiny rubber bands for certain projects, I had a hard time trying to find proper sizes, in order to maintain more authentic LEGO pieces. Alas, I purchased a cheap pack of black rubber bands for ponytails at Rite Aid for about $2 USD. These little rubber bands (smaller than a newspaper rubber band, but larger than the ones for braces) will be attached to the gun's firing mechanism as shown in the photos. When the trigger is pulled back, the rubber bands stretch and spring the firing pin forward, and subsequently go back to start.
Please note: the handle is somewhat difficult to attach, and in fact LDD doesn't allow it attached in its current form (which is why it's not attached to the frame in the 3D guide). The handle is tilted at an angle and held on to the frame via a few Technic pins placed in the proper spot. I can't really explain exactly how these go inside, aside from that you have to tilt the handle, line up the Technic holes, and insert the pins where applicable.
Also note: there's a random black disk floating on the ground. In my real life model, I can successfully fit 12 Technic disks around the axle to form the front grille, but LDD for some reason says only 11 disks fit. Naturally this part is included in the file, but when you actually build it, add the 12th disk to the front grille.
Refer to the file which contains the 3D guide for the gun's roof and side panels, and check the parts list above for what you'll need. Once completed, DO NOT attach the sides and roof to the gun yet -- until later on when the electronics are inserted. Although the side panels can be easily removed, the roof is tricky to remove once attached, and when you try to pull it off, it can damage the firing mechanism. I'd personally however recommend attaching the gun's starboard side (your side right) first, so that the electronics can rest up against the wall of the magazine (refer to the attached photo to see what I'm talking about). The gun's port side (your left) wall doesn't cover up as much as the starboard, which as you can tell in the final photos, the wires can be seen. This was done as a last minute idea, because the final gun had to be reduced to 3 volts DC instead of 5, which impacted the sound output -- so to deal with this, I left an opening by the front grille so that more sound can escape. If the exposed wires are an issue for you, I'd either recommend using black wires to blend in with the frame, or to slightly adjust the port side wall to go to the edge of the front grille.
The final part of the LEGO portion involves making the gun's barrel and scope, which both appear to be broken up in the 3D designer. This is because LDD doesn't allow unorthodox building techniques, hence although in real life, a Technic pin can go inside a cone piece, the software doesn't allow this for some reason. That being said, please refer to the photos of the barrel and scope to see how to correctly place the parts, such as the barrel's orange tip and the scope's washer rings (made from black rubber tires wrapped around the round bricks).
Inside the barrel is a hollow Technic tube, which shall have the LED's wires snaked through it, and ultimately weaved into the gun's magazine, via the the gun's action. For now, just ensure the barrel is hollow, and that the orange cap stays on securely.
The electronics portion of the guide is rather tricky and frustrating, but to make things easy, I'll present it in layman's terms where applicable and word it in such way that an amateur can easily program/build it with simple easy-to-find pieces. The Mk. I design of the gun used an incredibly crude electronics portion: I purchased a cheap Radio Shack sound record/playback module, slightly modified it, then rigged it into a parallel circuit with a homemade 555 IC "one shot" LED blinker. In other words, when pulsing a pushbutton, the sound module would play a sound effect of the blaster pistol, in addition to making a single LED flash on for one second. The whole thing was powered by a 9V battery, and due to my then miniscule electronics savvy, I was unable to have the project power down -- thus the battery died after a few days. I've since then greatly improved my electronic abilities and began coding with Arduino, and as of now -- after numerous experiments -- I've developed a tiny barebones audio circuit for playing small sound clips off of a single chip. The overall premise of this barebones sound player is just the barebones Arduino, which has only the basic elements of the aforementioned circuit, such as the ATmega32 chip, the voltage regulator, few resistors, capacitors, and oscillating crystal. This circuit has some additions like terminal sockets for connecting the batteries and speakers, and also a small area with a transistor for amplifying the speaker. I programmed this chip using a tutorial I found online called "Arduino as an ISP", which uses the actual Arduino's function to upload code on standalone chips on a separate breadboard. Then once the chip was programmed, I placed it into my barbones Arduino on a breadboard circuit, and with some minor tweaks I succeeded in blasting the sound with pushbutton pulses!
This is an evolutionary design I've been working on for quite some time, mostly through trial and error, as well as countless failed experiments with physical electronics in addition to the code itself. The function of the code is to keep the chip in a power down mode by default to save battery life, and when pulsed with a momentary pushbutton, the LED blinks for about 1 second as a small audio clip plays. The blinking LED is a slightly modified form of the preexisting Arduino LED blink code that comes standard, the sound blast is a modified version ofthis particular code for playing PCM wav clips, and the sleep mode was modified from this tutorial I found. Most of what you see in this circuit I've made was strictly by trial and error and messing around with delay and loop functions in my code. For instance, I'd follow various tutorials verbatim, but would have failed results such as the sound output being quiet/muffled, the LED not blinking, or the transistor heating up. With many countless hours experimenting with various component parts and discovering how they work, I've succeeded in programming a standalone chip with the functional code, and developed a small sound player with adequate sound output. Although this circuit works perfectly fine for me and contains no errors in my various tests, If you're an electronics expert and you've noticed some issues with the layout and/or some parts which should be adjusted, feel free to point them out. For example, I'm using a 2N2222 transistor to output the sound in conjunction with a few resistors; although the sound plays just fine and the parts don't heat up, you might say to yourself, "Baron, you probably ought to replace the transistor with model# XXXXXX and use a resistor with fewer Ohms for cleaner sound!" or perhaps you might notice an error in my code. Again, although both the code and circuits function properly as intended, I'm not an expert, so if YOU are an expert, I encourage you to make suggestions and corrections where applicable -- that's what the comments section is for!
Please note: some of the blaster photos are inconsistent with the electronics parts I've assembled. Long story short, my breadboard circuit and first draft soldered chip were made when I assumed I could fit four AAA batteries for 5 volts to power my project -- hence I included the voltage regulator and 10uF capacitors to step the power down from 6 to 5 volts, and I included a transistor in series with resistors to make clear sound. After I soldered the whole chip based on my breadboard design, I learned that I could only fit two AAA batteries, so I had to remove the voltage regulators from the design, but at that point I still had the transistors and resistors soldered in. My final circuit is almost verbatim to the barbones "Arduino on a Breadboard" circuit from the link above, with the voltage regulator omitted -- but still retaining the 16 MHz oscillator, microcontroller, et alia.
There are numerous tutorials online of how to upload code from the Arduino to a standalone chip on a breadboard (such as ATtiny85, or in this case ATmega32), but alas, I've had nothing but failed results when using them personally -- until I found this particular guide from Boris Landoni (most of the images in this section are taken directly from his tutorial). In his tutorial, he explains how to use a handful of parts to easily transfer code from the Arduino to a chip on breadboard, by first slightly adjusting the Arduino software. Thus, you can utilize the entire chip's space without the need of burning a bootloader on the standalone chip.
For this portion, I used the following items:
One 220 or 470 Ω resistor (optional). This is for the LED that blinks on the breadboard when the sketch has been uploaded.
Assuming you're not familiar with programming microcontrollers via an Arduino, for the sake of brevity, please refer to Boris' link up above, which breaks down the necessary steps of where to place the wires and how to modify your code in greater detail. I'll sum things up and give you the basic rundown:
Photo credits: Boris Landoni.
If you've succeeded in uploading the sketch, now it's time to place the programmed ATmega32 chip on a breadboard to test it out! This section no longer requires your Arduino, so go ahead and unplug it.
Parts needed -- most of these can be purchased at Radio Shack for a few dollars U.S., and of course most of these you can re-use from the prior step for programming the chip. The resistors, capacitors, LEDs, and transistors were each in assorted multi-packs I bought at Radio Shack that had various sized components together. I think I paid like $10 for several hundred various-sized resistors, from 1 Ω to 2 million Ω! Here's a cool online tool for understanding resistor colors.
Refer to the illustration for correct placements of the component parts. Rather than providing a schematic, since this is a project I'm intending to present to amateurs, I designed an illustration instead. Please note: this breadboard illustration you see evolved from an early design in which I intended to use 5 volts DC in the Blaster, which meant the schematic required a voltage regulator and capacitors. Also, the placement of the resistors in conjunction with the transistor was done when my first breadboard circuit required 5 volts. After I soldered the chip and realized I couldn't fit four AAA batteries into the gun like I planned to, I had to remove two and have the gun powered by 2 AAAs, thus removing the voltage regulator -- but at that point, the resistors and transistors had already been soldered. That being said, the 3 volt version (in this tutorial) has slightly duller light and sound, as a result of having less power and more resistance than intended. I did however eventually try to experiment with having 3 AAAs, and the sound/LEDs were more powerful -- so in later revisions I might re-tool the LEGO portion of the gun to fit 3 AAA batteries for 4.5 volts. Feel free to experiment with various resistor and transistor configurations in your breadboard, and make sure nothing heats up!
What you see in the illustration is a simplified and modified version of the "Arduino on a Breadboard" circuit, which is a method to build a barebones Arduino module -- or in my case, utilizing the necessary parts from Arduino Uno (the microcontroller, the oscillating crystal, and capacitors) to have a small, portable chip with my audio and LED code uploaded onto it. In the aforementioned link, the breadboard requires a voltage regulator, as it's intended to be powered by 5 volts DC. Again, that was my original intention, but at the last minute when I assembled the gun, I couldn't fit enough batteries and thus removed the regulator. My current blaster uses 2 AAA batteries, and only gets 3 volts. The sound output and LED brightness are noticeably duller versus my original breadboard made according to the link above. My illustration was based off the Arduino on a Breadboard tutorial, only in my current illustration I have the voltage regulator and the two 10uF capacitors removed. The two 22pF capacitors, the 16 MHz crystal, the ATMega32, and reset/switch resistors are absolutely vital for the barbones Arduino. The transistor by the speaker is there to increase the sound output, but please note that the resistor configuration in the diagram was made when I used 5 volts. Using the same configuration with 3 volts makes the sound not as loud as I intended, but alas, I already soldered the circuit with the resistors and transistors prior to stepping it down to 3 volts. Again, before you solder your board, you can experiment with different resistor and transistor values.
After you've experimented successfully with the breadboard, you can move on to soldering each component into a circuit board!
Arduino/ATmega32 pinout diagram courtesy of Arduino Playground.
This phase was one of the most difficult and tedious sections, and I ran into numerous errors that delayed the release of this project. The soldering for this is easy for the intermediate or professional electronics guy, but if you're just a beginner, you'll probably run into obstacles. I'd highly recommend reading this Instructable regarding soldering methods if you're a beginner. This circuit will essentially just be everything you constructed on your breadboard -- only now compacted into a tiny little circuit board, but nonetheless following the exact same layout.
Here are the final parts required. Most can be re-used from the breadboard you just finished building, but a few new things must be purchased, such as wires.
First begin by soldering the 28-pin DIP socket (or two rows of female header pins) into the circuit board. Never add the actual ATmega until the whole shebang is soldered, for safety purposes! Following your breadboard that you've constructed based on the previous steps, place the necessary components into their respective areas -- the resistors, capacitors, header pins, and oscillating crystal. Refer to the diagram to see the pinout for the ATmega: in your breadboard, you should have successfully had your components attached to the proper pins on the ATmega for functionality. For example, the indicator LED should be connected to pin 19 of the ATmega, the socket for the barrel's LED wires to pin 18, and the audio output connected to pin 17. The audio output will then go to an empty area on the board (preferably out of harm's way from other connections), connected to a 100 Ohm resistor, and to the base of the transistor. The transistor's emitter will go to the header pins for the speaker, and finally to the positive rail (make sure the connection of the speaker's header pins doesn't have the bottoms touch, or you'll create a short circuit). Also, the speaker is polarized: the red wire goes to the pin touching the emitter, and the black wire will go to the pin touching the positive rail. The collector is connected to a 10 Ohm resistor, then to the ground rail. The positive rail should lead to a specific pin slot (or terminal slot), and the ground rail should lead to its respective slot -- the two rails must remain separated. There are two 10K Ohm resistors for ATmega pins 1 and 4: the first is to prevent the chip from resetting, and the second one is to ensure your trigger switch doesn't get stuck on a permanent loop. First start by having the right pin of your female header pins connected to pin 4 of the ATmega, connect 10k Ohm resistor to the right leg, then to the positive rail. The left leg of the header pin will then go to the ground rail. These header pins will keep your trigger's pushbutton connected.
Again, follow your breadboard circuit to get the proper placements of the final soldered components, but make sure to cram them together carefully to utilize as much space as possible. Internal space is limited inside the blaster's magazine, which means any excess circuit board must be cut off with wire cutters, a knife, or scissors! As you can see in my attached photos, I trimmed around the circuit board to remove non-used holes. Underneath the board is an ultra-compact mess of jumper connections!
Arduino/ATmega32 pinout diagram courtesy of Arduino Playground.
I pity the fool who thinks Han shot second.
Most likely despite your best efforts, you're bound to run into some trouble (like I did, to say the least)!
Thanks again to everyone who's helped support my LEGO projects over the years! With your feedback and encouragement, I can keep making these nifty creations to dazzle the likes of you, and due to popular demand I'm going to publish more and more Instructables tutorials. I'd like to thank the folks fromArduino Playground for providing their sample codes -- such as LED blinks, PCM sound players, and sleep modes -- so that I could combine the codes and experiment until perfection.
-Baron von Brunk
All photos taken by Julius von Brunk, unless specified. Links to the source images can be found in their respective steps.
LEGO® is a trademark of the LEGO Group
Star Wars, Han Solo, and Greedo are property of 20th Century Fox Lucasfilm