Results for category "LED Circuits"

This, Jen, is the Internet

Matt 0 Comments

This isn’t much more than an “I made a thing” post. You have been warned.

The Internet!

I’m sure many of you are familiar with the iconic British sitcom “The IT Crowd”. There are so many memorable quotes and gags, but my favourite has always been “The Internet” from the series 3 episode “The Speech”. I liked the episode so much that I decided to build my own replica of the little black box.

The box was the hardest part to find. I recognised is as a Maplin project box, but Maplin are long gone from the high street, and the online incarnation don’t seem to sell them. Thankfully I never throw anything out, and I had one in a box in my garage that I bought years ago. The next step was to build a circuit that could sit inside the box – hence my renewed interest in the astable multivibrator circuit.


The circuit board inside the box was designed in Kicad. It measures 40mm x 40mm so is small enough to fit into many different project boxes and enclosures. I added M3 mounting holes to the corners, though in the end I didn’t end up using them when mounting the board inside the project box.

The board in Pcbnew, Kicad’s board layout view.

The component footprints are not included on the silkscreen. Ordinarily it is a good idea to include them if you have the space, but because I wanted to be able to select different component values for different flashing rates I left them on the fabrication layer. Having them already there means that should I decide to make a board where fixed values are required I can switch them back to the silkscreen layer easily.

The transistor, LED and capacitor component footprints are all customised. I wasn’t sure what transistor I’d end up using so instead of using one of the standard TO-92 footprints I created one that showed which pin should go where. This is useful because while some transistors like the 2n2222 are manufactured so that pin 1 is the emitter, pin 2 is the base and pin 3 is the collector, others such as the BC547 have the collector and emitter reversed. The pin pitch of the footprint is 1.27mm, so transistors can be soldered flush with the board. This is aesthetically pleasing, but can be difficult to solder.

The capacitor footprint has 3 pins, so that parts with a 2.5mm or 5mm pin pitch can be used. This was for my convenience, because most of the electrolytic caps I have have a 2.5mm pitch, but the multilayer ceramic caps I have all have a 5mm pitch, and I wanted to avoid bending the leads as much as possible.

The LED footprint is based on a standard footprint, but I added polarity markings so that if pin headers were used instead of soldering the LED directly to the board it would be easy to see which way round to plug the connector in.

The board mounted inside the box

To get the board to work with only one LED the second LED footprint must be shorted with a link. It is a good idea to use a higher value resistor between the voltage rail and the positive side of the shorted LED pad. This will limit the current through the transistor so that when the LED is off less current is being shorted to ground.

I used the following component values to achieve the short flash followed by a long pause:

R1330 Ω
R2470 kΩ
R31 MΩ
R447 kΩ
C11 μF
C210 μF

Lessons learned

This was a fun little project, and it feels good to get back to using KiCad again. Making my own component footprints was interesting, and I’m proud of how this board turned out.

The only change I would make if I was to have a second batch made would be to change the TO-92 footprints to ones with a pitch of 2.54mm. The transistors end up sitting higher on the board so they aren’t as aesthetically pleasing, but they are much easier to solder. I did design an alternative version of the board in Kicad, but I haven’t bothered to get it manufactured.

A render of the version of the board with 2.54mm spacing between the transistor legs.

I was going to use stand-offs to mount the board inside the box, but I didn’t have any plastic ones that I could glue to the bottom plate. Instead I used double-sided tape strips. It’s not ideal, but I didn’t want to screw through the bottom of the box.


If you want your own astable multivibrator PCB I’ve included download links below for the Kicad project and gerber files for both versions of the board.

Gerbers (1.27mm TO92)
Gerbers (2.54mm TO92)
KiCad Project

The Astable Multivibrator

Matt 0 Comments

One of the first circuits I ever build on a breadboard was the ubiquitous astable multivibrator. Two NPN transistors, two capacitors, two LEDs and four resistors. It’s a circuit that just about every electronics engineering student and hobbyist builds at some point in their life. Sure, a 555 in astable mode uses fewer components, and is much more flexible, but unless you know what happens inside that little 8 pin black box it may as well be magic. The classic astable multivibrator has no tricks hidden away – it’s all there for you to poke at and and analyse.

Schematic of the astable multivibrator

How It Works

The circuit takes advantage of the imperfections inherent in all electronic components. Every component of a given type is slightly different due to factors such as the manufacturing process and the raw material used. This can be undesirable in some situations, but it is essential in the case of the astable multivibrator.

When power is first applied current flows to the bases of both transistors through R2 and R3, charging C1 and C2. As soon as one of the capacitors reaches the base emitter saturation voltage of the connected transistor (around 0.6v depending on the transistor used) it will go into saturation and turn on.

Let’s assume that it is Q1 that goes into saturation. It will turn on and allow current to flow through it, turning on LED D1. While this is on, capacitor C2 starts charging up through resistor R4 and LED D1. Meanwhile, C1 will begin to charge through R2.

As soon as the voltage across C1 reaches the base-emitter saturation voltage of Q2 (again, around 0.6v) it turns on Q2, lighting up LED D2 and causing capacitor C2 to discharge nearly instantly. This causes the voltage on the opposite side of C2 to drop considerably, bringing the base of Q1 below 0.6v and turning it off.

Now capacitor C2 starts charging up via R3 and C1 starts charging up to 5v. Once the voltage across C2 reaches the emitter-base saturation voltage it turns Q1 back on, discharging C2 and turning Q2 off.

The whole cycle repeats as long as the circuit is powered.

Choosing Component Values

The oscillation frequency is determined by the values of resistors R2 and R3, as well as capacitors C1 and C2. The total period of oscillation (T) can be determined by adding together the periods of time that each transistor is switched on. These values (t1 and t2) can be calculated using the following formulas:

T = t1 +t2
t1=0.693 x C1 x R2
t2=0.693 x C2 x R3

All time values are in seconds, all resistor values are in ohms, all capacitance values are in farads.

0.693 is derived from the RC time constant, or τ. At 0.693 of one time constant the capacitor is at 1/2 of its maximum charge.

Finding the frequency (ƒ) of oscillation is a simple case of finding the inverse of T.

ƒ = 1/T

Using the schematic above, where C1 and C2 are 47 μF, and R2 and R3 are 47 kΩ, we can calculate the frequency with the following equations:

t1=0.693 x 0.000047 x 47000 = 1.530837
t2=0.693 x 0.000047 x 47000 = 1.530837
T = 1.530837 + 1.530837 = 3.061674
ƒ = 1/3.061674 = 0.326618706 Hz

Resistors R1 and R4 should be of a lower value than resistors R2 and R3. When the circuit is being used to flash LEDs then a value should be chosen based on the forward voltage and operating current of the LED. If not using LEDs in the circuit then keep the resistor values of R1 and R4 lower than R2 and R3. If you choose values that are too high the circuit will not oscillate.

See the table below for a pre-calculated table of frequencies and component values.

Capacitor Values
1 nF10 nF100 nF1 μF10 μF
Resistor Values
1 kΩ724.638 kHz72.464 kHz7.246 kHz724.638 Hz72.464 Hz
2.2 kΩ329.381 kHz32.938 kHz3.293 kHz329.381 Hz32.938 Hz
4.7 kΩ154.178 kHz15.418 kHz1.542 kHz154.178 Hz15.418 Hz
10 kΩ72.464 kHz7.246 kHz724.638 Hz72.464 Hz7.246 Hz
22 kΩ32.938 kHz3.294 kHz329.381 Hz32.938 Hz3.294 Hz
47 kΩ15.418 kHz1.542 kHz154.178 Hz15.418 Hz1.542 Hz
100 kΩ7.246 kHz724.638 Hz72.464 Hz7.246 Hz0.7246 Hz
220 kΩ3.294 kHz329.381 Hz32.938 Hz3.294 Hz0.329 Hz
470 kΩ1.542 kHz154.178 Hz15.418 Hz1.542 Hz0.154 Hz
1 MΩ724.638 Hz72.464 Hz7.246 Hz0.7246 Hz0.0725 Hz

What can I use it for?

The most basic use of this circuit is to blink one or two LEDs. I built one up on stripboard when I was quite young and used it to flash two LEDs back and forth on my model railway level crossing.

Another use would be to connect the emitter of one of the transistors to the bass of another transistor. This allows the circuit to switch higher current loads, such as a relay.

It is also useful as a basic tone generator. To do this, connect a speaker instead of a relay to the configuration and swap the capacitors for two 47nf capacitors. This will output a tone that is roughly 700 Hz.

More to come…

I encourage you to build up the circuit on a breadboard and see what you can come up with. In my next post I will be showing a project I have built using the astable multivibrator at its core.