Introduction: Electronic LEGO Super Mario Starman
This is a fun and unique project that I began initially building shortly after the release of my Electronic LEGO Star Wars DL-44 Blaster Pistol -- which of course means this particular project was built using my acquired knowledge of the blaster, as well as it uses a very similar functionality. The bulk of the project is a miniature 3D pixelated version of an iconic Invincibility Star (or Starman) from the Super Mario Bros. series, but inside is a miniature circuit board containing a few components to make the eyes blink and to play music. Like my DL-44 Blaster, this project also requires an Arduino as well as a working knowledge of how to program microcontrollers. The electronics portion to this is much, much easier and streamlined versus the DL-44 Blaster, as the microcontroller used is an ATtiny85 to play tone melodies, rather than an entire ATmega328 for blasting PWM sound files. Once all is completed, when you push a small tactile button located on the rear of the Starman's head, the Mario invincibility music plays for a few seconds (via tones, not WAVs nor MP3s), while the two eyes blink in synchronization.
In this tutorial, I'll provide instructions how to build four different styles: Glowing Yellow, Ice Blue, Gold, and Rainbow -- the special rainbow Starman has its own unique code for playing the Mario "Coin Heaven" music from Super Mario Bros. 3, and instead of the eyes blinking in one color like the other three stars, the rainbow one uses color-changing LEDs which cycle through multiple colors. This is optional, and like all of my projects, you're absolutely free to deviate and change the colors and change the Arduino code if you'd like.
Please note before attempting this project:
- Like all of my Instructables, this is not an easy nor cheap project to build. Although the LEGO and electronic portions are both significantly easier than the DL-44 Blaster, this isn't a project to be done by amateurs with little skill. Each Starman model contains roughly 300 LEGO pieces: some have slightly more or less depending on the particular color model. For instance, the rainbow version's outer tiles use a completely different pattern than the other three, thus has a little bit more than 300 pieces. On average, I can't really give an estimation for the price, since I bought most of my electronics parts in large batches at once. Many of the pieces can be bought for less than $1 US from various online sources, and you'll probably spend about $10-15 worth of LEGO pieces, give or take.
- The electronics skill required is novice-to-intermediate, but nonetheless requires the ability to solder and identify components (e.g. adhering to proper LED polarity, using proper resistors, using sufficient battery power).
- Programming the sound chip requires a working Arduino board. I use an Uno, but from what I've gathered, the Mega and other models can be substituted.
- Touching one of these stars will not grant you temporary invulnerable powers. Believe me, I tested it and jumped off a tall building and died. ᴸᵘᶜᵏᶦᶫʸ ᴵ ʰᵃᵈ ᵃ ¹⁻ᵁᴾ ᵐᵘˢʰʳᵒᵒᵐ⋅
Step 1: The LEGO Portion
The instructional guide for this section was generated with LEGO Digital Designer, which is a free program developed by LEGO Group for making virtual blueprints of original creations. Like in all of my other projects, the pieces acquired here were from a variety of sources, but mainly individually online through BrickLink.com -- essentially, it's an online "candy store" of LEGO pieces, where you choose parts based on type, color, or year in a catalog.
Download your chosen Starman model from the links below, and view the HTML guide with parts lists in the following links: Glowing Yellow (white, orange, and yellow with yellow eyes), Ice Blue (blue, light blue, and transparent light blue with blue eyes), Gold (orange, orange-yellow, and yellow with orange eyes), and Rainbow (various colors with transparent clear eyes that blink flashing colors). As mentioned previously, the first three Starmen play the invincibility music in sync with the eyes flashing, whilst the fourth one plays the "Coin Heaven" music with multicolor eyes. Regardless of the model, the basic construction is exactly the same for each -- with the exception of the last remaining steps where you add the top layer of plates, tiles, and eye colors. Again, you're also free to deviate from my design and build a star based on your own color schemes, like a green star, a solid pink one, or even a black star with spooky red eyes. In the various links above (which correspond to the various models), you'll see the step-by-step guides in HTML with a parts list as the last step. Regardless, the individual LDD files are contained in attachments in this step.
As I also point out in each of my LEGO Tutorials, LDD tends to produce the steps in random order and ends up having parts appear before other parts are intended to be added. Using your best judgement as a LEGO builder, always ensure your model is built securely and use your own design savvy to locate where the pieces should go.
The bulk of the project is made from black plates and bricks, to form the star pattern. The innards are of course hollow, which securely house the electrical parts. Towards the end of the building steps, you'll begin placing plates and tiles on the front of the star, according to your model's color design. Be sure to use the Technic plate in the direct center as specified: these holes are necessary for sound output. The final steps of the project contain the panel for keeping the tactile button in place: for some reason, LDD doesn't allow this particular irregular method of inserting Technic pins in the backs of bricks, hence the button panel appears as a separate component which should be added later (see the steps with the electronics).
Step 2: The Arduino Coding
This section gets rather tricky for the novice, but for the advanced Arduino coder, this ought to be basic LED and tone functionality. Luckily all you have to do is upload my sketch to your ATtiny85 via a programmer of your choice. I personally used a setup called "Programming an ATtiny85 with Arduino", which uses a breadboard and some jumper wires. That aforementioned Instructable has links to the download files for installing the ATtiny master pack into your Arduino folder for boards. I've experimented with multiple tutorials for adding Arduino sketches to an ATtiny on a breadboard: some methods failed, and some worked -- and the method that worked perfectly was the one from the tutorial above, with ATtiny85 @ 1MHz (internal oscillator; BOD disabled) as the designated board for uploading finished sketches. I've tried various other ATtiny master packs from other tutorials, and had no luck -- and in some cases, I accidentally chose the wrong model (such as ATtiny85 @ 16MHz) and damaged my ATtiny. Always be sure to experiment with your Arduino itself before uploading the sketches directly to your microcontroller.
That being said, these images in this section are extracted directly from the original High-Low Tech tutorial for programming an ATtiny85, hence the photo credits are property of their respective owners. As for the sketch itself, it was an amalgamation of several sketches I've found online or in the Arduino IDE default library, only heavily modified to suit the needs for my code. The main sketch I've extracted my code from, however, was in this tutorial for making a musical Futurama Robot Santa statue by Psychic Origami -- in fact, I've even based the design of my Starman's internal circuit board off of his design as well. I've of course adjusted my circuits as well where applicable, and chosen some different variables.
The two download links in this section contain your choice of sketches: the Invincibility theme, or the Coin Heaven music. Both codes have essentially the same exact functions, such as blinking the LEDs in sync with the audio, only they're of course two different songs -- and the Coin Heaven code has some of its setup slightly adjusted to have different speeds and beats. Both codes will put the project in standby (power down) mode when not in use, and will be waken up immediately from tapping the tactile switch to replay the music/LEDs -- like a one-shot timer. Therefore, you can power this with as little as 3V in a coin cell, but I chose 6V to amplify the sound/light. If you'd like to change the music, you can do so by altering the notes and beat durations in the sketch. I have little or no knowledge of music, so I was able to successfully recreate the two songs by downloading MIDI files from this website for Nintendo music, importing the MIDIs into Anvil Studio (freeware), and examining the individual notes/beats in the piano roll editor -- one note at a time. This sketch only allows for one tone to be played at a time, which means you can't have harmony nor chords. The actual Mario invincibility song has the tune being played in three notes of harmony simultaneously, hence for my code, I've used the middle notes. The Coin Heaven song also unfortunately required several tracks of instruments and notes, thus I've reduced it to just the basic tune.
Step 3: The Electronics Production
Required parts (aside from basic soldering irons, solder, cleanup gear, et alia):
- Small Piezo speaker/transducer -- NOT a piezo buzzer, or else it'll produce a jarring sound like an alarm clock (in the proper notes/melody nonetheless, but still harsh). The small piezo speaker gives a subtle beep sound, like a musical greeting card. I purchased my speaker for 45¢ from this website (Surplus Electronics Sales), and because they were so cheap, I bought six at once. Radio Shack sells piezo speakers for a few dollars, but they're much, much larger and thicker, yet produce a louder tone. They're still small enough to fit inside the Starman model, but I've chosen the tiny ones for saving space.
- ATtiny85 (through hole). You can get these for a little over a dollar (U.S.) from numerous online stores like Digi-Key, JameCo, and Sparkfun, but I bought about ten on eBay for $13. It's always good to buy multiple electronics parts: you're bound to accidentally break one or damage one somehow, especially if your skills aren't advanced enough.
- 8-pin DIP socket. These are small sockets to solder on to your circuit for housing the ATtiny85, rather than soldering your ATtiny85 directly to the board -- this way, you can replace the AVR and re-upload code. I'm pretty sure Radio Shack sells these for like 2 for 50¢, so online you're bound to get these in batches for cheap.
- 5mm white straw hat LEDs (or any color, really) for the basic three Starmen, or 5mm color-changing LEDs for the rainbow model. Please note: if building the rainbow model, be sure to search for color-changing LEDs, and not RGB LEDs. Color-changing LEDs (preferably fast-blinking) cycle through random colors as long as a signal is sent to it, whereas an RGB LED requires special programming to change the color outputs. A straw hat LED is an LED with a dome-shaped surface with good brightness. I've specifically used these shapes as they fit snugly in the Technic holes for the Starman's eyes, which then have transparent LEGO round plates in place.
- 100 Ohm resistors for the LEDs. I tend to use this kind for most of my LED applications with low-voltages, and nothing burns out nor malfunctions. Resistors are super cheap, and Radio Shack sells them in packs for a few dollars U.S.
- Coin cell holder for two 20mm cells. This is the model I've bought on Digi-Key for $1.18. If you plan on only using 3V, be sure to order the same thing for holding one cell.
- Two CR2032 coin cells. Most stores like Radio Shack, Staples, and Best Buy tend to have a lot of markup on these batteries like charging $8 for just two, so I bought several online for half the price. I found some electronics dealers on eBay, Amazon, or third-party stores that can sell generic ones from China or Thailand for as little as $13 for 20. Also, keep in mind that I constructed four Starmen simultaneously, hence I did in fact need a ton of these batteries to play with. If you only plan on making one and don't require a king's ransom of 3V coin cells sitting around, just go ahead and pick up a two-pack from your nearest store that sells watch batteries. I think even Home Depot, Rite Aid, and CVS sell these, but again they're pricy at major retailers, especially name-brand Duracell and Energizer CR2032 cells.
- Small tactile push buttons -- not an on/off toggle. These are the tiny tactile buttons commonly used in most Arduino applications. The claw-like connectors on the backs are vital for holding into place of the LEGO grille tiles of the rear of the Starman's face. These cost super cheap;I bought mine for 15¢ each on Digi-Key.
- Small perforated circuit boards. The final size of your completed circuit should be around 1.75'' (~4.5cm) square, give or take. Radio Shack sells miniature perforated circuit boards for a few dollars U.S., however I bought mine from eBay, for about $7 for 20. Naturally, once your board is soldered and completed, simply trim around the excess areas with wire cutters or powerful scissors, and the board should snap off directly in the path you cut. The key is to compact the board as much as possible, to properly fit it inside the star. Your completed board should be no more than 5 LEGO studs square!
- Breakaway female header pins. These are what you'll be placing on your circuit to insert/remove the LEDs and speakers. I dislike permanently installing lights and speakers into my circuits, hence I generally use female header pins for interchanging crucial items. For instance, if an LED burns out, you simply disconnect it. I purchased several rows of female header pins for less than $10 on eBay, and using an X-acto knife, you can slice off the pins you need for your circuit.
- Thin jumper/bus wire, preferably high gauge like 24-30 AWG. Spools of this can cost a few dollars U.S.; I choose red/black to distinguish +/- connections on my circuit, respectively, or for placing on polarized components such as LEDs. I use non-insulated tin bus wire for small short connections in my circuit, like connecting the header pins to the ATtiny85. Non-insulated tin bus wire should only be used when you're certain that no other non-insulated wires will come in contact with it, otherwise you'll create a short circuit. When having multiple wires go across each, always make sure they're insulated, and be sure to have red/black color-coordinated ones to avoid confusion with V+ and GND connections.
- Helpful, but not required: a small vice, or "third hands" -- these are mini alligator clips used to suspend circuit boards off your work desk, for being able to use both hands with soldering. These retail anywhere between $10-30, but really streamline your production.
This section makes the assumption that you're familiar with soldering, as well as using component parts in a circuit. If you're having trouble creating circuits, please refer to this handy Instructable for beginning soldering. That being said, you're now ready to move on and build the circuit.
Refer to my breadboard diagram above. I chose not to make a Fritzing diagram, as it's difficult to convey the method of having the LEDs connected to header pins via wire, let alone how to convey the female header pins in general (after all, the Fritzing software's breadboard is basically just one huge series of female header pins, anyway). That being said, my breadboard diagram above is a hybrid design of a breadboard and a schematic, with everything simplified enough for amateurs, but detailed enough for experienced electronic builders. Like all electronics projects, always experiment with a breadboard first, just to see if your circuit will even work to begin with. If you're satisfied with your breadboard, you can map out where to place components on the circuit board. Do a dry run to map out where the parts will be placed with the best space-saving options; refer to my photo of a completed circuit with batteries. Before soldering, place the 8-pin socket on the board first, then put on the battery holder, followed by the resistors (corresponding to the respective ATtiny85 pins), finally the female header pins. If your dry run circuit resembles mine, then feel free to use a pencil to mark the locations to permanently solder the parts, then begin heating up your iron!
Start with soldering down the two most viral parts: the 8-pin socket for the ATtiny85, and the battery holder. You don't have to solder each pin of the 8-pin socket, just the ones vital to the circuit (see my illustration: for instance, the first two bottom row pins on the ATtiny serve no use for this project). Attach the two resistors, however, you can save time by omitting them and simply attaching the resistor to the wire for the LED; it's your choice. I personally placed the resistors in permanently connected to the pins of the 8-pin socket, which then leads to a slot in the female header pins. For the first LED, cut a section of two female header pins: this will be used as the terminal for the first LED. Have one pin of the header pins connected to the resistor (+), and the other will lead to the ground terminal (-). Your LED's respective pins will then be placed in these slots: the positive pin in the slot connected to the resistor, and the negative pin in the slot that goes to the ground terminal. Cut six female header pins: this row of six slots will be used for the second LED, the speaker, and the switch. Like the previous row of header pins, make sure the ones on the left of the row begin with where the resistor is connected, as this will be the positive slot for your LED, with header pin 2 leading to the ground terminal. Header pin 3 will be the slot for the red wire for your speaker, and header pin 4 will hold the ground wire for your speaker (connect header pin 3 to the ATtiny, and header pin 4 goes to ground). Header pin 5 will be connected to the ATtiny for the switch, and likewise header pin 6 goes to ground -- use these final two slots for eventually keeping the two wires for the switch. Once everything is properly soldered down, you can then move forward by attaching the removable components to test: insert the two batteries, the ATtiny85, the switch, the speakers, and the two LEDs. Tap the button to see if everything works, and if it's a success, remove the speakers, LEDs, and switch (but keep the batteries and ATtiny85 inserted), trim off the excess circuit board, and place the completed circuit into the back of your Starman!
For the LEDs, I've soldered on each pin about an inch of thin insulated wire. Also, if your wires are too thin, go ahead and solder a tiny piece of slightly-thicker tin bus wire to the ends of the LED's wires, so that they stay snug in the female header pins. If there's an excess of wire from the speaker, then either trim them down or wrap it around the circuit when placing it into the Starman. Cut about 3 inches of thin insulated wire and solder then to the tactile pushbutton (diagonally -- refer to my photo). The button and its wires will go on last, as it requires further assembly of the LEGO portion before being sealed off.
Common electrical problem: the ATtiny has a primary ground pin (pin 4), but pin 3 can act as a ground pin as well, yet pin 3 is reserved for the first LED. Since the first LED on pin 3 is grounded to the battery's ground terminal, this completes the whole circuit, but since the ATtiny is only partially grounded, it's as if your circuit is in a series instead of being in parallel, hence the LEDs will be dull and the sound is quiet -- making it seem as if your batteries are dying. In addition to pin 3's LED being properly grounded, always ensure the ATtiny85's pin 4 is grounded as well -- this makes the circuit truly complete, and the sound/lights function as intended. In other words, the ATtiny's 8th pin goes to positive, the 4th pin goes to negative, and the other pins connect to their respective components (which ultimately lead to ground as well). When I made the first circuit, I forgot to solder pin 4 to ground, thus my circuit functioned -- but rather dull and quiet, which led my initially to believe either the batteries were duds or that I improperly made the connections.
Step 4: Assembly
With your small circuit complete, next you can insert the piezo speaker into the proper slot (the piezo is non-polarized, hence the wire colors don't matter), then place the module into the back of the model with the back exposed (see photos). The piezo speaker's front hole should face up against the Technic hole for sound output. On the LDD file, you'll see a small red LEGO cone with a plate above it in the area above where the speaker should go: this is an optional addition to keep the speaker in place, although if your circuit is built to size, the circuit with speaker should stay in snugly. Then place the two LEDs in the proper spots on the header pins, and use some needlenose pliers to carefully place them in if need be. Gently push the LEDs into the two Technic holes corresponding to the star's eyes; dome-shaped straw hat LEDs ought to stay in place. On the sides of the back of the star's eyes (as seen in the LDD file), there are two red LEGO modified tiles: these are optional, and were placed there to keep the two LEDs from falling out of place. Feel free to add any pieces you feel necessary to hold the LEDs firm into the eye sockets, and you can even use tape or hot glue if you'd like. I personally went with the quick route and used those two LEGO pieces to brace the LED's wires securely.
On the back of the star's head is where the 4x3 grille thing (from your LDD file) should go, as shown in the first photo. The grille tiles will successfully hold in place a small tactile switch's claw-like legs, which should have the two wires soldered to them. Snake the wires through the grille and down into the back of the model, and use some needlenose pliers or tweezers to guide them into the female header pins. The tactile switch is also non-polarized, which means either of the wires can go in the two female header pins on the right, as +/- doesn't matter (it only matters that at least one wire is connected to the ATtiny's 5th pin, and the other to ground). Everything should be well attached, so give the button a press to see it blink and make sound!
Remember: any two metal components on a circuit that unintentionally make contact with each other will short out the circuit. For instance, if the anode and cathode of the same LED were to get too close and touch each other, the lights would go off. If the speakers have exposed wires which are too close to the switch's potential exposed wires, the circuit will fail. Always be sure to use insulated wire where possible and to ensure any exposed wire is properly covered. In my circuit in the photos, clearly my header pins have a lot of exposed wire from the speakers, LEDs, and switch, as I didn't have time to trim them before the photo shoot; to avoid short circuits, I've bent the wires away from each other, so that they won't come loose and jiggle around inside.
The "battery door" is a flat 4x10 LEGO plate with four 1x1 plates in the corner: this makes it easy to remove the battery door, whilst keeping it secure for the back. When the star is complete, you can place the flat plates on the back, and the final model ought to be functional and self-contained. If anything comes loose and jiggles around, always take the back off and examine what you did wrong: perhaps you made the circuit board too small, which isn't held firmly in place enough, in which I'd recommend stuffing the inside with some various plates and bricks to hold the circuit/wires down snugly.
Step 5: Yes, I AM INVINCIBLE!!!
Since only the black LEGO bricks/sprites is semi-mandatory for the bulk of each model, you're free to deviate with the color schemes, eye colors, and LED colors as well -- and you can even mess with the Arduino code to play different melodies from the Super Mario franchise (or any song, really, assuming you can convert notes to tone)! These four designs are basic ideas I've come up with; the rainbow model being the "special edition", and a highly-praised model according to my Instagram followers! You can make a solid white star for closer game-accuracy, or perhaps a solid black star with red eyes -- it is of course almost Halloween time!
Feel free to ask any questions where applicable if you run into any problems with either the LEGO construction, the Arduino code, or the electronic soldering. Also go ahead and share in the comments section your completed Starman models, to display your talents and to show off any changes/improvements you've made!
-Baron von Brunk
Design, photography, video editing, and electronic work by Baron Julius von Brunk
LEGO® is a trademark of the LEGO Group
Super Mario Bros.® is a registered trademark of Nintendo
"Starman" and "Coin Heaven/World 5 "Sky Land - Sky" composed by Koji Kondo, arranged by The Deku Trombonist (via NinSheetMusic)
Participated in the
Participated in the
Halloween Decor Contest
Participated in the
8 years ago on Introduction
These are cool!
Love the photos too, so nice and clear. Great work!
6 years ago
I was thinking about combining your arduino/guts +lights & sounds with this instructable for a vinyl/plush Starman Tree Topper...
I could stick with just two LED's, but I was thinking it would be pretty sweet to make a 5-sided internal frame and make it with (5) lights, one near each point...can you offer any suggestions about how to accomplish this. Are there any pitfalls you see with this? I might just stick with the (2) lights that are used in your design and the topper's.
Reply 6 years ago
Yes, it's possible to have five separate LEDs. I'd recommend having five
LEDs combined together in a parallel array. You can leave the 2nd "eye"
LED connection empty, then just have the five LEDs connected in a
parallel circuit coming from the 1st "eye" connection (the ATtiny85
pin). Please refer to the attached image: where it says "6V", that
should be the ATtiny85 pin of the 1st "eye" -- all five LEDs would then
be attached together in parallel (not series), then with resistors
attached to their cathodes, which then attach to the ATtiny85's ground
Reply 6 years ago
8 years ago on Introduction
OH MY GOSH SO COOL! :D :D :D
Three thumbs up!
8 years ago
Wow u should really teach me in real life
8 years ago on Introduction
I love it! This is a perfect project for an ATtiny, and the invincibility granted by Starman makes everyone happy! I would make it into an alarm clock for a kid. :)
8 years ago on Introduction
So cute. Great Instructable!