(Note- This is a guest post for Eureka!Factory by Chuck Stephens as part of their Instructables Build Night program.)
In a previous project I created a prototyping board for the Circuitscribe circuit building kit. Here I'll use it with the Circuitscribe developer boards and a simple DIY keyboard to explore some basic sound synthesis circuit concepts. I'll show how to create a simple audio oscillator with a 40106 Hex Schmitt Inverter chip and two additional components on the prototyping board. I'll use the Circuitscribe's blinker board to create two separate audio effects- a low frequency oscillator and a gate. I'll also demonstrate the use of a potentiometer to control the pitch of the audio oscillators output and then I'll create a simple DIY resistor ladder keyboard with conductive ink.
Step 1: Building the Oscillator Circuit on the Prototyping Board
In this project we'll use the Circuitscribe prototyping board to create a simple inverter based audio oscillator, and control it with elements from the Circuitscribe kits. The CD40106 Hex Schmitt Inverter is an awesome chip for the new electronics student. It features six separate inverters. An inverter is a digital logic gate. It detects if the input is high (on) or low (off). If the inverter detects a high input signal it produces a low output. If it detects a low input it gives a high output. It inverts the state of the signal. By adding a capacitor and a resistor to the inverter, it can be made to oscillate, or turn high and low over and over again.
The time it takes to turn on and off is called the rate and is determined by the values of the capacitor and resistor used. Each pulse, or on/off cycle, will produce an audible click if the output is fed to an amplifier and speaker. At very high rates the oscillator circuit produces audible sound. As the rate gets faster, the clicks get closer and closer until they produce a buzz that becomes a tone. At these speeds rate is called frequency. We perceive differences in frequency as musical notes. In the audible range frequency is called pitch. Middle C, the center note on a piano, has a frequency of 261.625565 hertz. Hertz is the unit used to measure frequency and represents the number of pulses per second. This means that an oscillator has to turn off and on 261 times each second to produce a Middle C. By changing the resistance in the oscillator circuit it is possible to create varying pitches over time, or as professional scientific types call it, 'music'.
See the pics above for details and study the circuit diagram to see how the inverter based oscillator works, then go on to the next step to see how to control the oscillator with the Circuitscribe components.
Step 2: Controlling the Oscillator With Circuitscribe Components
Now that the oscillator is assembled on the prototyping board I'll show you how to control it with the potentiometer and blinker from the Circuitscribe kit.
The first step was to determine the layout and trace the contact points with the template from the kit. This makes aligning the components easy. See the above pics for a step-by-step description of the circuit. I designed it to work without the blinker board at first to make it easier to determine the capacitor and baseline resistor values. When it was time to include the blinker I simply cut the drawn line with a hobby knife.
Step 3: Creating a Paper Resistance Ladder Keyboard
As I said, the frequency is determined by the values of the resistor and capacitor in the oscillator circuit. Since there are so many options for variable resistance- potentiometers, light dependent resistors and transistors, thermistors, surface pickups, etc.- audio circuits use resistance to determine pitch and the capacitor is used to determine the range, or ohms of resistance between notes. I will use the slight resistance of the Electronink conductive ink from the Circuitscribe kit to create a simple paper keyboard based on the idea of a resistor ladder. To understand how a resistor ladder works let's imagine a row of button switches. All of the buttons are connected on one side. The other side of the switches are connected in a line with resistors. The first switch has a lead connected to each lug, the resistor side and the common side. If voltage is fed to one lead and the first button is pressed, the voltage will be reduced according to the value of the first resistor. If the first button is released and the second button is pressed, the voltage is reduced by the value of the first resistor plus the value of the second resistor. The further down the row of buttons you go, the higher the resistance will be, meaning the lower the voltage passed. If that resistance is determining the pitch of an oscillator, we can carefully adjust the value of resistor at each step to produce notes. This is a basic monophonic (capable of playing one note at a time) keyboard. To create a simple resistance ladder keyboard for the Circuitscribe kit, I'll rely on the fact that the Electronink conductive ink actually has a slight resistance of approximately 5 ohms per centimeter. This resistance doesn't effect the simple circuits we'll be dealing with in a typical Circuitscribe project where the lines are very short and the circuits created are not very precise. What if we exploited this resistance by drawing long lines to create custom resistors?
The longer the line is, the higher the resistance on the voltage flowing through it. The booklet in the Circuitscribe kit claims that the resistance of the conductive ink is about 5ohms per centimeter. I drew a long zig-zagging line on a piece of paper with 25cm segments. Every fourth segment was attached to a drawn contact pad, giving me 100cm intervals with approximately 500ohms of resistance between pads. I ran a wire from one side of the oscillator and connected it to the first drawn pad with a magnetic contact pad. I used a jumper wire to touch the other drawn pads and complete the circuit to the other side of the oscillator, producing notes.
Step 4: Plugging in and Jamming Out
So now it's the moment of truth- what does it sound like? Honestly kind of 'buzzy'. The on/off nature of the digital signal produced by the oscillator sounds a bit raw. There are lots of options to modulate and filter the wasic wave form and you could spend years learning how sound synthesis works. For now we'll look at two of the easiest effects to create- the gate and the LFO.
By rotating the blinker board, two effects are possible. By running the blinker's output into the Vin of the oscillator, it causes the oscillator to turn on and off rhythmically as the supply voltage goes on and off accordingly. This effect is called a gate. If the blinker board is rotated so that the positive voltage input flows into the blinker and the blinker's ground connects to the oscillator's input, it causes a voltage drop when the blinker is on. This causes the voltage into the oscillator to fluctuate rhythmically. Instead of turning on and off like the gate, it produces a warbly, alarm effect comprised of two different pitches. While this effect is more pronounced when driving a voltage controlled oscillator, or VCO, it still has an interesting effect on the 40106's output. This is called a low frequency oscillator, or LFO.
The potentiometer is there to change the pitch. The pitch can start high all the way to left and fall as you turn it clockwise or start low and get higher depending on how the potentiometer is rotated. Playing around with pot wiring is a good way to figure out how they work. Basically, voltage flows in through one of the outside pins and comes out of the center pin. There is a strip of semi-conductive material similar to the conductive ink on the inside of the pot. This material has a higher resistance than the ink, allowing the resistance to go from 0 up to several hundred thousand ohms or more in a single turn. There's a contact connected to the rotating center shaft that's connected to the center pin of the pot. When the shaft is rotated, the contact point moves closer or farther away from the other connected pin, making the resistance higher or lower.
Check out the video to see how it sounds and how the changes in the component layout affect the sound.