A Drum Machine for Bassists (and Others) to Practice With
by dmcintyre in Circuits > Audio
4405 Views, 42 Favorites, 0 Comments
A Drum Machine for Bassists (and Others) to Practice With
When I'm practicing bass I don't like fiddling around with phone apps or something on my PC when I want to set up a rhythmic accompaniment. So I made this - a programmable rhythm box based on the VS1053 MIDI chip.
Proper knobs, buttons and flashing lights!
Beware! There may be dragons. This is not a beginner's project. At least not yet. If people like it enough I might redesign it with a PCB so it can be easily built. Let me know how much you love it (!) in the comments.
All the design files are in my GitHub repo so you should start by cloning that so you can see what's involved.
It's a PlatformIO project using the Arduino framework targetting an STM32F411 BlackPill.
There is a KiCAD directory containing the EDA files built using KiCAD 6.0.
The OpenSCAD directory contains the 3D design files for the box, together with STLs ready to import into a slicer. If you want to edit the OpenSCAD design files you will need my libraries as well.
Supplies
1 x STM32F411 "BlackPill" development board
1 x Adafruit VS1053 Codec module
1 x I2C NavKey
2 x Adafruit NeoTrellis - you should get the elastomer keypad and JST cable too
1 x Generic SPI LCD module 2.4", 320x240 (like this one for example). If you use a different size you'll have to change the case design
1 x PAM8403 Audio Amplifier Module
2 x Buck converter module one for 5V and one for 3.3V
2 x Rotary encoder and a couple of knobs you like the look of
2 x 10K Resistor
1 x 1K Resistor
3 x 1u Electrolytic capacitor
Whatever prototyping board you prefer, connectors etc
Decisions, Decisions
Yes, I know this is an Instructable, but I did say that it's not for beginners. There's quite a lot of latitude here for you, so it's best to make sure you have a plan before you start soldering. Go on, ask me how I know.
Here are some things you'll need to think about:
- Can you get/afford all the supplies, or do you need cheaper options?
- Is a 40mm speaker big enough for you, or do you need it to be LOUDER?
- You don't have old worn out eyes like me and so can use a smaller screen.
- What's a 3D printer?
- One big board or lots of little ones? How much fun is it making crimp connections anyway?
If you don't care about any of this, jump straight to Step 3: "Doin' it like Duncan did", otherwise stick around for a discussion on what the options mean.
Options, You Don't Like Em? I Got Others
Cheaper
There are three places you can save money here
- Get a smaller screen
- Get a generic VS1053 breakout from EBay or somewhere. Be warned you may need to tinker with it so that it boots into MIDI mode properly. And it might also not sound as good as the Adafruit module.
- Bigger speaker will at some point mean a more powerful amplifier and then a bigger power supply. My advice here is to start small.
- No NavKey
If you get a different-sized screen or loudspeaker, obviously the 3D model for the case will no longer work. Time to brush up your OpenSCAD skills and leave glowing comments about well-crafted my libraries are. Not.
Differently Connected
Basically, will you solder it up on one giant piece of proto-board or will you use several smaller ones like I did?
The gigantic board approach will mean creating fewer interconnect cables, but may make it harder to build and debug step by step.
No NavKey
If you eliminate the NavKey you can still use the BassMate. You'll have control over volume and tempo with mute and pause, but won't be able to change the voices, control their individual volumes or save/load settings. Also, Saimon Fattore did a great job and you should really buy one.
Doin' It Like Duncan Did
This is mostly true.
0 Get The Code
Clone the git repo, install the git submodules and fire up PlatformIO / VSCode:
git clone git@github.com:ukmaker/BassMate.git
cd BassMate
git submodule init
git submodule update
Open the folder in PlatformIO, build and deploy as usual.
I have an ST-LINK V2 clone which I use to program Blue- and Black-pills. I throroughly recommend it since with it you get to debug with single-step etc.
1 Build The Hardware
I started by breadboarding some of the key components to make sure I understood them. You should do this too if you can to get a good handle on each part and how to connect it. If you don't I definitely recommend the build each bit on a separate piece of board approach.
So, first, get your power supply organized. I actually did this close to the end because I have a lab power supply I used during development. You can see from the schematic that I started with a bunch of linear regulators (7805 and 78M33) but soon discovered that they were getting too hot when being fed from a (guitar effects pedal) 9V PSU. So I stuck a buck converter in front of them to reduce their input voltage and get the power down. At this point I should have tested how well things would work with just two buck converters and no linear regulators. But I'd already used a lot of hot glue on the original PSU board so I left it as-is. There's also (originally) a good reason for the bridge rectifier. Honest. In fact it would still be a good idea to put it in front of the buck converters so it doesn't matter what polarity PSU you use.
2 Blinky Time
Add the Black Pill and the NeoTrellis to the mix.
You'll need to solder the two NeoTrellisses (Trelli?) together at the edge, or otherwise connect them together, and set their addresses. The Adafruit site describes this better than I could. The addresses are: left trellis 0x2e, right trellis 0x2f. If this turns out to be wrong the easy fix is to change the code in main.cpp at line 76 where the Trellumses are instantiated.
Program the Black Pill using your favourite method. Personally I bought a cheap ST-Link V2 clone and use that.
Connect the NeoTrellis to the BlackPill and when you apply power they should flash purple briefly. At this point pressing a button should toggle it from off to green to off again.
3 Sounds
Wire up the PAM8403 amplifier module and connect a speaker. Leave the inputs floating. When you touch the inputs the speaker should buzz. This proves that you didn't wie the power backwards. Which of course is very hard to do. Ahem.
Now connect the VS1053 module up. This is the moment of truth. When you apply power the NoTrellis should flash followed by a single loud noise of all the voices playing togther coming from the speaker. I should probably fix this, but it is a simple ay of knowing if something breaks.
4 Ready to run
Wire up the two encoders. You can actually stop at this point if you don't want access to the advanced features.
Press some buttons on the NeoTrellis. Press the tempo encoder. The BassMate should start running! Lights flash! Sounds are made! Turning the tempo encoder one way should make it run faster, and turning it the other way should make it run slower. If it does the opposite, you'll need to swap the encoder wires over. Same goes for the volume control.
5 Advanced Mode
This just means connecting the NavKey. Now you can do all the cool things described in "Step6: Advanced Features" below.
Making the Box
If you don't have a 3D printer, and don't have access to one, this step is not for you. You'll have to find some alternative way of making a suitable enclosure.
If you do have a 3D printer, there's not much to say:
- Download the STL files - one for the body and one for the front-panel
- Slice them with your favourite slicer (I use Cura) for a plastic you think will print well. I used eSun PLA+, which I really like. It's just about as strong as PETG, but much easier to print and doesn't string and blob. The holes for the speaker grille will need supports.
- Put together
How to Use
There are four controls
- The NeoTrellis buttons light up green when pressed to show that a note will be played on that beat.
- The volume encoder adjusts the volume when turned, and toggles mute when pressed.
- The tempo encoder adjust the tempo when turned and toggles pause when pressed.
- The NavKey is used to navigate around the display and adjust various settings
When the BassMate is running each column of buttons flashes briefly with the beat
Advanced Features
Using the Navkey you can move the yellow highlight around the screen. The screen is divided into two areas
- The top bar shows the main theme for the screen.
- Sequencer, the default, lets you control volume, tempo and the voice attached to each row of the NeoTrellis
- Jogging right leads to Presets where you can choose to save the current settings or load previous settings
- Under the top bar is the active area for the theme. Try jogging down and around - you'll soon get the hang of it
In the Sequencer theme you can jog down to a channel and set it's volume relative to the others, as well as jogging right to choose the voice. Voices are chosen from one of 4 families - Cymbals, Drums, Wood and Special
If you choose to save a preset with a name which already exists you will be prompted to overwrite it.
When you choose a preset to load you are given a preview of the beat pattern
That's a Wrap
That's it folks. I hope there's enough information here for you to be able to build one.
Happy bassing!