Overview
As enthusiasts of audio, we aimed to use our recent understanding of microcontrollers to create an exciting consumer gadget. Our project is a drum machine that functions as a step sequencer. The user can create a 16-step percussion sequence with various percussion instruments on six separate tracks. The user switches between various music tracks and instruments and changes the tempo using a user-friendly interface with pushbuttons and an LCD screen. Settings can be stored and retrieved from the microcontroller’s EEPROM as well.
High Level Design
Rationale & Inspiration
Wikipedia writes: ”
A drum machine is a musical device that replicates the sounds of drums and percussion instruments. They are utilized across a range of musical styles, not limited to solely electronic music. They are also frequently needed when session drummers are unavailable or unwanted.
Nowadays, it is typical for drum machines to be solely software-based tools. Our device harkens back to a time 15-20 years ago when hardware drum machines were prevalent. Hardware drum machines of this kind were sizable, costly, and unwieldy instruments. Our device is a contemporary version of the traditional drum machine. It is affordable and has a user-friendly and straightforward interface.
Our reason for starting this project was to develop an entertaining and captivating electronic music device that could bring pleasure to those who are not musically inclined. Our drum machine has practical applications as well as being enjoyable. It could be utilized to enhance a solo performance, or as a tool for creating electronic music.
We were inspired by the Rhythm Ring, a Spring 2008 ECE 4760 final project by Brian Yung & Hanson Jiang. While we liked the sequencer idea of the Rhythm Ring, we wanted to improve the user interface to mimic an industry standard drum machine which offers a greater amount of control on the number of tracks and instruments to play back, the speed at which to run the sequencer, and the ability to save and load user generated patterns. While searching online, we found a more sophisticated drum machine that we really liked named the Beat707 which is Arduino-based. We based our user interface on their pushbutton and sequencer LED design which was more in sync with industry standard drum machines.
Concept
Our goal was to develop a drum machine inspired by the older hardware step sequencer drum machines from 15-20 years ago which are still in use today. The programming interface consists of a line or square of 16 pushbuttons, each corresponding to a different step in the musical bar. The sounds are arranged by the user through pushing the buttons, and the sequencer plays back the pattern as it cycles through the 16 steps.
Our design features only a single row of pushbuttons. The user selects one out of six available tracks (voices) to program at a time. LEDs positioned above every step show which steps are presently chosen. The LEDs show the sequencer’s progress by lighting up at the current step if it’s not selected in the pattern, and turning off if it is (XOR with the pattern).
An LCD control panel with pushbuttons for up/down/left/right enables users to modify the current track, pick instruments for each track, set the sequencer’s tempo, and store/retrieve preset settings. There are a variety of 20 instruments to choose from, ranging from traditional percussion like bass drums and snare drums to more modern electronic sounds. The speed can vary from 60 to 220 beats per minute (BPM). The MCU’s EEPROM can store and preserve up to 50 preset configurations, allowing the user to save them even when the power is off.
Three extra pushbuttons enable the user to control the sequencer, clear the current track, or reset the entire setup back to the default.
Our device plays back digitally sampled sounds at 22,068 Hz stored in the MCU’s memory. Audio playback is through a digital-to-analog converter (DAC) and fed to a 3.5mm mono audio jack that is designed to be connected to high-impedance computer speakers.
Logical Structure
From a logical standpoint, the MCU has two main responsibilities: playing audio and processing the user interface.
Just like previously stated, audio playback is achieved by having the MCU send audio samples to a DAC. The SPI serves as the connection between them, with ISR outputting samples on the MCU to ensure precise output at 22,068 Hz.
User interface processing is a significant task and requires the majority of the hardware and software. In order to reduce the number of I/O pins required, the 23 pushbuttons and 16 LEDs are connected to shift registers and read/driven serially by the MCU. Note there is no hardware connection between the pushbuttons and LEDs—pushbutton input is processed and output to LEDs all in software.
Hardware/Software Tradeoffs
Throughout the project’s planning phase, we finalized numerous hardware-related choices at a high level. We chose to utilize a hardware digital to analog convertor (DAC) instead of software pulse width modulation (PWM) for audio sample playback. Our main reason for doing this was to streamline the software and we also thought it would enhance the audio quality overall.
Another choice we needed to consider was the dimensions of our groups of LEDs and pushbuttons. At first, we thought about implementing a setup with 16 LEDs and pushbuttons in a 16×4 array (one row per track) and another row of 16 LEDs to display the sequencer’s progress. We soon understood that this would lead to an excessive amount of wires and connections, making the hardware needlessly complicated. Instead, we opted to simplify the hardware by utilizing only one row of 16 LEDs and pushbuttons. Software manages the track switching process. We combined the sequencer LEDs and pushbuttons LEDs into a single row of LEDs. The sequencer XORs with the pattern as it moves forward. This alteration allowed us to surpass the hardware restriction of four tracks. A modification in the software may boost the quantity of tracks. We chose to incorporate six tracks in our final device, whereas our initial idea only had four.
We traded hardware for software in the design of the control mechanism. At the start, our idea was to utilize specific pushbuttons for switching tracks and choosing instruments, as well as a potentiometer for modifying the tempo. We acknowledged that this could result in a crowded user interface and pose challenges in implementing advanced control functions such as saving/loading presets. Instead of that, we created an LCD screen that allows users to see the track, instrument, and tempo currently selected. The LCD features a menu choice for saving and loading presets. The display is controlled by the user through the use of the up/down/left/right control buttons. All the data is handled within software through a state machine. The outcome is a sophisticated and user-friendly user interface.
Standards
We utilized the SPI standard for communication between our MCU and DAC. Another important standard related to our design is the IEC 825-1 “Eye Safety Classification of Some Consumer Products” from the International Electromechanical Commission. This standard establishes guidelines for LED and laser brightness to ensure the safety of users’ eyes against harmful levels. We adhered to this standard by avoiding the use of extremely bright LEDs and carefully considering the spacing between LEDs in accordance with this standard.
Existing Patents, Trademarks, & Copyrights
By carrying out a partial patent search on the Google Patent search platform, we discovered numerous patents related to music sequencers and rhythm synthesizers. Even though these designs both employ the concept of combining pre-recorded sounds, they differ in their user interface and approach to creating patterns using pushbuttons with control over each individual step. Nonetheless, as we have taken inspiration from commercial synthesizers for our drum machine and synthesizer concept, it’s likely that a patent exists for this type of device, even if it’s been more than twenty years since it was filed and may have expired.
We based much of our design on the Beat707 MIDI drum machine produced by Rugged Circuits. Although we did not use any of their code, we were inspired by the way they implemented the drum machine and a sequencer. The Beat707 is still under open-source development and not yet commercially available; there has been no formal patent filed.
We understand that because our device is not completely new, it has no potential for patenting or publishing. Our goal in developing this device was not to make money, but to utilize our expertise in microcontroller programming to create an engaging educational tool. We have no intention of patenting our device or violating any existing patents held by others. We do not think we are violating anyone’s trademarks or copyrights with the name ‘Step Sequencer Drum Machine’ since a quick Google search showed no results for this specific title.
Hardware Design
Due to the complex user interface, this project requires a substantial quantity of hardware. Due to this, we divided the hardware design into two stages: a prototype phase and the final assembly. While prototyping, we built the whole device using solderless breadboards. Engaging in a prototyping phase enabled us to identify optimal wiring schemes and adapt our design as needed for the software. It also made it easy to access different nodes in our circuit while debugging.
We utilized Professor Bruce Land’s ECE 4760 custom PCB target board to accommodate the Mega644 MCU. It includes the microcontroller as well as all required power and auxiliary circuitry. We supply the target board with a 9V battery and utilize the MCU’s 5V Vcc to power our remaining circuitry.
Our device includes the pushbutton circuit, the LED circuit, and the DAC circuit in addition to the target board.
As previously mentioned, our device includes 23 pushbuttons. Rather than connecting each of the 23 pushbuttons to separate pins on the Mega644, which would have used up too many pins needed for our other components, we attach them to three linked 74HC165 8-bit parallel-in-serial-out (PISO) shift registers.
Each 74HC165 module consists of 8 parallel inputs (D0-D7). These pins are connected to Vcc through a 10 kOhm resistor in order to restrict the current going to the pin, while the pushbutton is linked in a parallel branch to ground. We picked pushbuttons without any bouncing. When the pushbutton is pressed, the input generates a logic low pulse as the outcome. When a logic low pulse is applied to the parallel load pin (1), the 74HC165 will transfer the input pin values into its internal register. When the clock pin (2) triggers, the contents of the register are shifted out serially on the output pin (9). The Mega644 gives signals to load data in parallel and control the clock, while taking in serial output (Q7) as input.
For more detail: Arduino Step Sequencer Drum Machine