Introduction: A Stylophone
I was browsing through the Instructables technology area the other day looking at musical circuits, and I noticed that there was a project that was missing... The good old fashioned Stylophone.
There are a couple of wonderful examples that were there in the spirit of the original (with even better features), such as the Tic Tac Tunes , and the NoiseAxe Minisynth, but I couldn't find an original PCB based keyboard, using good old fashioned analog electronics.
So I made one!
This Instructable will show you how to make your own original stylophone - The schematic that this is based on is my own, so it is free from Intellectual property restrictions. It is based around a 555 timer (so it could be an extension of the recent "Know Your 555 timer" article), and uses an ubiquitous LM386 audio amp so it can have enough volume to stand out from the crowd.
As with all of my projects, the PCB is designed for etching yourself, and there are no components that are difficult to source - in all, the Stylophone can be constructed for less than about $30AUD.
There is a breadboard area on the PCB, so you can add your own tremolo, or even an AtMega168 chip if you feel inclined. Allowing you to create the ultimate in digital analog fusion!!!! (Sorry - I couldn't resist) :-)
Update: I just downloaded a video onto youtube. Click here to view it.
Step 1: That 555 Is Connected Is a Way That Is Weird!
The heart of this project is the wonderfully versatile 555 timer, configured as an Astable Oscillator (An oscillator that continues to provide output pulses as long as it is turned on.)
If you look at the circuit for the original Stylophone, you will see that the 555 has a diode and transistor hung off the discharge line (pin 7). These additional components ensure that the output waveform has a duty cycle of 50%.
In a standard configuration, a 555 allows for the timing capacitor (C) to be charged via R1 and R2, but discharged using a separate discharge pin (pin 7) only via R2 - this means that the cap charges using one path, and discharges using a different circuit path, resulting in an output that may not spend equal amounts of time being High and being Low [ie the output does not have a 50% duty cycle.] This is especially true when one of the resistors is being changed to change the tone.
I will admit that I am unsure why the original designer was worried about the duty cycle - remember that this instrument produces square waves - they are a *rich* source of harmonics..
I found a cool way of connecting the 555, that ensures that the duty cycle is 50% using a much simpler configuration here. Essentially, the oscillator is connected so that the normal 555 discharge connection is not used. Instead, this circuit uses the output pin to both charge, and discharge the timing capacitor, ensuring that the duty cycle is kept at 50%.
The frequency of oscillation can be adjusted by varying the voltage on the Control Voltage pin (Pin 5) - this allows the Stylophone to be tuned to other instruments.
Step 2: The Output Amplifier
The original Stylophone did not have a separate output amplifier, instead, it relied on using a speaker that had a high impedance (75 ohms) so that it didn't overload the output of the 555 chip. These high impedance speakers are tricky to obtain now, so I decided to use an 8 ohm speaker. Because 8 ohms is too low for the 555 to drive properly, I decided to use a separate amplifier.
Here is the output amplifier - it is based on the LM386 small audio amp chip, and provides a ton of output into either a speaker, or a set of earphones. If you do use earphones, be careful of your hearing - this will drive the headphones at a very high level....
The input capacitor (C4) is used to provide some isolation between the 555 timer output, and the amplifier input., and the capacitor / resistor combination (C2 & R5) is used to prevent the amplifier from self oscillating, which these chips love to do!
Step 3: The Tone Resistor Bank
The single thing that makes a Stylophone unique is that the output note is selected by touching a stylus against a piano like keyboard. When the stylus makes contact with a key, a resistor is selected that corresponds to the required note. In my design, the entire chain of resistors selected is the resistance that is used to select the note.
It is important that the resistors are selected correctly so that the notes approximate those of a musical keyboard. With a keyboard, the notes have the following frequencies;
C - 261Hz
C# - 277Hz
D - 293Hz
A -880 Hz
The frequency that the 555 oscillates at (for CMOS versions) can be calculated from the following equation:
In my circuit, C = 0.033uF (0.033 x 10-6) - I made a spreadsheet that calculated the total resistance needed for each note, and came up with this set of total resistances, which can be made using 5% resistor values:
F = 1 / ( 1.4 R C )
C - 83360 Ohms
C# - 78660 Ohms
D - 74360 Ohms
D# - 70060 Ohms
E - 66160 Ohms
F - 62260 Ohms
F# - 58660 Ohms
G - 55360 Ohms
G# - 52360 Ohms
A - 49360 Ohms
A# - 46660 Ohms
B - 43960 Ohms
C - 41560 Ohms
C# - 39160 Ohms
D - 36960 Ohms
D# - 34760 Ohms
E - 32760 Ohms
F - 30960 Ohms
F# - 29160 Ohms
G - 27560 Ohms
G# - 26060 Ohms
A - 24560 Ohms
Using the resistances above, I calculated that the maximum theoretical error would be about 2 Hz from the desired frequency. In reality, the tolerance of the components (especially the capacitor) will make this error larger than that, so that will do.
I built a chain of resistors ( starting with 24.560k [24K + 560R]) and incrementing by the required resistance as shown in the diagram so that when the stylus is connected to a note, the correct resistance would be provided.
When I tested the instrument, I was pretty pleased with the accuracy of the tones - It doesn't match a digital instrument, but it is close enough.
Step 4: The Overall Circuit
If you draw up everything from the previous steps, you end up with a schematic diagram that looks like this one (attached as a PDF file).
All of the components have been selected to make sure that they are simple and inexpensive to source, and can be easily purchased from Jaycar, Mouser, or eBay.
Step 5: The Circuit Board
I laid out a PCB that I could use Toner Transfer to etch - It even has space for a prototyping area so I can extend the project at a later stage.
Again - It is single sided, and the layout was simple enough that I didn't need to use any jumpers.
Don't use the PNG file here - it is just to show you the layout - use the PDF file for making your board. As you will see soon, the PNG file is backwards for our uses - the PDF is correct, and will make a beautiful board!
Now for the tricky bit - The layout is designed so that the copper is ON TOP of the PCB - not underneath - It would be a very boring project if we had to put the stylus under the board to play it. I decided to design the board so that the components are still mounted on the top, which is the COPPER side of the board - We will discuss that soon - but first - To the etching process.
Step 6: Etching
If you have kept up with all of my instructables so far, you should know how I etch boards by now. I will include the detail here if you need the information.
I personally use Cupric chloride as my etchant, and toner transfer as the resist method - It does not cost very much, and I can make a ton of projects from the scrap press-n-peel left over from my clock kits :-)
Normally I would just use press-n-peel film, but because people have been telling me that printing onto catalog paper also works, I decided to try that as well. So - I printed the layout onto both transfer mediums.
I decided to make two boards - one for my dad, as a present to replace his Stylophone I destroyed as a child, and one for me, so it was a wonderful opportunity to try both methods.
Next, I used my laminator to bond the toner to the PCB ready for etching - I use a temperature of about 170 degrees C (At least that's what the display says).
Press-n-peel: After the board cooled, I peeled the film off, and examined the layout for any spots where the toner didn't bond properly - I just use a permanent marker to touch up the layout so that all of the tracks are well formed. I find that dust is my worst enemy. If I have been able to keep the workshop clean, things go really well, but if the place is grubby because I have been too busy, then I get spotty transfers.
Catalog Paper: I let the board cool, then I sat the board into warm water till the paper lifted off - I used my finger to gently remove the fibers that stayed behind. This time, I didn't have to deal with spots on the layout.
Once I was happy with the layout - I placed the boards into the etchant - 150ml of 6% Hydrogen peroxide mixed with 75ml of Hydrochloric acid (for cleaning bricks). With continuous agitation, the board etched in about 4 minutes. As with any etching process, use caution with chemicals - protect your body using appropriate safety gear, and protect your work surfaces. The etchant will damage your stainless steel sink if you let it. this quantity will comfortably do 2 or 3 complete 6" x 6" boards
Once I was happy that the boards had finished etching, I placed them in a rinse bath to stop the acid from eating the copper. While rinsing, I took one of the boards and scrubbed the toner from it using steel wool. Both of the boards got a good rinse for about 5 minutes, when they were taken out and dried.
Step 7: Solder Plating the Keys and Drilling the PCB
I left my board for completion later (when I finish this article), and decided to focus on Dads one. The nice dry board was then sprayed with a 'solder through' lacquer to prevent the copper from tarnishing. I protect the keypad area with some masking tape before I sprayed because I needed to solder plate the keys to protect them.
Next, I solder plated the keys. This was important to protect the copper surface of the keys from corrosion caused by contact with oily fingers and the environment.
I started by using a wide soldering iron tip, and some extra flux, and coated the keys with a thin layer of solder. Then, I re-fluxed the board, and used a hot air gun to smooth the solder down.
I was very careful not to overheat the board and de-laminate the keys. You may prefer to use some scrap PCB material to get the hang of it first.
A bit of abrasive kitchen cleaner and a steel wool scourer to clean up the keyboard area finishes the process. I think that the board came up really well.
Finally, the board was drilled using a combination of 0.8mm and 1mm drill bits. depending on the components that need to fit through the holes. I still use my trusty hand held Dremmel (tm) tool which I have used for 20 odd years. It still goes beautifully.
Be careful with dust during the drilling process - use breathing protection.
Step 8: Mounting the Components
Remember when we discussed the PCB, I mentioned that the parts are mounted on the copper side of the PCB. I did this after I finished plating the keys.
The only tricky thing about this step was that I used MACHINED PIN sockets for the IC's. I use this type of socket as they have a small 'shank' that causes the socket to sit proud of the PCB surface. This allows soldering to be done on the top side of the board. Just be careful not to melt the plastic with your soldering iron tip.
Next, I mounted the resistors, capacitors, and diode. When I mounted the electrolytic caps, I bent their leads to allow them to lie them down flat so that I could get to the leads under the package.
I finished by assembling the Volume and Tuning controls onto short cables, and soldered them to the pads on the PCB.
Step 9: Making the Stylus
I used a ballpoint pen and a test lead plug for my stylus - I just stripped the barrel from an old pen, soldered some test lead wire to the test lead plug, ground down the end of the pen to allow the test lead end to fit through, and ran that wire down the shaft, out the back, and down to the PCB.
At the PCB, I used a wire loop to connect the wire under the board - the wire passes through a hole for strain relief.
You may like to use an actual test lead from an old test lead set - that will work fine.
Step 10: Testing
To test the board, I connected a speaker to the output, and applied power using a 9v battery.
Woot! - The first thing that I noted was there was a distinct lack of smoke coming from the board - that was an awesome step forward... (if there is smoke, remove power then find out what happened...)
Because there was no smoke, I touched the stylus to the keyboard, and was immediately rewarded by a cool electronic sound. Sliding the stylus up and down the keyboard, I found that the note altered in pitch, and that the pitches were pretty close to what I wanted! YAY.
The volume worked as expected, and the tuning control altered the tuning as well.
I was really pleased with the serious electronic sound from the plastic coned speaker that I purchased. That's what I wanted!!!! In all a great day!
Step 11: Buiding an Enclosure
The enclosure I leave to you!
I plan on making an enclosure out of clear perspex, probably by cutting pieces to approximately the size of theboard, and allowing enough space for the knobs to stick out of the back.
I will also add a power switch to allow the battery to last!
I suspect that dad will make his enclosure out of wood, cause he is an awesome woodworker :-)
You can make your enclosure from anything you like!
Step 12: Parts List
Here is the full list of components that I took to Jaycar.
1 x 0.033uF Polyester
1 x 0.05uF Polyester
2 x 0.1uF Ceramic
2 x 100uF 16V Electrolytic (I substituted a 22uF tantalum for one of the electros, as I couldn't fit it into the space properly.)
Resistors (all 5% tolerance or better)
1 x 10R
1 x 560R
1 x 1k0
2 x 1K5
1 x 1K6
2 x 1k8
1 x 2k0
2 x 2k2
2 x 2k4
2 x 2k7
2 x 3k0
2 x 3k3
1 x 3k6
2 x 3k9
2 x 4k3
2 x 4k7
1 x 24K
1 x 1N4004 Diode
1 x LM386 Audio Amp
1 x LM555 timer
2 x 8 pin machined pin sockets
1 x 4k7 linear potentiometer
1 x 10K log potentiomener
1 x 9v battery snap
1 x 9v battery
1 x 8 Ohm 2" speaker
1 x mono output jack (1/4")
Ballpoint pen for a stylus
Banana Plug for the stylus
Instrument wire (500 strand) for the stylus lead
Perspex sheet 12" x 12" or wood. Sadly, not an Altoids tin!
Step 13: Parts Cross Reference
I found this list useful when I was assembling the PCB - I simply marked off each component added as I soldered them into the board.
C3 100uF - I ended up using a 22uF Tantalum to fit in the space - the exact value doesn't matter
Step 14: A Layout With the Parts on the Bottom
A few people have expressed concern about having to solder the parts on the same side of the PCB as the copper - So I have modified the layout in this step to allow the parts to be mounted on the traditional (non-copper) side of the board.
That will make it easier to manufacture, in exchange for having the parts underneath the board.