Intel Edison Metronome
In the world of Arduino and other micro-controllers, the first thing you do is the obligatory "Hello World" program. In this world, the "Hello World" is the blinking LED. That is how the whole thing started; it was just a blinking LED. As I played with the code, it turned into something a bit more; it turned into a visual and audible metronome.
Here are the parts:
- Intel Edison with Arduino board
- Seeed Studio Base Shield (mine is V2.0)
- Grove LED socket kit (V1.3)
- Grove Buzzer (V1.1b)
- Grove Rotary Angle Sensor (pod V1.2)
- Grove LCD RGB Backlight (V2.0)
- Battery for external power (optional)
Before I could get this to work, I had to download the LCD library. I was able to track this down at this URL:
https://github.com/Seeed-Studio/Grove_LCD_RGB_Back...
When I downloaded it as a zip file so I could install it into my Arduino IDE, I had to change the name by taking out the "-" in the name as it is not an acceptable character for the IDE. Once I did that, it installed just fine.
Connecting the Components
Using the Grove system, it is easy to get all of the components connected to the Base Shield. Using the Grove connector wires:
- LED plugged into socket D4
- Buzzer plugged into socket D3
- Pod plugged into socket A3
- LCD plugged into one of the I2C sockets
The CODE
Here is the code that I have written that will blink the LED, buzz the buzzer, change the tempo based on the pod setting, and display the tempo on the LCD. When the pod is set low enough, the metronome will turn off and stop blinking and buzzing until the pod is turned back up again.
Here is the code:
Downloads
Run the Program
Once the code has been uploaded into the Edison, you can switch to battery power if you want to be portable. As the program runs, the tempo is flashed and buzzed out in 4/4 with the first beat getting a louder buzz than the other three.
I have codded this to do tempos at the nearest 5 bpm. When turned down to 50 or lower, the metronome will stop flashing and buzzing. The LCD will show "OFF". Once the pod is turned back up, the flashing and buzzing will resume.
Make Your Own Modification
Now make some changes. Have the LCD back light change color with each beat. Add a second pod or button to control the time signature from 4/4 to 3/4 or 2/2.