Introduction: Adding Keys to an Arduino Synth the Hard Way- the Blacklord: the Organ Donor Project Part 2
(Note- This is my 20th instructable! Thanks to everyone following and commenting.on my projects and to the staff who make this possible. This site has definitely made me bring my A game to the workbench.)
The Auduino granular synth by Peter Knight ( http://code.google.com/p/tinkerit/wiki/Auduino ) is one of my favorite Arduino projects ever. All you need is a microcontroller, a few pots and some hook up wire to make some really fun sounds. In this project I will use a recycled organ keyboard to control the pitch of the Auduino.
Let me start by saying that I'm well aware that there's probably a better way to do this. My goal here isn't to build a high end stable synth- I just want to make cool noises with the parts I have on hand. It may not be state-of-the-art but it's definitely state-of-the-scrap-pile.
As I said, the Auduino is a ton of fun. It can be changed in the code to play a chromatic stepped scale, a pentatonic stepped scale or a logarithmic smooth scale. The stepped chromatic scale is what I want for this project as it maps every note on the keyboard. Since the notes are stepped, each note corresponds to a specific voltage range.
The pitch of the Auduino's output is controlled by a voltage between 0-5v on the Arduino's analog pin 4. This is usually done with a pot wired as a voltage divider. This means that the notes are played in order of the scale. It's not very easy to play notes that are not 'neighbors'. Since the organ keyboard is basically just a row of switches, if each switch is wired with a separate voltage divider it would play the full range of notes in what ever order the player wants.
Now let's take a look at the keyboard.
(Note- this instructable will focus on adding a keyboard to an Arduino set up to run the Auduino granular synth sketch. If you wish to attempt this project, please familiarize yourself with that project linked above.)
Step 1: Let's Take a Look at the Keyboard
Old organ keyboards are solid. They have a superior feel to the cheap plastic keyboards on the market today. Even compared to a high-end instrument like my Korg R3 or my Yamaha electric piano, these old keyboards just feel better to play. So how do we take an antiquated keyboard and make it work with a modern microcontroller?
While modern keyboards use a diode matrix to control the note being played, the old fashioned organ keyboard I'm using is basically just a row of switches. There is a bar inside that acts as a common contact for one side of all the switches, with the other side of each switch connected to a discrete connecting wire. When a key is pressed it causes a spring loaded contact to touch the bar, completing the circuit through that key. By giving each key switch a different resistance we will get a different voltage from each key causing a different note to play.
There are usually problems with this kind of keyboard. For one thing, analog circuits are sensitive to temperature changes. When you are trying to control a free running oscillator, these temperature variation make it very hard to keep the instrument precisely tuned. There are remedies for this, like installing incandescent lamps inside the instrument to keep the components at a consistently warm temperature. Since the Auduino has a stepped scale output, meaning it plays each specific note frequency rather than a smooth crescendo, the notes don't rely on a precise voltage, but a voltage range. This will give me a little wiggle room on the voltage and hopefully cover the analog temperature drift.
Sounds easy, huh?
Step 2: Planning and Skull Sweat
The first step was to determine the voltage range for each note. I'm sure there's a handy formula to determine this, but I couldn't find it. Time to get creative.
I already had an Auduino that I built last year, so I opened it up to do the measurements. Please refer to the original Auduino project. My Auduino was set to a pentatonic scale, so there were some code changes needed. I opened the sketch and changed it to output a chromatic scale. A chromatic scale is just a fancy term for 'all the notes'. A chromatic scale is 'C,C#,D,D#,E,F,F#, etc., just like a piano keyboard. I also added a line to the sketch to output the voltage on analog pin 4, which controls the Auduino's pitch, to the serial monitor. I compiled the new code and uploaded it to the Arduino.
Now I simply had to connect the Auduino's output to a tuner and carefully note the voltage required to play each successive note in the chromatic scale over the three and a half octaves of the recycled keyboard I was using. It soon became apparent that there was a .04v difference between each note. As long as the input voltage for a given key fell within that range it would play the note.
I played with several ideas before deciding that wiring each key of the keyboard to a separate voltage divider would be the simplest solution. Since I had a bag of fifty 50k trimpots, it was a no-brainer.
With that knowledge, it was time to solder a control board for the keyboard outputs.
(Note- I realize that the serial monitor part is redundant and I could just use the chromatic tuner, but originally I was thinking or a fixed resistor arrangement so more precise measurements were in order. That turned into a blind alley, but I included it because someone may find it useful. I also found it easier when tuning the trimpots to use the voltage reading to do the rough tuning and the tuner for the fine adjustments.)
Step 3: Setting Up the Tuner Board
Since the keyboard is just a row of switches and each switch needed a separate voltage, I decided that the easiest thing to do would be to connect each switch with a trimpot wired as a voltage divider. It's important to note that the keyboard is split into two separate PCBs with 22 keys each. Each output socket had 23 connections, one for each key and one to provide a connection to the contact rod. I determined the wire for the contact rod before I started soldering and tied a knot in the end to prevent confusion later.
I arranged the trimpots on a piece of perfboard in a keyboard pattern to make the tuning process easier. The pots corresponding to the natural (white) keys were arranged in one row with the sharps (black keys) arranged in another row above it. Now, when I tune the middle C key it will be easy to find the appropriate trimpot by following the keyboard pattern on the tuner board. I wired one side of the pots with a common voltage bus and the other side with a common ground bus. I soldered the wires from the keyboard's harness to the center pins of the pots, being careful to insure that they corresponded with the keyboard pattern of the trimpots. I connected the contact rod wires from both keyboard PCBs to the tuner board with a common output wire. I connected the voltage in and ground buses from the two rows of trimpots and soldered on wire leads to connect the rest of the circuit.
Now, when a key is pressed the voltage goes from the common voltage bus on the tuner board, through that key's trimpot, through the key switch and out through the common contact rod to the Arduino's analog pin 4 to produce the desired note. Hopefully.
Step 4: Tuning the Keyboard
The next step is to test and tune the keyboard. For this step please refer to the original Auduino project. I loaded my modified sketch onto a new Arduino and hooked up some pots. I wired the keyboard's tuner board to the 5v and ground pins of the Arduino and I connected the output from the common contact rod to analog pin 4. I added an output jack to PWM pin 3 and ground and turned on the Arduino. I started pressing keys. I was rewarded with a cacophony of notes from all over the Auduino's range. It wasn't musical yet, but it proved that each key was producing its own distinct voltage and its corresponding note. Success!
Now it was time to turn this noisy machine into a musical instrument. This meant carefully turning each trimpot to get the appropriate voltage for that particular note. I hooked up the tuner and the serial monitor and got busy.
Let me start out by saying that if I was going to do this again (and I definitely am) I'd order multi-turn trimpots. Since I'm impatient and broke, I used what I had on hand- a bag of fifty 50k single turn trimpots.
Step 5: I'm on the Case
Now that I have a working instrument it's time to build a case to protect it. I hit the scrap pile and came back with a load of potential materials. After some playing around with different ideas I decided to use A piece of 4"x4" PVC fence post. This is an excellent material for making project boxes- it's cheap and easy to drill and cut. I figured a piece of PVC with brackets for support, wooden end covers and a plywood base would look good and give me plenty of room to house everything. This design will also allow the instrument to be serviced and modified easily as the keyboard assembly and tuner board will be mounted to the plywood base and everything else will be mounted to the PVC cover. All I have to do is include some screw terminals and the two pieces could easily be separated.
The first step was to measure and cut the PVC post. This is an easy material to cut but there's a trick. Cutting perpendicular to the long axis of the post is easy with a chop saw but smaller saws may require the material to be flipped and cut twice. I cut the piece to the length of the keyboard. The next cuts in the long axis of the post are tricky. The PVC tube is under tension. If you try to cut all the way through with a saw it will pinch at the end resulting in a flawed cut. The trick to making this cut is to cut a groove in the PVC leaving enough material to prevent it from collapsing and pinching on the blade. The thin bit of PVC left in the bottom of the groove can be cut and cleaned up with a utility knife. After it was cut I checked the fit of the cover and the internal clearance to accommodate the boards and components. Now it's time to cut the end pieces.
I traced the profile of the partially assembled base, cover and keyboard assembly to determine the shape of the end pieces. I cut out the shapes from a scrap piece of select pine 1x6. I also cut a pair of end blocks from another scrap of 1x2. I had a piece of scrap plywood that was the perfect width, so I cut it to length and that was that- the rest of the case would be plastic and aluminum. I attached the end blocks to the plywood base with reclaimed screws and attached the keyboard assembly to the base with screws through the frame in over the end blocks.
The next concern was how to connect the PVC cover to the frame. I used some aluminum angle stock I had lying around to make some brackets. I measured the inside edge of the PVC where it met the end piece and cut two of them.
With the aluminum brackets cut it was time to position them. I used a ruler to measure and mark the ideal bracket positions, keeping in mind the thickness of the PVC and the Lip created by the side piece being slightly larger than the actual synth. I drilled mounting holes and attached the brackets with reclaimed screws.
Next I put the PVC cover in place where it would be mounted. I marked mounting holes on the PVC cover, removed it from the synth and drilled them. I repositioned the PVC cover and used it as a guide to mark the cover mounting holes in the aluminum brackets, then drilled them as well.
I cut another piece of angle aluminum and screwed it down along the back edge of the plywood base. This is a bracket to secure the back of the PVC cover to the base. I'll add a few finishing touches and trim pieces later, but now it's time to install the electronics.
Step 6: Wire It Up!
Now it's time to arrange and mount the electronics inside the case. The first challenge was to make the tuner board fit in the case. This meant repositioning the wires and trimming the board a bit and adding a little tape along the keyboard frame to prevent short circuits. When I had it in position I mounted it to the rear bracket with some hardware. I laced the wiring harness to make it easier to manage and routed it along the rear bracket out of the way.
Next I determined the control layout for the front panel of the PVC cover. I laid out the design on graph paper and drilled the mounting holes for the pots and switches. When they were mounted I added some cool old knobs from an audio mixer I scrapped last year. I mounted the Arduino and added a few terminals to allow easy disconnection of the base from the PVC cover.
Now it's time to finalize the electrical connections. I decided to add an additional analog pin and a switch for later improvements. One possibility is to add a tremolo effect that turns the audio output on and off at an adjustable rate. I may also explore RCArduino's (Duane B) Arduino with Delay mod ( http://rcarduino.blogspot.com/2012/11/auduino-wit... ). Another thing I'd like to add is a foot pedal to control the mod A knob. I wired in a toggle switch for pin D4 on the front panel and left the analog pin 4 wire disconnected inside with nothing assigned to it in the sketch.
It's always a good idea to plan for growth.
Step 7: Good Enough for Government Work
With all the wiring done it's time to reassemble everything and plug this sucker in. There are a few more cosmetic details to attend to but I can't wait any longer. In the words of Dee Snyder 'I wanna rock!' Watch this-
I'm so happy with this synth! It sounds really dark and stabby and it would be at home playing EDM, metal, darkwave, industrial and many other kinds of music. Not a single penny was spent for this project- I had everything laying around. Even buying the parts new it would come in under $100. The organ was $20, a microcontroller is about the same, a whole 8' section of the PVC fence post costs $16, Trimpots, pots and switches on eBay would run $15-25 and a small piece of plywood costs a few bucks.
I'll finish the cosmetic bits if I can stop playing it long enough to unplug it. Not only does it sound awesome but it also feels amazing to play- solid and responsive.
It wasn't until I plugged it into an amp through some effects that this synth got its name. The Auduino produces triangle waves similar to a guitar. Distortion, overdrive and traditional guitar effects sound amazing. I ran the synth through a Korg Pandora multi-effect processor on a Deep Purple-like setting and plugged it into my Recyclone Leslie rotary amp and it was amazing!. The synth sounded like the unholy love child of Ritchy Blackmore and John Lord so I named it the Blacklord. \m/ \m/
Go. Build one now!
Step 8: Finishing Touches and Plans for the Future
I'll add the details of the finishing later, I really just wanted to get this up as soon as I heard it. Take a look-
As for the future- I have some ideas. An LFO would be nice. I'd also like to add a PCB from a chromatic guitar tuner to the inside to make it easier to retune. I'd also like to try out Duane B's Auduino with delay (
http://rcarduino.blogspot.com/2012/11/auduino-with... ). I'm thinking about using multiple Arduinos with the same keyboard to play chords and harmonics. I don't want to add too many bells and whistles. I really like the simplicity of this synth- it feels like an instrument rather than a gizmo. It's dirty and visceral in a way that my Korg R3 is not capable of being.
A final note on the Auduino as a synth engine for this project- The Auduino wasn't meant to be keyed. The upper ranges of the four adjustment knobs get pretty noisy if a key isn't pressed. I added a pull down resistor across to analog pin 4, but it's still an issue. I'll try a few more things, but it may just be the bug that becomes a feature. While limiting the range of the adjustment pots in the sketch is an option that will make the synth easier to tame, it would also severely limit the range of sonic possibilities. I chose to embrace the chaos and risk a little buzz and hum now and then. Watch the video- the proof is in the pudding.
I look forward to recording some tracks with the Blacklord really soon. In the meantime keep an eye out for the next installments of the Organ Donor Project. I've been poking around the voice board of the Auto-Vari 64 drum machine and let's just say things are about to get interesting...
Participated in the
Guerilla Design Contest
Participated in the
On a Budget Contest
Participated in the
DIY Audio and Music Contest