A semester design project for Mechatronics Lab (a joint venture between myself and B.L.) has resulted in the successful construction of a working mechatronic system. Here, The project goal for this Lab project was to create any type of
interactive machine in which mechanical actuators are controlled by
circuitry. Our project, the “The Metronome Hear-O,” is such a design.
Most easily described as a cross between the popular video game Guitar Hero, and a metronome, thrusts the player into a thrilling game of skill. In starting a new game, the machine first sets a visible tempo by the action of a sequentially illuminated array of 10 LED’s and a ‘ticking’ sound. Then, as the player tries his best to ‘tap’ in synchronization with the metronome, he is either rewarded by a playful dance of colors and progression to more difficult tempos, or he loses the game and is notified by a buzzer. Of course, the Metronome Hear-O is also a fully functional metronome which operates at a user selected tempo. This project was based on the Arduino microcontroller platform.
Our early project ideas showed wildly varying influence, and sought to improve any
number of supposedly cumbersome ‘household tasks.’ These included the Automatic Straw, the
Bacon Cooking Alarm Clock, and the Bacon-Cooking Hairdryer. However, the simplicity and
elegancy of a metronome (and game) was immediately appealing.
The original metronome concept was based on a stepper motor which would direct a
metronome ‘wand’ back and forth. Unfortunately, this required precise motor control, and
possibly closed-loop feedback. We considered many alternatives to this, before arriving at a
more flexible method for recreating the behavior of a metronome using the Arduino.
By wiring 10 LEDs directly to the Arduino’s digital output pins, we were able to control
the speed and direction of the metronome’s illumination sequence in programming. This cleaner
approach has the advantage of offering precise timing and control as well as simple debugging.
The biggest problem in the build was not programming or physical construction, but rather, circuitry. Because the game is interactive, it must be able to listen for a user's 'clap' or the snap of a finger as the player's tempo. All such noises are recognized by the microphone (lower right of breadboard below). However, the microphone, as a transducer, produces a very slight and erratic voltage output. It is neither clean nor the desired 3-5V signal that the Arduino is listening for.
With much help from teammate B.L., the solution was found with digital logic. Specifically, a 'flip flop' gate. As before, the microphone outputs an erratic voltage spike at the instant a semi-loud sound is registered. Instead of heading directly to the Arduino, this signal is directed to a flip flop switch. This gate is not as picky, and if it sees an impulse it flops from its default position of FALSE to a TRUE.
As the Arduino is running its game program, it intermittently checks the flip flop to see if a noise has been made (switch reads TRUE and is represented by a nice 5V). The Arduino rewards the player with lights and sound or a buzzer depending on whether the noise should have been made at that time and quickly resets the flip flop to its default FALSE. In our implementation, the Arduino looks at the flip flop to see if it has been triggered at a rate of 20 times per second.
Microphone does not have to be producing a voltage at the instant the Arduino is looking for it, merely within some specified time frame leading up to (i.e. 50ms).
Microphone does not have to produce the 5V that the Arduino prefers, but rather the minimum that the flop flop needs.
Microphone can produce poor and noisy signal. Any spike will trigger the flip flop.
Logic chips are a cheap solution to an otherwise difficult problem.
Programming is simplified.
The housing was designed in CAD software to be laser cut mostly from 1/8" gray tranlucent acrylic.
The metronome's light 'wands' or light tubes were created by chamfering and sanding the ends of a solid acrylic rod to catch LED light pointing upwards from below. In order to ensure the LED's stay put, the rods were drilled out approx 3/8" such that the LED's could be slid in snugly.