Sunday, February 24, 2013

Electronics for Ourself: Attempt One: Astable Multivibrator

I just realized that even though I do electronics I am not an engineer. I remember when I first started programming. I could copy others code and change small stuff(like I can with Python) but when I started to delve into a learn how exactly everything work I could read code and write masterpieces. This took lots of study and reading and practice. I want to attempt to learn electronics like I did coding, I think it opens up so many creative avenues for myself.

Electronics experiment for the day(this post took me like a week haha) the astable multivibrator. Or Try and Blink LEDs

The Astable Multivibrator circuit was more complicated then it looks at least to me, needing to teach myself all the basic electronics I really don't know. An astable multivibrator does basically what it says, it vibrates a current by switching/oscillating between two transistors using two capacitors. It is called 'Astable' because the circuit is not stable in either state or oscillates between states.

Basically all that it is composed of is:

2x NPN transistors
4x Resistors
2x Capacitors
We will add LEDs because I am assuming you might not have an oscilloscope (I don't yet).
2x LED

First we need to figure out transistors. So an NPN transistor  has two terminals termed the collector (the lead the light is connected to in the picture) and the emitter(the lead with the arrow in the picture), and a base. When one applies a small voltage or current to the base it allows a voltage to run from the emitter to the collector. I stole this picture from wikipedia but it is a good example:

What we see is that the transistor is connected to both the positive voltage and the ground. We would expect a voltage to flow through it but it doesn't because the transistor is separated into 2 distinct regions an N (electron negative) region a P (hole or positive) region. An NPN transistor has two N regions separated by a P region. and a PNP transistor has two P regions separated by an N region. So in the N we have electrons which we want to flow in a certain direction, the bias of the transistor. In the NPN the electrons are separated by the hole. So let us think that when we are applying a voltage to the base we are causing the holes to pair with electrons in the P. Once we apply enough current enough holes are paired to bridge the Ns that we see electrons from the positive N flow to the ground N because electrons want to move in the direction of the current. A PNP transistor works the same way except with holes instead of electrons.

It took me a fair bit of time to find a good explaination(not a misspelling) of how the holes and electrons move and even those were poor so don't fault me too much!

So on to the Astable multivibrator. Again picture from wikipedia.

In an astable multivibrator we have two capacitors that are charged and subsequently discharged causing the voltage to oscillate between two different paths. So how does this work? So in this diagram we will assume R1 and R4 are low value resistors(1K ohm) and R2 and R3 are high value resistors(10K ohm, higher than R1 and R4 I mean). Once we turn on the circuit the Voltage is looking for a way to get from V+ to 0V. We have 4 resistors is parallel which means that the flow of electrons is going to try and traverse through all of them.  So what happens is that initially one of the NPN transistors let's say Q1, receives electricity to it's base slightly faster than Q2. When this happens electricity can flow through capacitor C1 because the Collector-Emitter(left and right nodes) bridge on Q1 is opened up. So initially C1 has no charge and this keeps Q2 off. But based on the value of R2 it starts to build up charge and once the voltage on the left lead of C1 reaches the activation voltage of Q2, Q2 switches on. Due to the initial low value of the left lead of C2, Q1 switches off and then it happens again. C2 charges until the left lead hits the activation voltage of Q1. This is a pretty complex little circuit and I know alot more is going on then in my simple explaination but I am glad I grasped at least this much.

Now if we put an LED between R1 and V+ and R4 and V+ whenever either transistor, Q1 or Q2 switches on so will the LED! The frequency of the oscillation is ~ 1/0.7*(R2*C1 + R3*C2) . The 0.7 is juts a constant from the derivation.
I used:
R1 and R4: 1K ohm
R2 and R3: 10K ohm
Transistors: 2N2222a
Capacitors: 10uF

So we are oscillating at about 7 hertz.

Wheew. Hopefully attempt two goes faster but I learned a shit ton about transistors and capacitors writing this post!