Beepy things...because school.

As part of the course ES-93-5, "Music and the Art of Engineering", I am required to build a lot of things on breadboards.

I. Hate. Breadboards.

Or rather, I hate the fact that whatever I build on them usually requires n times more effort than what I'd put into say, etching a board, and that the breadboarded project ends up being a waste of time because at the end of the day, I have a breadboard.

That isn't to say breadboards aren't good for anything. It's just that they're terrible. 

The current assignment requires the construction of the following circuit (or something similar; the bare minimum does not require so many oscillators):


Broken down, this is a a bunch of NAND gate (with hysteresis) oscillators feeding into a power amp, specifically, an LM386, which then feeds audio to a speaker. 

Now, I find it quite quaint that my latest "project" is essentially a repetition of my first "legit" EE project, namely, a 555 timer organ I built in the summer of 2012. As someone who had a lot of trouble finding a good explanation as to how these worked, I see it fitting that I write one here. 

The concept behind signal production remains the same in both the NAND gate oscillator and the 555 timer organ of yonder: the frequency of the signal is determined by the time constant of each RC circuit formed from the output resistor and the accompanying capacitor. 

Let's look at this closely.

JP1 consists of a switch between one of the NAND gate inputs and "high" (9V), and R12 is a pulldown resistor (sets input "2" to 0V when there is no voltage applied through the switch).

Potentiometer R2, R11, and C4 consist of an RC circuit that determines the frequency of the oscillations. R26 is the input resistor that eventually feeds into the summing op-amp used to drive the speaker.

When the switch is open, input 2 is OFF, making input 3 ON. This is regardless of the value of input 1. When input 2 is ON, the state of input 1 can then alter the output of the NAND gate.

While the output is ON and there is no induced oscillation, the RC circuit charges up, but does not discharge, and it assumes steady state behavior. 

However, when input 2 is ON, the RC circuit will charge up, causing the capacitor's voltage to appear at input 1. This causes the NAND gate to change its output to OFF. It's during this off period that the RC circuit then discharges (all the while, input 2 is still ON, and input 1 appears ON for now). Once the voltage across the cap goes below the threshold voltage, the output will then go to an OFF state. 

http://upload.wikimedia.org/wikipedia/commons/3/31/Opamprelaxationoscillator.svg
One half of each cycle consists of the charging and discharge of this RC circuit (illustrated by the red waveform above). 

Thanks to the magic of hysteresis, the trigger voltage at which the NAND gate decides the voltage is ON or OFF is roughly that after 1 time constant. 

This allows us to specify the frequency further as now, the period can be defined as two time constants.

with f = 1/T, f = 1/(2RC)

This then allows us to "tune" the frequency of each oscillator with values of R and C to acquire a specific frequency, thus explaining why a potentiometer is added to the resistance of the RC circuit. 

Here is a spreadsheet of the approximate R values for a 'C' scale:


You can also substitute your own values of C. 

The (semi) finished product (note the lack of battery connectors)

Yay, beepy things!






Comments