Lucid Projects

Blog - Day to day mumblings...
Eggmin Mario Remix

Eggmin Mario Remix

10 Oct 2019 - Jake Sherwood

eggmin theremin - 2 views
Eggmin Theremin - 2 Views

Eggmin “Theremin” Prototype - Mario remix

This has been an on going project for the last few weeks but it all started in week 4 PCOMP class.

In week 4 of PCOMP we played with hooking up a speakers to the arduino.

The later part of the class we worked with attaching a photo resistor to the circuit to modulate the frequency.

I thought it sounded really rad and almost like a mini theremin… I needed to play more with this.

But to my dismay I got a kit that didn’t have a speaker :( I’d have to wait.

I went home and ordered one from amazon.

First things first I had to reproduce the in class exercises. I had tried to follow / code along as much as I could but couldn’t be sure I had it correct until I got the speaker.

Fortunately, it was a relatively simple circuit and I had gotten it mostly correct in class.

Adding my speaker got me up and running relatively quickly.

first speaker test
first speaker test

A few days prior I had found a small green plastic container on the junk shelf. It caught my eye and I knew it would be good for something so I snagged it.

After getting the “faux”min working I thought, I would be really cool to cram it all in that small green ege. And thus the idea for the Eggmin was born.

My buddy Erkin helped me add a transistor to amplify the sound. Based on this Zhut youtube video. We also added a potentiometer to control the volume a bit more. It got really loud LOL.

I had a tiny RFduino from a project a few years ago. It was a very small footprint and even smaller than the Nano. It would have been great if I could have gotten it working. But unfortunately the company was purchase a couple years ago and most of the documentation and support were taken offline shortly after.

After a few failed attempts to get it wired up. I moved on. I figured I could get it to work with the Nano.

I also had a mini bread board so I wired up the circuit and the Nano all on one breadboard. I kind of worked but there it wasn’t really providing the theremin affect. Also multiple components were heating up so something was wrong with the circuit.

eggmin first minify attempt in enclosure
eggmin first minify attempt in enclosure

eggmin first wired housing test not working

The oddest thing was the exact same circuit with duplicate components on an Uno worked.

eggmin breadboard uno ldr theremin test

I scheduled office hours with David to try to work through the issues.

One good suggestion he had was to put the Nano on a separate breadboard from the rest of the components.

eggmin rework circuit and breadboard - uno and nano versions
eggmin rework circuit and breadboard - uno and nano versions

After a few attempts I got it working better putting the Nano and the rest of the circuit on separate breadboards.

I also added a resistor here and there to help with the heat issues. (arduino diagram).

eggmin rework circuit and breadboard more views - uno and nano versions
eggmin rework circuit and breadboard more views - uno and nano versions

Once I got it working a bit better I had the hair brain idea to add the Super Mario Theme music to the equation.

I found a great tutorial by Jorge Rancé here about how to play mario music with a pezio buzzer.

I was able to make some small tweaks to their code and reference the melody lab to get it to play the way I wanted.

I also wanted to use the LDR reading to modify the frequency of the Mario theme notes and remix mario.

Modulate Mario frequency but how

It was relatively easy to get going but I wasn’t 100% clear on how / why it was working the way it was. I could tell it was taking a reading and changing the frequency but it seemed some what random. Later I would understand it had to complete the for loop of the melody before it would adjust based on the LDR reading.

I knew I need to control what was going on so I decided to add a button.

I went to John Igoe’s button state sketch and got a few different cases set up to control what was going on. In doing so I realized it need to complete the melody for loop before it would adjust based on the LDR. I’d still like to figure out if there is a way to break out of the loop.

I got it working to the point of being able to change between the theremin, mario theme, and mario remix but I still couldn’t get it to work properly on the nano. The exact same sketch work on my uno but not on the nano.

Back to David for more help and he helped me debug it to find the bug with 0 in the melody array on the nano. Changing those to 1 fixed the issue and it worked on the nano.

Last thing to do was to try to get it all to fit back in the egg container.

That was easier said than done.

I had 2 breadboards, a 9volt battery, an arduino, a speaker and a bunch of other components to fit in there. It was a tight fit but I most got it.

I think testing 3 stack coincells in heatshrink and making my wiring more exact would allow it to fit nicely.

I was excited how one of my previous holes for the wire ended up pretty perfect for the push button switch.

Final Eggmin - Will it all fit?

eggmin arduino circuit
eggmin arduino circuit

categories: pcomp

join me on this crazy ride. enter your email:

contact [at] jakesherwood [dot] com

contact me if you'd like to work together