I haven’t worked on my Drum machine for a long time. So in order that I don’t forget what I did I’m writing it down. As I write these posts I realise what a lot of dead-ends I have gone down…
This design was created in early 2018 and was intended to be an expanded version of the first PIC32 design with a some specific goals.
- Create larger device with a less cramped interface than earlier versions
- Use a better/bigger display for both for better visibility and also to display more information
- Add a rotary encoder for additional input (I hacked one in as a test on the old design and it was quite useful)
- Use a “proper” Digital to Analogue Convertor (DAC) in place of Pulse Width Modulation (PWM) plus R/C filter used in the previous design for better quality audio
Audio DACs are typically driven using the I2S interface. This can be done is software but is best done using a dedicated peripheral and some dedicated GPOI to go with it. This meant using a chip with more I/O than the previous design had to spare. So I moved up from the 28pin B to the 44pin D version of the PIC (PIC32MX170F256D) This is essentially the same chip but with more GPIO pins. This makes it really easy to port code over without major rewrites. It comes in a TQFP package but is still very easy to hand-solder.
The design uses the same matrix idea from the previous design to sample the input buttons and the same Maxim LED driver for the LEDs.
This is also the first design to use a proper DAC – sort of – it’s a super cheap PT8211 16bit stero DAC. They cost a few pennies each on Aliexpress but are a massive step up in audio quality from a PWM + R/C filter. Plus they are really easy to drive from the PICs I2S peripheral requiring just 3 signals to drive it. (Bit clock, Left/Right clock and Data)

Electronically this design is very similar to the previous version. The 44pin PIC32MX brings 34 GPIO to the design, 13 more than the original design using the 28pin chip.
The DAC consumed 3 of the these. The extra “row” with the encoder and joystick used another but that still left me with some spare. So I included provision for using an external oscilator (as opposed to the internal R/C oscillator) plus an SPI EEPROM as well as the SD Card on the same SPI bus. Then to make use of the remaining GPIO my intention was to create an external sync input to allow the tempo to be driven from an external source and 4 PWM driven Control Voltage (C/V) outputs (called syncs on the schematic)
The PCB design is created in Eagle CAD as usual. I upgraded to the “Standard edition” to give me access to up to 160cm² of board area with up to 4 copper layers. The free version is limited to 80cm² with 2 layers.


I got hold of a bigger monochrome LCD the ST75256 it has a resolution of 240x160px and can be driven over SPI as either a typical 1bit (b/w) display or using 2bits per pixel for 4 grey levels. It got it again from Aliexpress here. It’s a bit pricey now for some reason. If you search you’ll find other sellers.

The idea is to use the 4 buttons under the display as quick access menu buttons. Sort of like an old style cash machine or a fighter jet multi-function display. The software will show different menu items depending on context.

Overall this design worked ok, it was functional and the use of the DAC was a success. The DAC is easy to use with the built in I2S peripheral and the quality is a marked step up from a PWM based output, although I should probably had paid more attention to filtering the DAC power supply.
However I wasn’t happy with the overall outcome.
The menu idea sort of works although maybe not as well as I had hoped. I struggled to decide on what items should be in the 4 menus.
Placing the encoder withing the input matrix with the buttons and joystick probably wasn’t the best descision. The input matrix is arranged as 4 rows of 8 inputs and getting the polling rate correct to read the buttons as well as the encoder proved quite challenging. The encoder inputs can be very “bouncey” and could really have done with a bit of a hardware R/C filter but that would have interfered with the rest of the matrix. I think a better approach would have been to use two GPIO as dedicated inputs either using polling or and interrupt based approach.
Finally the LCD was problematic. The contrast ratio is very low and despite lots of attempts at altering the initialization parameters I couldn’t get a decent display.
These factors together were pretty demotivating and eventually real life intervened and led me to abandoning this version of the Drum machine.
Hello, nice to hear from you again! 🙂 And, on topic about Drum Machines! 😉