MIDI Step Sequencer with 8 notes and 2 instruments
MIDI Mud is the first MIDI Controller built for Grumpenspiel. Quite simple in the way of MIDI sequencers, she was a fantastic journey for me.
Some firsts for me in this project:
- 3D design in AutoDesk Fusion 360
- CNC milled top and bottom of enclosure
- CNC milled PCB for LEDs
- Professionally manufactured PCB motherboard
Such a fun, challenging, and satisfying project. I couldn’t be happier with how it came out. Now if I only had some musical skills to create sweet jams with this puppy.
You’re wondering what “Mud” means in MIDI Mud. Yeah, me too. A year ago when I set out to build her, it made perfect sense to me, didn’t write it down, and the rest is history. Maybe it just sounds fun?
Source code and schematics available on GitHub in the hcgs-midi-mud repository.
MIDI Mud is divided into the following pieces:
- Wooden body - two pieces of hollowed out pine 2x4, held together with wood screws. The top serves as the face plate with holes for LEDs, buttons, and potentiometers, plus some custom art work.
- LED Board - a 3x8 matrix of LEDs, wired common anode rows and individual columns.
- Motherboard - Arduino nano, transistors to drive the LED rows, shift-register to drive the LED columns, and a multiplexer to read the buttons.
I’m often amazed at how much goes into even a simple project like this. For example, the following pieces of software were used. You don’t realize it as you go, but that’s a lot to learn if you’re starting from the ground up.
- Fusion 360 - 3D CAD and CAM
- Inkscape - logo design
- F-Engrave - logo gcode
- Eagle - schematic and board layout
- ChiliPeppr - circuit board to gcode
- bCNC - circuit board gcode autolevel and send
- Universal Gcode Sender - sending enclosure gcode
- Arduino IDE - programming and debugging
- Reaper - DAW for testing MIDI functions
This project was a great way to dip my toe into 3D modelling with Fusion 360. How will I make sure things line up right across 2 pieces of wood, two circuit boards, and oodles of visible components?
Fusion 360 offers a free option for hobby usage, which is right up my budgetary alley.
Every single aspect of the project gets designed in the CAD package. Some digital calipers and a lot of patience lead to a very powerful capability. Slide things around, experiment with layouts and visuals, all without cutting any expensive wood (lol, pine 2x4 from the scrap bin, but you get the idea).
The first example I ran into is the LEDs. In Eagle, relatively simple to create a 3x8 matrix of LEDs and the required connections. But! How to make the holes in the wooden enclosure line up just right? Even a small error across any of the LEDs could cause the whole thing to misalign and/or look ugly. Also, how about inside the enclosure? If the board edges are too big, it might bump into and block the adjacent switches. Model them!
The motherboard will sit in the bottom half of the enclosure. Standard practice is to use standoffs to hold a PCB up and allow room for component leads and pins. Instead, I used raised rectangles in the 4 corners of the pocket carved out of the base, and the motherboard corners sit on those. Then there is the exterior hole that will allow the USB connector in for the Arduino Nano. By modelling out all the heights, this exterior hole is carved for a perfectly aligned and fitting USB wire.
Going even further, the face plate has holes for the buttons and potentiometers. Using F360 I was able to stagger the buttons so they align under each column of LEDs, while occupying as little horizontal space as possible. Potentiometers have these little knubs that prevent them from spinning freely as the user twists the knob. Model that out, carve it in its spot, and ensure no other components will get in the way.
Fusion 360 has a CAM feature that lets me go straight from the model to G-Code that will machine the pieces on my CNC mill.
The wood for the enclosure came from pine 2x4 scraps I found in the scrap bin. Band saw to mill off the curved ends, then sanded them square.
F360 generated G-Code for:
- pockets inside each half to form a hollow shell
- holes in the top for LEDs, buttons, potentiometers
F-Engrave generated G-Code from the artwork designe in Inkscape for:
- Hedge Court Robots logo. I mean really, that’s the most important part of the project :-)
Drill press made the holes for the 4 wood screws holding the halves together, plus the MIDI DIN-5 connector.
Stained with Minwax Jacobean and sealed with Polycrylic.
Applied a paint mask before carving the HCR logo, and painted with Testors enamels.
All in all, the enclosure looks and feels amazing.
LED Circuit Board
The LEDs live on their own circuit board. Designed in Eagle, it is a very simple row / column layout. To go from the virtual world of design software to the physical world of PCB, I milled the board on my CNC.
Quite the learning curve! But she worked the first time I plugged her in. Beautiful.
When the LED board is pressed into the 24 holes in the enclosure top, the board itself will sit flush with the wood. If you load the full size image, you can even see the little pockets cutout at the base of each LED to allow space for the tiny flange that normally gets in the way of a close fitting LED hole.
This means that no wires will be on the top surface, nothing but the LEDs themselves. With the copper on the bottom, and the jumper wires to the motherboard on the same side, the setup is physically very weak, the copper began to pull up off the board. Some wood sticks and gorilla glue came in handy to strengthen it up. More on this later!
MIDI Mud lived on the solderless breadboard for about a year. Enclosure is complete. LED board is complete. Prototype firmware is written.
Motherboard exists only as an Eagle .brd file.
The step of etching or milling a board at home is a time consuming obstacle, and that barrier kept me away from the project.
I took the plunge and had the motherboard professionally manufactured by PCBWay. A few back and forth emails with their engineers and my files were approved. Two weeks later I had my boards in hand and they really look beautiful.
Soldering onto a professionally made board with solder resist and silkscreen outlines is a real treat. Way more forgiving than soldering onto my homemade boards, either etch or mill. For the low price PCBWay charges, I fully plan on using this in the future.
With my enclosure top and bottom done, and now both PCBs complete, time to do the final assembly.
Lots of slow progress, patience, patience, patience. Double check all the wires, did I mention go slow?
Remember that weak spot on the LED board I mentioned up above? The one fixed with some wood sticks and gorilla glue? Yeah, that’s the one. Well, when I made the 3D model, that bulky wood/glue assembly was not included. Now the MIDI DIN-5 connector cannot sit flush in its hole!!!!!!
Luckily the worst fit was an unused pin that I snipped off, and the next pin over (which is required for MIDI OUT) fit with only a partial snip. Now the connector fits right in there snug, secured with M2 screws in case a brawny roadie is overzealous with the muscle.
Lucky Pin 13
In my prototype circuit on a solderless breadboard, I only tested 2 pushbuttons. There are 12. 8 are read through a multiplexer, and 4 are read directly on dedicated I/O pins. When designing the PCB, I just hooked the 4 up to the next 4 sequential unused pins, leaving one of them on pin 13.
After I wired and assembled the whole thing, every piece worked…..except for the pushbutton on pin 13.
Lots of debugging, and I realize, pin 13 is lucky. There’s an LED, and more importantly, a current limiting resistor on Pin 13. If you use INPUT_PULLUP, you never ever get a LOW reading, even when a pushbutton shorts the pin to ground.
It was pretty easy to fix by removing the wire from the jumper hole on the PCB that connects to Pin 13, and just soldering it directly to A3 right on the Arduino itself. Upload new firmware and BAM, she works like a charm.
The firmware is reasonably simple. The Arduino .ino file is available in the GitHub repository.
MIDI Mud uses the new Arduino Nano bootloader. The MIDI OUT communication uses software serial, so normal Serial debugging is available at 9600 baud.
- Read 8 pushbuttons through a multiplexer and debounce them in software. These are the “note” buttons allowing a user to toggle an instrument for any given beat (by simultaneously pressing an instrument button).
- Read 4 pushbuttons on digital pins. 2 serve as instrument selectors, for combo-press with a note button. The other two are unused as of this writing.
- Read 2 potentiometers. 1 of them controls the tempo. The other is unused as of this writing.
- Illuminate the LEDs:
- Loop through the 3 rows, turning on one at a time.
- For the current row, do the following:
- Red simply shifts through the beats, turning on one LED at a time to indicate what beat is playing now.
- Blue/Green show the user what beats are selected for the two instruments.
- At the correct time (as dictated by the Tempo potentiometer), send the MIDI NoteOn and NoteOff messages
Schematic and Circuit
Eagle .sch schematic files are available in the GitHub repository.
The motherboard schematic still shows the pushbutton on Pin 13. A fun reminder to avoid that pin for digital input.
80 mA max. That considers all LEDs illuminated, which is a gross assumption. (A) Only one red at a time, to mark the beat. (B) It would be a rare DJ that turns on all 8 beats for both Green and Blue instruments at the same time. Technically possible, but not very interesting music.
|Arduino Nano||50 mA||Estimate from Nick Gammon|
|LEDs||30 mA||At any point, a single Red, and up to 8 each Blue and Green are set to illuminate. The rows are cycled, so only one row is ever on at any instant, which we can approximate by assuming one single row is fully illuminated full time. That will give an upper limit max. Each column has its own 1K current limiting resistor. The Red/Green LEDs have a 2.0V drop, leaving 3.0V for the resistor. This gives a current of 3 mA per LED (if lit continuously, which they aren’t), times all 8 columns = 24 mA. Call it 30 mA, a little round up to make things easy.|