Bio
I am Sam Grusky-Milin, a rising senior at Urban high school, and I attended BlueStamp for the first time this year. I have always been interested in technology and have been exploring the world of computers for as long as I can remember. I have taught myself several programming languages and paradigms, but until now I have had little experience with lower level electrical engineering. To remedy this, I decided to attend BlueStamp, and combine my interest in physics with my interest in logic and programming, as well as my interest in music. I eventually plan to take the skills I have acquired into the field of computer science, specifically working towards the development of practical artificial intelligence algorithms that mimic and ultimately augment human experiences.
Reflection
When I began BlueStamp, I thought I would enjoy the programming aspect of my project more than its electrical engineering challenges, however I found that I enjoyed both sides of the route to my project’s completion. I still believe that I will pursue a career in computer science rather than engineering, however working with component level design has helped me to understand the practical side of designing algorithms.
Final Project
Description
My final project was a box with a musically controlled lock, which unlocks upon hearing the correct tune. The main components of this project (beside the box itself), are an ATMega328 microcontroller, an HS-311 Servo Motor, an electret microphone, and an LM358 Operational Amplifier. The ATMega monitors the microphone input, and determines whether the melodic key has been played. If so, it tell the servo to pull back the locking mechanism, and the box can be opened. When the lid is closed again, the box re-locks itself.
Challenges
The first challenge I faced when constructing this project was the lack of adequate documentation from the original creator. His circuit design was extremely convoluted and several of the components he listed in his bill of materials were no longer in existence. It took me several days to figure out which components I actually needed. Once I had enough components to begin building, I first worked on configuring my ATMega to use an external oscillator, which would eventually be necessary for taking accurately spaced measurements from the microphone. I had to learn to set the fuse bits on my ATMega, and while doing so I learned to decipher the manuals for ATMega microcontrollers. The next challenge was to program an algorithm to quickly compute single components of the Discrete Fourier Transform of the microphone input (the magnitudes of specific frequencies), which is necessary for melody detection. The algorithm I used is called a Goertzel Filter, which is described in detail here.
The next task was to assemble the mechanical components of my circuit, namely, the servo. The original servo I ordered was dysfunctional, so I had to use a higher powered servo which happened to be lying around the BlueStamp component boxes. However, this servo drew too much current away from my ATMega, which consistently set off the on board Brown Out Detector (BoD), resetting my entire circuit. After much confusion (at the time the BoD was only a hypothesis), I fixed this problem by adding a large decoupling capacitor to my main power line. Once the servo control was working I connected the code for my servo control to the code for frequency detection, and tried to control the servo with a melody (from Close Encounters of the Third Kind). However, the notes in this melody were too harmonically related, and had overlapping overtones which confused my note detection algorithm. After a lot of work trying to fine tune the tolerance on my algorithm to get around this problem, I decided to change the key to Greensleeves. With the new key, the project worked, and was ready to be locked for the first time.
Documentation
Final Video
Source Code
Click here to see the source code on GitHub
Schematic
Note: Resistors two and three should be valued as to set the output of U1 equal to the neutral voltage of the microphone
Bill of Materials
Click here to see the Bill of Materials
Second Milestone
My second milestone was to successfully configure my ATMega to control an analog servo motor. Here I show it responding to a button connected to one of its digital input pins. There were several obstacles I had to overcome to find a servo that would work for my project and to connect it to my ATMega without setting off the Brown Out Detector and causing a system reset. I eventually solved this problem with a 470μF decoupling capacitor. Next I will be working on connecting my servo control code and my melody detection code to realize the “musical lock.”
First Milestone
Here I demonstrate the initial functionality of my implementation of a Goertzel filter. A Goertzel filter is a specific type of infinite impulse response filter designed to efficiently compute one component of a Discrete Fourier Transform. In simple terms, it is an algorithm to detect the magnitude of a specific frequency in a signal. It will be useful later for detecting entire melodies. In the video below I show an ATMega programmed to run a Goertzel Filter and responding to input from a function generator.
Starter Project: MiniPOV
In the first two days of BlueStamp this year I completed my starter project, a miniature POV (Persistence of Vision) device. A POV device creates the illusion of images or text by displaying one vertical slice of the image/characters at a time. As you move the device back and forth, consecutive slices of the image are displayed on an LED array. If the device is moved quickly enough, your brain will combine the slices into a single image. The components I used and my building process are explained in the video below:
Nice, Sam! Sounds like you remembered plenty of E&M physics!