This is a project I’ve been working on for over a year but haven’t had the time to complete yet. Electronics takes second place to children…
It’s a mini drum machine modelled on classic machines like the Roland TR808. My version is digital, playing samples rather than analogue and uses a single pic24 to do the work.
At the moment the software is not complete, in fact the interface is pretty poor, but it is working and can function as a simple drum machine and is quite good fun to play with.
As it stands it has the following features;
- 16 different instruments stored in Flash (Dependant on PIC flash size and sample quality/size).
- 16 step patterns with 16 patterns per song.
- 16 songs loaded and saved to FAT formatted SD card.
- 8 sample polyphony, mixed in software.
- 8bit, 16khz instruments sampled from classic drum machines.
- Analog mono output filtered from an 8bit 156khz PWM signal.
- Drives headphones directly or a speaker via a TPA301 audio amp (Thanks TI).
- 16 buttons for beat input plus 4 more and 4-way joystick for interface.
- 20 leds driven by a Maxim 6957 LED driver to provide feedback.
- Nokia 5110 B/W LCD displays user interface.
- Songs are stored as plain text in JSON format to allow some human readability.
Here’s a quick overview and demo video.
Features I think could be implemented in this prototype (not yet though);
- Master and track specific volume controls. This would give more control over feel of the songs.
- Real time sample volume manipulation to provide ADSR envelope for more sound variety.
- Reverb/Echo using some spare RAM to add effects to output.
- Better interface over all, maybe switch to a colour LCD.
- Variable pitch sample playback. Use some sort of interpolation to allow playing samples back at other than their native sample rate. Again this would give some nice audio variety.
Apart from my general lack of free time, one reason for lack of development is that I feel that I might be better abandoning this prototype and switch to a larger version of the Pic, one with more spare I/O pins (pinnier) to allow more interface options such as potentiometers or rotary encoders, or drive a larger colour LCD in 8bit/16bit mode. I recently bought a ChipKIT Uno32 for a bit of experimenting and it’s kind of sidetracked my limited time whilst I play with it and a 320×240 colour LCD. The ChipKITs are based on the pic 32 series, have loads of Ram and Flash and run at up to 80Mhz… It could probably load songs and play multiple samples direct from the SD card giving loads of free ram for effects and things… But that’s another idea.
Anyway, some more info;
The SD card, the Nokia LCD and the Maxim LED driver all run on the hardware SPI bus.
I created my own libraries for the Nokia LCD and Maxim LED driver. They’re fairly standalone but as they share the same hardware SPI peripheral they rely on a simple SPI library and a set of common defines to setup the hardware properly. If you are interested in these you can download the whole MPLAB X project and see how they fit together.
You can download the entire project if you want to have a look.
When I started out I built the project with a couple of smaller, more common PICs, the PIC24FJ64GA102 and PIC24FJ48GA002. I soon ran out of Flash rom but I’ve left in the conditional macros so it should still compile for them if you remove some samples.
Have fun and let me know if you have any questions.