Wednesday, April 4, 2012

Silly pointless stuff... (Mr Jiggles)

Let's do something silly and pointless... say we come across a crystal (in our junkbox, our backyard, wherever) and decide to make an oscillator.  (There are many many ways to do this but for the heck of it let's just play around and see if we can make it work).

I like to think of crystals as highly ordered structures that deform a bit in the right kind of electric field - remove the field and they go back to their original state and in the process create a tiny electric field of their own.   Now depending on how the little crystal is cut, what it's composed of, how it's treated it will have at least one frequency at which it likes to oscillate.

The problem is that the amount of energy stored in our crystal (let's call him Mr Jiggles) is very very tiny.  If we just attach a voltage source (DC), the crystal will never get the chance to cycle between a deformed and a native state... When we want an alternating current and not direct current we put a capacitor in line.  A good guess is something like 1 to 20 pf (too much capacitance or too little capacitance will not work well - remember the crystal needs to draw and throw a small amount of energy and the matching the cap to the amount makes it happy).

The other thing we need to consider is how we will make the little amount of energy useful - we need to make it bigger.  It happens that our little friend (the npn bjt) does a great job of taking a tiny current and making it bigger. 
Originally I thought of using a 3904 but I had a bc347 out already so I'll just use that (generic-ish standard npn that easily covers the voltage ranges and current and frequency here).  Like everything else there are a lot of ways to use these components - for our purpose I want to start with a fixed current so I don't blow things up.  My favorite little current limiter is a little resistor and an led (I like 8 volts for these transistors so a 4.7k resistor gives between 1 and 2 mA witht he led voltage drop). 

I know I'm going to link the crystal to the base (to control a bigger current collector to emitter) and I know we need a voltage to load the crystal (but not a lot) so let's start with a 220k resistor to pull the base high from the collector.


The last thing to think about is what happens to the AC amplified signal we make...  It's not going to be nice to the power supply (or the ground) if we allow the AC component to just flow where we don't want it.  I like to put an inductor inline with the supply (the magnetic field induced by the current flow resists changing at certain frequencies - kind of like the opposite of a cap).  This way way little AC signal can propagate back to the supply. Speaking of capacitors we need to do something about emitter of the transistor where it attaches to ground.  While the resistor/led combo will provide a DC path (and limit the current flow) but I want to add a cap to filter the AC.  Right now I don't care what size, I'll change it later.

It's a good thing to build this out really quick and make certain it works... If you attach 8 volts across the collector and the led it ought to stay lit and if you short the base to ground it ought to go off (the 220k resistor limits the current so nothing bad will happen and you won't break anything).

The last thing on my mind is how to get the crystal jiggling int he first place... one way is to feedback a bit the output from the emitter (always a little noise at the start).  We can do this with a pair of little caps across the crystal (small values - 1 to 20pf-ish).  This may not be needed, but what the heck let's just put them in place.  It's also not a bad place to sample the signal from the crystal without causing too much distortion from the probe.

And when we try it out, it works (well at least it jiggles)... except it's not a very pretty signal.  Let's try to figure it out...

Ahhhh... silly mistake.  If you look back at the sketch I connected the crystal directly to the base (and this isn't going to leave any room for the jiggling to happen unimpaired - like trying to dance in a car - not going to be beautiful).

Putting a cap (20pf) in line between the crystal and the base of the transistor makes things a lot better, but there is still some unhappiness.  It looks like the rate of increase gets ugly (bad slope) when the voltage get's high - but it doesn't seem to occur when the voltage drops (except perhaps a bit on the very lowest voltage)...

If we try changing the cap on the emitter (remember I just grabbed one at random at first) if makes things much worse if we increase it.

If we make the cap on the emitter smaller (here 20pf) it's much nicer... but still not a happy sine wave.  Interestingly the shape on the upper voltage is wider than the lower voltage area... why would that be? 

Enough for today... think about it and we'll see next time.,.