This is one of those small, 1-2 evening projects. I was playing Super Mario Odyssey on Nintendo Switch (and highly recommend it if you haven’t played it yet), and decided to make a small prop.
I actually wanted to make a small contraption with sound for some time now, and kept looking around for am inspiration. So it happened – I made a “coin box”, the box Mario keeps hitting his head on hoping to get some extra cash 🙂
This is how it turned out:
Bill of materials
- Teensy 3.2 – Adafruit
- Teensy Feather Wing Adapter – Adafruit
- Music Maker Feather Wing – Adafruit
- Proto Feather Wing – Adafruit
- Speaker with 3.5mm jack (I used this portable speaker by Anker)
- Tilt switch, button, 10k Ohm resistors (x2)
- 3D printed box – so you’ll need a 3D printer, decent amount of yellow filament, and then some white or gray filament for the finishing details,
- Soldering iron, solder, wires, etc.
Making the box
First thing I looked for was, obviously, a box. Preferably model that I could 3D print. It’s easy to make this model really (since it’s just a cube/box with question marks and screws on the sides), but no point in re-inventing the wheel, so I checked on Thingiverse, and no surprise – there are plenty of models to choose from.
However, using free models found online always carries inherent uncertainty – did the author design all the piece for proper fit? How are the tolerances between parts? How will it come out on my 3D printer?
Hint: When designing a 3D model with various pieces that are supposed to all fit together, keep in mind that the filament expands when printing, and printed elements are generally larger than the original design. This may vary from printer to printer, but all of them are not great in holding the exact original dimensions. Thus account for that in the design, to leave some wiggle room and allow pieces to fit together (and save yourself some time from having to “carve” the prints by shaving bits and pieces from them until everything fits).
The particular model I decided to use (this one) unfortunately didn’t include this aspect in the design, but few minutes with xacto knife and a bit of super glue helped remedy that.
The box took approximately 14 hours to print altogether (11h for the main body, then few hours for question marks and “screws”).
And the result (after gluing all the pieces of the box together):
To detect the hit (box moving up/down suddenly), I used a simple tilt sensor. Depending on orientation of the installed component, instead of reacting to tilting left/right, we can detect sudden changes up/down, i.e. on hit from underneath to simulate Mario’s head bump 🙂
Interestingly, before I settled on Teensy (good I had one handy!), I tried using ESP32, also in form of Adafruit’s Feather. However, despite multiple attempts, I was unable to get this combination of ESP32 and Music Maker Feather to work – the audio was behaving correctly, but I wasn’t able to access SD card. I suspect some issues with chip select pin, but I didn’t get to the bottom of that, despite talking to official support on Adafruit Forums (link). They were helpful, but there’s only so much that can be done while assisting with an issue remotely.
In addition to the tilt sensor, I added a button to be able to test/demonstrate the behavior conveniently, and wired the tilt sensor through some headers+female wires, so if I want, I can quickly disconnect it to disable tilt sensor if desired.
Here’s a closer look at the electronics:
All components connected – speaker, battery, and “tower” of wings (top to bottom: Music Maker feather, Teensy, Proto Feather).
It was a quick, easy and fun project to celebrate completing Super Mario Odyssey (with 500+ moons so far 🙂 ).