* Team Name: Embedded Percussion
* Team Members: Mia McMahill, Madison Hughes
* Github Repository URL: https://github.com/ese3500/final-project-embedded-percussion
* Github Pages Website URL: https://ese3500.github.io/final-project-embedded-percussion/
* Description of hardware: Laptops (Win 10, Win 11), ATmega328PB Xplained Mini, Adafruit AW9523 GPIO Expanders, OPL2 Audio Board, Adafruit I2C Rotary Encoder Board
In a few sentences, describe your final project. This abstract will be used as the description in the evaluation survey forms.
This project is a drum machine with a 16-step sequencer and 6 instruments. The sequencer interface resembles that of Roland TR-x0x style drum machines, and the sound is generated by the Yamaha YM3812 FM chip. Additionally, it has a screen for managing settings such as tempo, volume, and tuning.
What is the problem that you are trying to solve? Why is this project interesting? What is the intended purpose?
I (Mia) love music and music technology, as well as the sound of the Yamaha FM synthesizer chips used in PC sound cards of the late 80s and early 90s. While this style of FM is not uncommon as a method for creating melodic sounds, there are very few drum machines using it to generate percussive sounds, rather than other methods such as sample playback or analog circuitry. The goal of this project is to create a drum machine with a familiar interface in the style of the Roland TR-x0x series with the sound of a Yamaha YM3812 FM chip.
These are to help guide and direct your progress.
By the end of the project we would like to have a 16-step drum machine with 6 instrument channels and a screen for displaying settings. We plan to have 6 buttons for selecting the current channel. 16 LEDs aligned with the 16 step buttons will indicate the active steps for the current channel, as well as the current step when the sequencer is running. When no channel is selected, by pressing the button for the most recently selected channel again, the screen should display global settings including, at minimum, the tempo. Otherwise, settings for the selected channel, such as tuning and volume, should be displayed. We plan to use a rotary encoder with push button to navigate the on-screen settings.
Formulate key software requirements here.
Using I2C and SPI, the ATmega328PB shall interface with the OPL2 Audio Board, GPIO expanders, and LCD screen. The software shall keep track of active steps in a sequence, looping over the 16 steps and triggering sounds to be generated by the YM3812 in accordance with the active steps. It shall allow users to modify tempo of the sequencer, the active steps, and tuning and volume of the 6 instruments. At startup, it shall configure sounds on channels 1-6 of the YM3812.
The users for this device are musicians who want to create 16-step looping drum tracks.
step — units representing the sixteen 16th notes of a 4/4 measure
active step — For each of the 6 instrument channels, a step may be active or inactive. If if a step is active for a channel, when the sequencer reaches that step, the sound of that channel will be played.
SRS 01 — When no channel is selected, users shall be able to use an on-screen menu to set a tempo in a range of 60-300 BPM.
SRS 02 — The software shall use a PWM timer with a frequency of
SRS 03 — When the sequencer is running, for each step, for each channel for which that step is active, a sound corresponding to the channel shall be played by the YM3812.
SRS 04 — Users shall be able to start or stop the sequencer at any time. Playback shall always start from the first step whenever the sequencer is started.
SRS 05 — Users shall be able to change the current instrument channel as well as set the active steps for that channel at any time.
SRS 06 — Using an on-screen menu, users shall be able to modify the tuning and volume of the current instrument channel.
Formulate key hardware requirements here.
The hardware of the design will consist of a series of buttons with various purposes interfacing with the microcontroller, a screen and the synthesizer.
OPL2 - Operator Type L 2, another name for the YM3812
HRS 01 — ATmega328PB will be the main microcontroller for this design
HRS 02 — An adafruit GPIO expander to expand the amount of available pins/registers we have access to
HRS 03 — 16 pushbuttons to represent different notes in a measure
HRS 04 — 6 more pushbuttons to represent types of drums
HRS 05 — 1.8” 128x160 TFT LCD module to display the tempo, volume and the current drum setting
HRS 06 — OPL2 Audio Board using a Yamaha YM3812 sound chip with SPI interfacing for audio synthesizing
HRS 07 — A rotary encoder for controlling the screen menus and the volume
By the first demo, we aim to have all of our features implemented. This way we can leave the fine tuning and the polishing for the last week. This means all of the software and hardware will be implemented and complete, including but not limited to all buttons, knobs and switches. Any extra features we many have time for may or may not be completely implemented at this time
For the final demo, we will have our full project. This means that since the first demo we will have the entire casing for our design completed (will be 3d printed). The project will be in its full and polished versions. Any extra features that we may have time for will also be implemented during this time and at this point.
What is your approach to the problem?
First we plan to focus on connecting the buttons, LEDs, and screen, and making sure we understand using I2C to communicate with the GPIO expanders. Then we will divide up tasks for writing the sequencer firmware and a library for communicating with the OPL2 Audio Board. The interface for the YM3812 library will consist of a function that take in a pitch and a channel and trigger the sound that has been configured on the given channel at the given pitch, as well as a function that sets the volume of a channel. Additional functions to modify the sounds will be added if there is time.
What major components do you need and why?
We plan to use an ATmega328PB as the brains of our device as we have the most familiarity with it, and its specifications match our requirements: 2 SPI buses, I2C bus, and 16 bit timers.
We need the current tempo to be displayed, and would like to potentially display other information. We plan to use this screen as we already have it.
A drum machine requires some method of producing audio. The YM3812 was a widely used chip in PC sound cards and Yamaha keyboards, so it's use for generating musical sounds is well established. It provides 9 instrument channels that can be used simultaneously, fitting our goal of having at least 6. This board provides a serial interface for the chip, as well as incorporating the necessary DAC and timing circuitry required to use it.
Most step sequencers use a row of 16 buttons and LEDs, with the LEDs used to indicate the active steps. Adafruit's step switches conveniently contain both a push button and an led in one casing, providing both components as well as being aesthetically pleasing.
This project will require many buttons (~25) and LEDs (16). The ATmega does not have enough pins to directly connect each of these, or to wire them in a matrix, so by using a pair of I2C addressable GPIO expanders, we will be able to have enough pins to wire all our peripherals to the MCU.
What is your metric for evaluating how well your product/solution solves the problem? Think critically on this section. Having a boolean metric such as “it works” is not very useful. This is akin to making a speaker and if it emits sound, albeit however terrible and ear wrenching, declare this a success. It is recommended that your project be something that you can take pride in. Oftentimes in interviews, you will be asked to talk about projects you have worked on.
Our metric will be made up of the 2 halves below:
For the sequencer aspect of this project, the interface (buttons, LEDs, and on-screen menus) should be responsive, with no noticeable delay between input and updating the displays. The tempo should be adjustable in a range of ~60-300 bpm. The tempo should not be inaccurate, and the adjustment should not be too coarse (increments of >4). When it comes to programming the steps and starting and stopping the sequencer, either it works or it doesn't.
The minimum for this part to be considered working at all is for some type of sound to be outputted in accordance with the sequenced step pattern. To meet our goals, each of the sounds should be tunable and have adjustable volume. More subjectively, the sounds should be pleasing and resemble actual drums (bass, snare, hi-hat, etc.).
This section is to help guide your progress over the next few weeks. Feel free to adjust and edit the table below to something that would be useful to you. Really think about what you want to accomplish by the first milestone.
| Week | Task | Assigned To |
|---|---|---|
| Week 1: 3/24 - 3/31 | finishing design and buying parts | Madison and Mia |
| Week 2: 4/1 - 4/7 | assemble OPL2 board | Madison |
| OPL2 library | Mia | |
| Week 3: 4/8 - 4/14 | button and led gpio expander interfacing | Madison |
| write main sequencer code | Mia | |
| Week 4: 4/15 - 4/21 | rotary encoder and complete functionality testing | Madison |
| on-screen UI | Mia | |
| Week 5: 4/22 - 4/26 | case design and production | Madison |
| software bugfixing and polish UI | Mia |
Add your slides to the Final Project Proposal slide deck in the Google Drive.
Don't forget to make the GitHub pages public website! If you’ve never made a Github pages website before, you can follow this webpage (though, substitute your final project repository for the Github username one in the quickstart guide): https://docs.github.com/en/pages/quickstart
On YouTube (placeholder til recording final video)
On Github Pages
What were your results? Namely, what was the final solution/design to your problem?
Our final design was what we had envisioned from the start. It is a laser-cut acrylic enclosure containing the electronics, with 23 buttons, a rotary encoder, a screen, sync jack, and the OPL2 accessible from the top panel. 16 of the buttons have integrated LEDs to display information about the drum pattern and playback, while the other 7 are unlit. It allows for the creation and playback of 6 channel, 16-step drum sequences, with the ability to modify 4 per channel settings, as well as global tempo control.
Based on your quantified system performance, comment on how you achieved or fell short of your expected software requirements. You should be quantifying this, using measurement tools to collect data.
SRS 01 — When no channel is selected, users shall be able to use an on-screen menu to set a tempo in a range of 60-300 BPM.
SRS 02 — The software shall use a PWM timer with a frequency of
SRS 03 — When the sequencer is running, for each step, for each channel for which that step is active, a sound corresponding to the channel shall be played by the YM3812.
SRS 04 — Users shall be able to start or stop the sequencer at any time. Playback shall always start from the first step whenever the sequencer is started.
SRS 05 — Users shall be able to change the current instrument channel as well as set the active steps for that channel at any time.
SRS 06 — Using an on-screen menu, users shall be able to modify the tuning and volume of the current instrument channel.
Our final design meets all software requirements. Our requirements changed slightly over time due to the timing needs of the serial interfaces and the sequencer. SRS02 was updated accordingly. Additionally, we made it possible to modify tempo at all times, rather than only when no instrument channel is selected (it is also not possible to not have one selected), slightly differing from SRS01.
Testing the majority of the requirements were tested just by using the device, as whether or not they are met is easily perceived without measurement tools.
The frequency of the signal on the sync port was measured using an oscilloscope to test SRS02.

Based on your quantified system performance, comment on how you achieved or fell short of your expected hardware requirements. You should be quantifying this, using measurement tools to collect data.
HRS 01 — ATmega328PB will be the main microcontroller for this design
HRS 02 — An adafruit GPIO expander to expand the amount of available pins/registers we have access to
HRS 03 — 16 pushbuttons to represent different notes in a measure
HRS 04 — 6 more pushbuttons to represent types of drums
HRS 05 — 1.8” 128x160 TFT LCD module to display the tempo, volume and the current drum setting
HRS 06 — OPL2 Audio Board using a Yamaha YM3812 sound chip with SPI interfacing for audio synthesizing
HRS 07 — A rotary encoder for controlling the screen menus and the volume
Our final design meets all hardware requirements. No changes were made to our hardware requirements over the course of the project.
Reflect on your project. Some questions to consider: What did you learn from it? What went well? What accomplishments are you proud of? What did you learn/gain from this experience? Did you have to change your approach? What could have been done differently? Did you encounter obstacles that you didn’t anticipate? What could be a next step for this project?
Mia: I think the primary thing I learned is the importance of spare components. We had one of our GPIO expanders, and many of the LEDs in our buttons, break, and we were saved by the parts being ordered twice by the Detkin staff. When our encoder broke, and we had to wait after putting in a new order, it delayed getting that aspect finished until a few days before the final demo. Other than some issues with broken components, just about everything went well. In my opinion, we achieved exactly what we set out to do, with the final device having all planned features and functioning very reliably. One unexpected (well, somewhat expected) issue was that the slowness of drawing characters to the LCD necessitated a minor change to the design of the GUI. Instead of changing it entirely for the tempo selection, I added the tempo to be displayed on the per-instrument screens, and removed the global settings screen. This was a simple change though that didn't affect anything else. With the fact that everything works so reliably and the number wires are becoming unmanageable, I think a good next step (that I plan on taking) would be to design a PCB to make the hardware more compact and easy to manage.
Madison: I think I am very proud of how the project turned out. I think we did really well with time management and worked very steadily up until the last day. We ended up therefore neveer feeling very crunched with time. The only thing that ended up being very stressful was (like Mia said) some of the components breaking and us needing to fix them kind of last minute. I think in the future I would have liked to work on the casing a bit more and get it to be a little bit better functionally and stylistically. Other than that, I was pleased with the electrical components/systems and work that we were able to do. I would love to do more work with creating music machines like this like perhaps a keyboard. It reminded me of the far reaching impact of the field of electrical engineering and how it is present and could be used to impact all different aspects of life.
Fill in your references here as you work on your proposal and final submission. Describe any libraries used here.
Adapted the Arduino OPL2 library to bare metal C:
https://github.com/DhrBaksteen/ArduinoOPL2
Referenced Adafruit Seesaw library when implementing the encoder functionality:
https://github.com/adafruit/Adafruit_Seesaw/tree/master
You can remove this section if you don't need these references.
- ESE5160 Example Repo Submission
- Markdown Guide: Basic Syntax
- Adobe free video to gif converter
- Curated list of example READMEs
- VS Code is heavily recommended to develop code and handle Git commits
- Code formatting and extension recommendation files come with this repository.
- Ctrl+Shift+V will render the README.md (maybe not the images though)