These little power-ups contain blinking eyes and a little melody which plays when tapping the button behind their faces. They’re based on sprites from the Super Mario Bros. franchise — namely Super Mario Bros. 3 and Super Mario World — but with my own deviation for custom color schemes in some cases. The audio is generated via the Arduino tone library: the tone library is a code function which basically generates beep sounds, but with specific beep sounds tuned to a specific frequency assigned to a real note of the musical scale. In the Arduino code for each model, I’d type out portions of Super Mario songs from sheet music, corresponding to their respective notes. Then in synch with the audio notes are dual blinking LEDs. Each model — both Starman and Mushroom — uses standard LEDs, whilst the special rainbow variant Starman contains color-changing LEDs which cycle through random colors. Three of the four stars play the Invincibility Theme music, while the fourth star [Rainbow] plays a segment of the Coin Heaven music from Super Mario Bros. 3. As for the Mushrooms, all three green ones play the standard Super Mario 1-Up sound effect. Two of the red ones play a segment of the Overworld Theme from Super Mario World, but the third one (the one with its colors inverted) plays the Airship Clear music from Super Mario Bros. 3; the mushroom’s color scheme is mainly white with red dots, as seen in the sprites from said game — whereas the mushrooms in later Mario titles inverted the mushroom sprites to red with white dots.
In spring 2014 as I was painstakingly making changes to my DL-44 Blaster Pistol, I had a ton of ideas for cool electronic LEGO creations using LEDs and Arduino codes. With the Super Mario Bros. franchise being one of my core themes for making references to, I decided to make an electronic LEGO project of that theme, using the same technology as my Blaster Pistol. The very first idea I came up with was making a 3-D LEGO Mario mushroom — essentially like the final mushrooms seen here, but built completely different, such as to be larger and to have multiple LEDs blinking throughout (as opposed to the mere two eyes). The final mushrooms and stars seen here are only about as tall as a Samsung smartphone — whereas the conceptual electronic mushroom was supposed to be a little bit larger. Also instead of the tactile button on the back of each unit, I wanted to have the mushroom to be spring-loaded, and would thus activate its light/sound function by pressing down the mushroom’s head to its stem. I’ll be completely honest in saying my primary reason for creating this project was to win the attention of a girl I liked at the time: my idea was to build an electronic LEGO mushroom, then discreetly present it to her in a box with instructions to press down on it, but with no sender on the box — and leave the box at her birthday party. My idea was that since she knew me as “the LEGO guy”, she’d open the package, become dazzled, and immediately know who gave it to her!
As I was boarding a LIRR one afternoon in summer 2014 thinking about this idea, I thought to myself, “What happens if she finds the package, sees the instructions to ‘press down’ and assumes it’s a bomb?” Hmmmm, well, that got me thinking some more. I know: in addition to the instructions, I’d also include a blurb on the note which reads, “IT’S NOT A BOMB!” Brilliant, Julius: send a girl a mysterious package with a note that says it’s not a bomb. Great idea, especially in a post-9/11 New York; that’ll go over real well. Totally.
Teaser update on Facebook to hint at my forthcoming creations!
Well, anyway, I completely scrapped the idea of giving it as a gift to some girl. In retrospect, she didn’t even really like me as a person, let alone as a potential partner, so I decided best not to even waste my time, money, and effort with giving her one of these trinkets. In addition, my entire summer 2014 was preoccupied with making the Mk.II Blaster revision, hence I put the entire electronic mushroom project on hold until August of that year. By the time the Blaster Mk.II revision was finally done at the end of summer, I immediately picked back up where I left off and started writing up Arduino codes for Super Mario melodies. With the acquired experience of electronics and coding that I developed from pouring in countless hours of completing the Blaster Pistol, making these little trinkets was actually rather smooth in comparison. In fact, the most difficult tasks were making accurate music and programming the LEDs to function in synch. Unfortunately, since the Blaster used an ATmega328 as its microcontroller (the precise microcontroller used in the Arduino), any codes written to the prototype in the test runs didn’t have to be modified accordingly. However, the Mario blinkies use a smaller model known as as the ATtiny85 — which has fewer pins and configurations, thus the Arduino codes have to be written to reflect their differences from the ATmega328. In other words (without confusing you with electronics jargon) when writing a code on the Arduino and ultimately transferring it to the ATmega328 on a breadboard, no changes should be made, as the ATmega’s pins correspond verbatim with the Arduino. On the ATtiny85, when writing code on the Arduino I’d test it out on the unit, but before transferring the data to the little chip I’d have to write a special call function to convert the Ardunio’s pins to match those of the ATtiny85. Again, it was no big deal, really, but it took a learning curve to get used to as opposed to the Blaster.
In all honesty I wanted to play sound clips or midis from the little blinkies. Unfortunately, both file types require sufficient storage space, whereas the ATtiny85 simply has 8KB of memory available — this is the same reason why I was unable to transfer Han Solo’s blaster sound effect to the chip of my DL-44 (as mentioned in that article). With the Arduino Melody and Tone libraries, even an entire song can be a few kilobytes; the whole song simply consists of dozens of lines to call out which beep sounds of the Arduino correspond to real musical notes. And because space inside each model was limited, the ATtiny85 and Arduino beep tones were the best way to go. Using midis and sheet music from this website, I was able to find the songs I needed and convert them into Arduino music notes. Some of them were tricky to use, as they had notes that I had to tweak myself for better accuracy, and of course it took a while to tinker with the tempo and beats. The 1-Up noise was the easiest, and the Super Mario World theme was the most difficult; in fact, the latter had to be frequently revised and tweaked to have the notes in its library adjusted for its 1/4, 1/8, and whole note durations, so that the song would be true to the game and not sound awkward.
The original code I based mine off of was a code I found for making a miniature musical/LED Robo-Santa from Futurama by John Montgomery. I used the author’s code, but made several changes where applicable, such as the variables for note durations, tempo, and of course for frequencies in the note library (I added some new notes which didn’t exist before, like G7, B sharp, et cetera). I even based the construction of my circuit similar to his, but with changes and improvements where necessary. For instance, in his project he mentions the sound from his piezo buzzer being on the quiet side, thus I overcame this problem by substituting the piezo buzzer for a small piezo transducer (speaker) which generated cleaner sound — and lastly I doubled the battery power by using two CR2032 batteries instead of just one, for 6 Volts total. The final creation had significantly louder audio and brighter LED blinking than my initial tests with just one battery!
I programmed the four Starmen chips and subsequently built four circuit boards over the course of a night. Each circuit uses female header pins so that pieces like LEDs and speakers can be easily removed. In my electronics, I dislike using permanent pieces, in case a part gets broken, so that it won’t be permanently soldered into the circuit. It happens more often than not where I’ll build a functional circuit and then for no reason whatsoever an LED randomly stops working. With interchangeable parts placed in female header pins, repairs are no major issue and troubleshooting is streamlined.
As you can see in the photos above, the whole circuit was shoved into the back of the model, and sealed up with LEGO plates. The actual LEDs had just about the right clearance to stay inside a Technic hole, hence the blinking eyes were kept in place by popping them through the backs of the holes, but also had some last minute LEGO pieces added to prevent them from sliding out. The tiny piezo speakers were thin, about the size of a penny — and could easily fit flat inside the model with its sound holes facing the corresponding outer grating of the model’s face — like a speaker on a radio. When completed, both sets of power-ups were posted on Instructables
Three of the Starmen — Gold, Glowing Yellow, and Ice Blue each use a melody version if the Super Mario Bros. Invincibility music along with monochrome eyes — whilst the Rainbow variant uses special color-changing eyes and plays the Coin Heaven music from Super Mario Bros. 3; it’s also a completely original pattern that I designed myself in LEGO Digital Designer, whereas the other three are almost verbatim to actual game sprites in terms of color and design. I chose to build the stars first, although I came up with the idea for the mushrooms several months prior. The reason being: early in this article I mention the prototype design of the mushroom to be large and feature a spring-loaded mechanism. I wanted to still use that idea, but since I hadn’t conceptualized its design and mechanical functions long enough to build a mockup, I decided to potentially build it eventually — but in the meantime, start off with making a simple flat Starman model. After all, a flat star shape couldn’t have any of that fancy spring-loaded stuff, thus it would pretty straightforward to make.
Earlier when I intended on making the big blinky mushroom model, I assumed it was possible to have dozens of LEDs inside the unit — as in, rather than having just the eyes light up, I wanted the entire front face to glow like a Lite Brite — akin to my mosaic LEGO sprite lamps. Unfortunately, the Arduino’s ATmega328 chip only has 28 pins, and a lot of which are incapable of controlling LEDs — as in, a lot of the pins are reserved for necessary electronic functions like power, ground, reset, clock, et cetera. As you know, LEDs can’t be connected in a series; they have to be connected in parallel, let they become progressively dim. I researched a technique known as Charlieplexing, which is a rigging of LEDs in a special circuit to exploit the limited number of pins in a microcontroller. Quite frankly, this idea seemed too elaborate and out of my level of skill during the time when I first broke ground for these models, hence I scrapped it and opted to simply make two blinking eyes. The ATtiny85 has even fewer pins — eight to be exact, and I believe only four of them have potential of being used for LED output.
Getting accurate music for the Invincibility Theme was also a challenge. The Arduino Tone library is only capable of producing one beep sound at a time, hence as far as I know it’s physically impossible to generate two different tones simultaneously for producing music in harmony. The actual music of the Invincibility Theme is played in three-part harmony of the exact same tune; in other words, it’s as if someone’s playing a piano and striking three separate keys of the same pitch each time when playing a note. When making my Arduino version of this, I eliminated two of the hamony pitches and played just the basic notes for the song. It sounded a bit monotonous, like one of these cheap Christmas cards or musical trinkets from A.C. Moore, but considering the cute kitschiness of these projects, I decided it was perfectly apt.
Although the Mushrooms were made after the Starmen, they were actually the original designs to be made first. In fact, I drew concept art and began making designs for the electronic Mushroom trinkets in spring 2014 alongside the DL-44 Blaster Pistol. As mentioned previously, I originally came up with the idea of the Mushrooms to be large and spring-loaded to be activated rather than having a button on the back, and since I wasn’t able to engineer a system for this at the time, I jumped the gun and built the Starmen first — with the Mushrooms immediately afterwards.
The Starmen were like a test to see if I could even pull of this project in the first place, hence I merely built four models and four circuits. After realizing how easy it was and how efficient it was to mass-produce these, I kicked it up a notch and built six LEGO mushrooms simultaneously, and made ten circuits — six of the ten circuits went into the models, two had malfunctions, and the other two were kept in case I wanted to build a few more shortly thereafter.
-Baron von Brunk