For my microcontroller project I chose to make a metronome. The LCD screen displays the beats per minute of the current tempo, the volume level, the tempo name, and the time signature. The rotary encoder is used for modifying the tempo, volume level, and time signature. The tempo in incremented by 5 BPM each time, and the range is from 40 to 170 BPM. Updating the tempo will also update the tempo name associated to it. The user button is used to control the LEDs of the bar graph and the bicolor LED (whether they are on or off). For every beat, the loudspeaker plays a short beep, and the bicolor LED blinks (red for low beats, green for high beats). The device runs on batteries, but can also be plugged in to a separate power source via micro USB. When plugged in, the LCD backlight turns on.
Front view | Back view | |
The board implements the following components:
Schematic | Assembly | |
Software for the metronome was developed using PSoC Creator 4.0 in C. The software contains a list of clock period values for each corresponding BPM that is used to trigger an event (such as a beep from the loudspeaker). The device listens for an interrupt either from the timer component or one of the two buttons. If the interrupt is from the timer, the bar graph updates and the device checks to see if it should change the beep frequency, play a beep, or blink the bicolor LED according to if it is a "low" accent or "high" accent. If the interrupt if from a button, the device checks to see which button has been pressed (either the user button or the rotary encoder button), then sets a flag accordingly.
Block diagram |
Pressing the user button will result in activating/deactivating the bar graph and bicolor LED (in the order both on -> bar graph only -> bicolor LED only -> both off). Pressing the rotary encoder button will cycle between selecting different settings that the user is allowed to update (n the order: BPM -> volume level -> time signature). Turning the rotary encoder will change the state of either the BPM, volume level, or time signature according to whichever setting is selected with its button.
I was really satisfied by the way the project turned out. This was my first attempt at a project where I had to make choices about which hardware to use and then program it. Though I wasn't so confident with my abilities at first, I felt learned a lot and made a lot of progress during the course of the semester. Overall, it was a very fun and very rewarding experience.
Last modified:Mon, Jan 23, 2023.