The final result will be a simple command line interface (for now) that looks like this:

Requirements

Before even choosing the language I wanted to use, I decided to list a few requirements for the client-side software.

The software will automatically detect the drumset; the user will not have to manually choose a serial port.

The software will support playing multiple drumpad sounds at once (like a real drumset). This will require audio mixing.

The software must be cross-platform and easy to install.

My development process

I ended up developing this application three times: twice in C# and once in Python. There was also almost a C++ version. In this section, I’ll explain the initial prototype versions and why I decided upon Python in the end. To do this, I’ll go down the list of the requirements.

Requirement 1 is easy: if you remember, back in part 3 we added a feature to the embedded software that supports responding to “pings”:

// The client might want to know what we are, so let
// them ping us
if (Serial.available()){
while (Serial.available()){
Serial.read();
}
Serial.println("{ "msgType": "ping" }");
}

I didn’t want users to have to figure out which serial port to use. It should Just Work™. This is a very simple feature to implement, and because of this, requirement 1 didn’t actually steer me towards any one language.

Ready? Let’s begin…

…by reading this first

Let me preface this post by saying that I am not responsible if you destroy your drumset, burn down your house, spoil your appetite, etc. These instructions are accurate to the best of my knowledge, but I assume no responsibility for anything that may come from you following them (unless you win the lottery – in that case, I take checks or PayPal).

One more thing. This project involves soldering really tiny surface mount parts to a tiny board on both sides (and uphill, both ways). So I wouldn’t recommend this as a beginner soldering project.

The plan

You will be assembling a PCB that I designed. This PCB implements all the features of the schematic we finalized in part 3. Here is a picture of a completed board, soldered onto the Pro Micro:

Let me explain what you are seeing:

The purple board is the board I designed.

The red board (bottom) is the Pro Micro 3.3V, which is soldered to the purple board.

The white Molex connector is for the RGB LED.

The two surface mount chips are the tri-stating buffers.

Finally, and most importantly, the two right-angle female headers are connectors for the control box and drumpad controller.

Disclaimer: This board was autorouted out of laziness. If you’re better at using Eagle than I am (or just more motivated) please by all means grab the Eagle files and manually route it. If you do this, don’t forget to send a pull request my way on BitBucket! Should the average person care about it being autorouted? Probably not. Some vias might obstruct the silkscreen in some places, but you should have the reference PCB layout in front of you anyway.

Resources

All components of this project (software, hardware, and misc. development tools) are available at BitBucket here. For this part, you should only care about the hardware folder.

Improving the circuit

Circuity to detect when the control box and Arduino are on at the same time (a conflict)

Indication

I wanted a visual indicator that would quickly indicate the status of drumset, so I chose to install a big RGB LED right in the back of the drumset. Specifically, I chose this 10mm RGB LED. If you look at the back of your drumset, you can see a little plastic panel where the pedal and MIDI “in” ports are installed. That panel is taken, but if you look opposite the control box (still on the back of the drumset), there’s some open space. That’s where we will eventually install a hole for the USB cable to come out of, as well as the LED.

The LED – image property of SparkFun

Side note: This indicator LED is optional, though highly recommended. It will involve you drilling a hole in your drumset, which is a very delicate operation because of the weak plastic (sawing the hole for the USB cable is far easier). If you choose not to install the LED, you will probably save yourself half an hour, but you will lose an important feature. Plus the LED is really big and shiny. I’d recommend you install it. If you want, you could go for the smaller 5mm version instead of the huge 10mm LED. Just be sure that you get a common cathode LED.

Decoupling capacitors

We just need two decoupling capacitors: one on each of the buffer chip power supplies. I tried adding decoupling capacitors on the control box and drumpad controller, but the added capacitance caused a bunch of problems, so don’t do that. Also, you don’t need one on the Arduino’s power supply because it already has decoupling capacitors on the board.

Planning the hardware

We already know that the control box and drumpad controller communicate with SPI. Below is a simple (highly abstracted) schematic showing the existing drumset circuit. Note that the drumset uses 3.3V logic. This will be important when choosing a microcontroller.

SPI is a simple protocol to work with, so let’s plan on somehow having our hardware take control of that SPI bus.

Choosing a microcontroller

I decided early on that I wanted to use some kind of Arduino, instead of just a bare microcontroller, for a few reasons:

USB connectivity: Many Arduino-compatible development boards have a USB connection built-in, so it would be easy to connect the finished product to my computer. Of the three, this was the most important factor to me.

Simplicity: My hope is that other people will follow the (impending) tutorial. I didn’t want to require that people not only solder together the drumset interface circuit, but also a microcontroller circuit.

Ease of prototype: After I’m done prototyping on a breadboard, it will be easier to transfer my circuit to protoboard since I’ll have less parts to route.

BitBucket repository is live:https://bitbucket.org/MostThingsWeb/usbdrumming/srcSo, you’ve got one of those Guitar Hero (World Tour) drumsets, and want to use it with your computer? Are you also looking for a fun DIY project involving soldering, electronics, and possibly voiding a few warranties on consumer hardware? Great! Read on.

Plenty of resources exist for using Arduino as a SPI master (including Arduino’s own SPI library), but I couldn’t find much on using it as a slave. That link includes information on both. I hope someone else finds it as useful as I did.

To assist in debugging SPI (master or slave) with Arduino (or any other microcontroller for that matter), I suggest using a logic analyzer such as this 8 channel Saleae USB Logic Analyzer:

I’ve just recently gotten into electronics. For the longest time, I’ve enjoyed using breadboards to prototype simple circuits with 555 timers, LEDs, and other little components. Recently, my ability to move beyond simple circuits was tested by a new project. Long story short, I had to develop a custom PCB (printed circuit board) to drive multiple servos, among other devices. The board would actually be a shield that plugs into an Arduino Uno, which is an awesome, cheap, and easy-to-use microcontroller. A “shield” is simply a board that extends the capabilities that the Arduino provides.

Side-note: If you have even a remote interest in electronics, then get yourself an Arduino. At SparkFun, the latest Uno, the R3, is less than $30.

To design the actual circuit, I first tried using Fritzing. This program is really cool because you can design your circuits in a breadboard view, which actually visualizes what the breadboard looks like with all the wires and components plugged in. I was able to prototype most of the circuit really quickly. But, I ran into a snag when I needed parts that the Fritzing library didn’t provide. That was a shame, because Fritzing has a really nice fabrication service (Fritzing Fab) built right in.

I ended up using the freeware version of EAGLE– the project I was doing was for educational purposes, so I didn’t have to buy a full version of the software. The neat thing about EAGLE is that its library comes with a ridiculous amount of parts, from nearly all of the major manufacturers. I coupled this with the SparkFun library, which contains parts definitions for most the parts that SparkFun sells, and was up and running quickly.

When it came time to print the actual board, I researched various fabrication services. Eventually, I decided on the DorkbotPDX PCB Order. There are so many things that I like about it:

It’s $5/square inch. No setup fees or hidden costs. Shipping within the United States is free via USPS. Worldwide shipping is extra.

The fee per square inch is paid only once, but you get three boards! For example, a 4 square inch board (approx. the size of an Arduino shield) costs $20 for three copies, shipping included!

I wrote this short post as a bit of free advertising for the service. Laen, the guy that runs it, is really doing the community a favor by orchestrating this. If you have a board that you’d like printed, I encourage you to use this service.