A digital metronome on PSoC.
Please read this first.

Ryan Paulson

Overview

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 (video).

Front view Back view



Hardware

The board implements the following components:

Schematic Assembly


Cypress PSoC CY8C4245AXI-483
  It contains ARM Cortex-M0 microcontroller along with some programmable logic and runs an embedded code.
Newhaven NHD-C0216CiZ-FSW-FBW-3V3 LCD screen
  The LCD screen uses an I2C interface to communicate with the CPU. It has two rows with 16 characters each per row.
Kingbright DC20/20YWA 20-LED bar graph display
  The bar graph consisted of 20 yellow LEDs aligned next to each other that were used to emulate the swinging of a pendulum.
CUI CVS-1508 loudspeaker
  The loudspeaker was used to make an audible beep in-time with the given tempo.
Bourns PEC11R-4215K-S0024 rotary encoder
  Rotary encoder is used to control the tempo speed, volume level, and time signature. Features a switch that is used to cycle between the three settings.
User button
  A simple button used to control whether the bar graph and bicolor LED are on or off.
Bicolor LED
  An LED that can switch between red and green (or both at once) based on which signals are active.
Programming connector
  Used to program the device.
Amplifier
  Used to provide enough voltage to the loudspeaker.
DC/DC boost converter
  Boots voltage up to 3.3v.
MOSFET battery switch
  Disconnects the battery when the device is plugged in to an external power source.
Step-down linear regulator
  Decreases the voltage from 5v to 3v when the device is powered from USB.



Software

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.



Final Thoughts

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.




Attachment.

Video of work.

Ryan Paulson, june 2017





Discuss on the forum



Feedback E-mail            Other electronics  Other electronics

Home
Home



Counter of vizits

digital metronome on psoc


Copyright © 2017 by Dmitry Dubrovenko.