16-button sequence synthesizer. An easy build, for sure. (via me)
I wanted to take the last project a few steps into another direction. I’ve gone from melodies to specific notes. I wanted the user to decide what they hear, so to speak. I’ve also gone from 8 buttons to 16.
The biggest issue I wanted to fix, placing silences and variable note duration within the user-programmed sequences.
Luckily, a lot of the steps in setting up this project are the same as the “Multi-button Synthesizer” from a few weeks ago. So, excuse a lot of the repeated procedure. But, at least you don't have to buy any new parts.
The software works as follows:
- Power it up, it ready to play tones. Press any of the sixteen buttons, and it will play a different tone/note. This is the button play mode.
- Press both “A” and “B” simultaneously and it will go into record mode. When you press any of the sixteen buttons and it will play the note for as long as you hold the button down. You can press and hold any sequence of buttons, and it will record the sequence and even any silences during the routine.
- Press “B” to playback your recording.
- Press “A” to return to the button play mode, and will stop playing the recording.
First, let’s gather all the necessary components you’ll need to build this project.
Project Wires Female - Female (aka jumper wires)
1x Piezo Buzzer (Alternative option - Powered speaker.)
Video demonstration of the project:
STEP 1
Load the code onto the Micro:bit.
I am providing the hex file you need to drag and drop onto the Micro:bit, and the python code as two separate files. For the below process, just use the hex file.
Plug the MicroUSB cable into the Micro:bit, and plug the other end of the cable to a PC or MAC.
At this point, you are going to copy over the code to the Micro:bit. I am providing the program (code) in this post that needs to be copied over. When the Micro:bit plugs into a computer, it shows up as a USB flash drive. All you have to do is copy the file over to the Micro:bit, like it’s a USB Flash Drive, and the Micro:bit will reset, and the program is active.
You can remove the Micro:bit from the computer at this point. The program will start running, and without the rest of the circuit, it will not function.
●
A little bit about the code:
First and foremost, the sound that is played at each switch is a particular frequency hard coded. Feel free to change them to whatever notes you want.
With creating music, speed of the note playing is important. I found that my debounce routine was causing noticeable delays. You could tweak this to adjust the speed.
Below is where the recording process takes place.
The rest of the code is commented fairly well if you want to see what is going on in it.
STEP 2
Gather your parts.
I used a 4x4 matrix keypad for this project. You can use any type of matrix keypad as long as it has sixteen buttons.
I then used female-female project wires to connect the pad to the Micro:bit breakout board.
STEP 3
Wire up the schematic to the breakout board.
STEP 4
Setup
Plug USB 5V power to the Micro:bit.
It will be in the button play mode. You should see a play symbol triangle alternate with a hyphen.
In this mode, buttons K1 to K16 play eight different tones (notes). Press the different buttons to hear the tones. If you let go, the tome will stop playing.
Simultaneously pressing “A” and “B” keys will switch mode to the “Rec” displaying on the LED indicator as a circle interchanging with its half (to reserve two upper lines for the storage indicator).
As you press keys their keycodes and successive relative time intervals are stored in the memory. “No input” is coded as “-1” and its duration is stored too so any key press uses 2 elements (coding pressed key and released keys relative time intervals).
To replay recorded sequence press button “B.” “Replay” mode is started and keys are replayed sequentially until the last stored key release event, ended by “A” or “B” key press and continues in infinite loop (until “A” or “B” button key press).
Conclusion:
This is a pure tone, 16 button sequence synthesizer on a Micro:bit.