### Author Topic: Astable Multivibrator  (Read 13011 times)

0 Members and 1 Guest are viewing this topic.

#### Longhair

• Regular Contributor
• Posts: 80
##### Astable Multivibrator
« on: January 07, 2011, 06:00:39 am »
I made an astable circuit on the breadboard with 2 LEDs and it works no problem.

Is it possible to have both LEDs have power at the same time for the same duration without using a microcontroller? So instead of 1 - 2 - 1 - 2... it would be 1 - 12 - 2 - 12 - 1 - 12 - 2...

If so, what would this be called if it does have a specific name?

Thanks

#### Jimmy

• Regular Contributor
• Posts: 224
• Country:
##### Re: Astable Multivibrator
« Reply #1 on: January 07, 2011, 06:16:31 am »
You can do it with simple ttl logic and 555 timer

#### Zero999

• Super Contributor
• Posts: 19676
• Country:
• 0999
##### Re: Astable Multivibrator
« Reply #2 on: January 07, 2011, 05:55:26 pm »
It's quite tricky.

You need an oscillator, counter and some gates to switch on/off LEDs depending on the count and resetting it when it reaches the maximum value.

The first step is to build a truth table, by convention inputs to the logic gate, from the counter are A, B, C, D etc. and the outputs from the gates driving the LEDs  are some other letters.

For example in your case:

There are four states, so you need a two bit counter 22 = 4, if you needed five states, you'd need three bits 23 = 8 and reset the counter when it reaches five in binary. Fortunately you don't need any reset circuitry.

A B | X Y
0 0 | 1 0
0 1 | 1 1
1 0 | 0 1
1 1 | 1 1

X = (A.B')'

Draw the circuit (see attached).

Do the same for Y.

Plenty of tutorials on Boolean algebra can be found using Google, here's a good one.
http://www.doc.ic.ac.uk/~dfg/hardware/HardwareLecture01.pdf

I think the 74HC series is best for what you want because it can drive LEDs directly, is low power and will work from two AA cells connected in series. TTL is rubbish, it's fussy about the power supply (4.5V to 5.5V) and uses lots of power, CD4000 is slightly better but you'll find that if you've connected an LED to an output it'll be dim and you can't use the same output pin to drive other gates because the LED will reduce the voltage to much.

Rather than messing around with a 555 timer and counter, I'd recommend the 74HC4060 which has an oscillator built-in. All you need to do is use two outputs adjacent to each other for A and B, for example, Q5 and Q4.
http://www.fairchildsemi.com/ds/MM/MM74HC4060.pdf

I hope you can now see why it's easier to use a microcontroller for tasks like this.

#### jahonen

• Super Contributor
• Posts: 1054
• Country:
##### Re: Astable Multivibrator
« Reply #3 on: January 07, 2011, 06:31:48 pm »
Alternative approach would be 4017 and some diodes, but that would require an oscillator (a tradeoff for simple output decoding).

Regards,
Janne

#### Longhair

• Regular Contributor
• Posts: 80
##### Re: Astable Multivibrator
« Reply #4 on: January 07, 2011, 06:45:25 pm »
I'm messing around with some basic circuits on the breadboard getting familure with the basics.

Some bicolor LEDs arrived yesterday and I thought I would test them out by making an astable multivibrator. I found this circuit ( http://www.reprise.com/host/circuits/transistor_flasher.asp ) and made the one on the right with two single color LEDs. Once I got it working, I removed the 2 LEDs and put one of the bicolor LEDs in. I noticed that when there was power for both color pins, it turned yellow - maybe less than a half a second by eyeballing it. So that is where the idea came from.

Now I do have a question where I haven't been able to find a real answer for.

Every circuit that I have seen either has a schematic with the values included or not included. For example, I am reading the Make: Electronics Learning by Discovery book and it does a great job explaining what and how a resistor, capacitor, diode, etc. works. What it isn't telling me is how to figure out the values of everything. If I wanted to know what resistors to use with how many of a certain color LED, I can open up a website, plug in a couple of numbers and it tells me exactly what I should use. I would like to know how I would be able to do that on my own.

Going back to the astable multivibrator circuit ( http://www.reprise.com/host/circuits/transistor_flasher.asp ), say I didn't have the 2N3906 but used a SS8550 instead (random transistor out of parts box). How do I figure out which resistors and capacitors to use to get the same result to the point where if both circuits were next to each other on the same breadboard, they would be at the same rates?

#### apex

• Regular Contributor
• Posts: 72
##### Re: Astable Multivibrator
« Reply #5 on: January 07, 2011, 07:47:34 pm »
So, if you're just experimenting, use the same values or try them out.
If you want more detailed values, you can calculate around with the hFE and the currents.
But if you want to do something easy, just use a simulator like LTSpice.

Basically, what you can say is that almost every transistor behaves the same way:
A input current is amplified (mostly by a factor of 100) and then given out.
The difference between transistors is more the maximum voltage and current, they can do.

apex

#### Zero999

• Super Contributor
• Posts: 19676
• Country:
• 0999
##### Re: Astable Multivibrator
« Reply #6 on: January 07, 2011, 07:57:41 pm »
The Wikipedia article on the astable multivibrator shows you how to calculate the timing resistor and capacitor values.

The series resistor value calculation can be found here: http://www.kpsec.freeuk.com/components/led.htm#calculate

By the way, I've just realised the the Boolean expression for X in your previous question can be simplified to X = A' + B

The whole thing can be built using a dual flip-flop IC such as the, 74HC74.

Configure one half as an astable multivibrator and the other as a divide by 2 counter. This will give four binary outputs, two counting up i.e. 00, 01, 10, 11 and their complements which will count down 11, 10, 01, 00.

Connect X to diode OR gate with  A' + B.

Y = A + B so that makes it easy too.

I'll post a schematic if you like.

#### NiHaoMike

• Super Contributor
• Posts: 9154
• Country:
• "Don't turn it on - Take it apart!"
##### Re: Astable Multivibrator
« Reply #7 on: January 08, 2011, 05:23:22 am »
You can make a triangle, sine, or sawtooth oscillator and connect one LED between Vcc and output and the other between output and ground. With the correct selection of resistor values and supply voltage, both LEDs would appear on for a time.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.

#### mikeselectricstuff

• Super Contributor
• Posts: 13835
• Country:
##### Re: Astable Multivibrator
« Reply #8 on: January 08, 2011, 12:15:16 pm »
Another way to do short arbitary sequences is use a 4017 counter - this gives a 1-of-10 output, so with dides like the above example you can do any permutation of LEDs at each step. To set the sequence length you connect the  reset input to the output after the last one used.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs

#### bearman

• Regular Contributor
• Posts: 53
• Country:
##### Re: Astable Multivibrator
« Reply #9 on: January 09, 2011, 05:51:41 am »
Just use a 555 timer in astable mode.  See app notes of 555 for RC values and use a potentiometer for varying the clock rate.

Plug clock output into the 4017 circuit that jahonan shows above.  Use the steering diodes (1n4148) as shown and you can come up with all kinds of LED flashing sequenses.

I used this same basic circuit to come up with traffic light (stop light) sequences for east/west and north/south directions of travel for model railroad layouts.  I slowed the clock down to multi second delays and came up with a steering diode scheme to display the red, green and yellow lights in a realistic signal sequence.

555 timers are 30 cents,  4017 is 55 cents.   Transistors, resistors and capacitors are pennies.  This is much cheaper than setting up a MCU to do this

For more current to drive the LEDs more brightly use general purpose transistors to provide more current to the LEDs.   I think the 4017 only sinks 6 milliamps and sources less than a milliamp.  LEDs can mostly be driven with up to 20 milliamps.

When using transistors for switching don't get hung up with gain too much.  You just want to bias the transistor base with enough current to drive collector and emmitter to saturation.  Generally I have found 10k ohms between a logic gate and transistor base will work for power supplies from 5 to 12 volts.

5 to 12 volts is perfect for 555 and 4017 chips.

Hope this helps.

B
Work is for people that don't know how to fish.

#### Zero999

• Super Contributor
• Posts: 19676
• Country:
• 0999
##### Re: Astable Multivibrator
« Reply #10 on: January 09, 2011, 08:39:02 pm »
The CD4017 doesn't need series resistors when powering LEDs as it limits the current itself. The only thing is that if LEDs are connected to the outputs they can't be connected to other CMOS inputs because the voltage will be loaded down too much.

A lot of people seem to be recommending the old 555 timer. I don't know why. I don't think it's the best IC for this application: it draws a lot of current, has a minimum operating voltage of 4.5V and a high output saturation voltage. I think building an astable multivibrator from a couple of logic gates is a better idea because it uses less power and the spare gates can be used to buffering or logic when powering LEDs.

Here's my idea. Half of the 74HC74 is used as an astable and the other half as a divide by two counter and the outputs are OR'd with diode gates. Note that this will not work with the CD4013, unless the LEDs are driven with transistors due to the loading on the outputs.

• Super Contributor
• Posts: 1013
• Country:
##### Re: Astable Multivibrator
« Reply #11 on: January 10, 2011, 01:55:16 pm »
I'm afrad that, even though I'm a grizzled dyed-in-the-wool hardware engineer, this one is shouting "Use a PIC12 and get it over and done with". Yeah its a cheat, but that's engineering for you, it is all cheats.

#### Longhair

• Regular Contributor
• Posts: 80
##### Re: Astable Multivibrator
« Reply #12 on: January 10, 2011, 06:42:26 pm »
Thank you everybody for your replies and many different solutions to my question.

As of right now most of this stuff is over my head but that doesn't mean that I won't look into it in more detail in the future. Once I cover a particular subject in my self studies (such as ttl logic), then I will revisit the idea and make it work just so I get a clearer understanding of the subject.

#### Zero999

• Super Contributor
• Posts: 19676
• Country:
• 0999
##### Re: Astable Multivibrator
« Reply #13 on: January 11, 2011, 08:30:29 pm »
I'm afrad that, even though I'm a grizzled dyed-in-the-wool hardware engineer, this one is shouting "Use a PIC12 and get it over and done with". Yeah its a cheat, but that's engineering for you, it is all cheats.
It don't know. The cheapest PIC I could find is still 5 times the price of the 74HC74.

Another thing, if the thing is being powered from a 9V battery, the CD4017 and CD4011 is probably a better idea: no voltage regulator is required, the series resistors can be omitted and the CD4011 + CD4017 cost less than the cheapest PIC and voltage regulator IC.

Thank you everybody for your replies and many different solutions to my question.

As of right now most of this stuff is over my head but that doesn't mean that I won't look into it in more detail in the future. Once I cover a particular subject in my self studies (such as ttl logic), then I will revisit the idea and make it work just so I get a clearer understanding of the subject.

The CD4017 idea is the easiest to understand, it's just counts the pulses made by the oscillator and the diodes on the outputs power up the appropriate LEDs.

The 74HC74 is a little harder. The first flip-flop just works like your astable multivibrator, the second as a counter which divides the frequency by two. Again the diodes just turn on the appropriate LEDs.

EDIT:
I've noticed a problem with the CD4017 idea: the outputs are too weak to drive two LEDs. This can be solved by using buffers to drive the LEDs. The CD4069 contains six, two of which can be used as an oscillator to drive the CD4017.

• Super Contributor
• Posts: 1013
• Country:
##### Re: Astable Multivibrator
« Reply #14 on: January 12, 2011, 09:09:00 pm »
The new forum still seems to be failing to show / download images by the way.

Cost is always a tricky bugger to pin down and very subjective. In my case I have a stack of PIC12 freebie samples, a programmer and assembler installed. So for a one-off it would purely be costing my time to plug it in a proto board, hack some code and away it goes.  It would do linear scanning, Johnson counting (which I think is what the original poster wants), count up/down, smooth fading or whatever, without any change of hardware. Of course, if you don't have any of these then it gets expensive! But I do, so that was optimal for me.

In commercial quantities, I still suspect a 41 cent PIC12 would be cheaper than 555/4017+passives or flipflop chain, when you consider the larger board, and costs involved in populating it. Of course, the 'proper' way would be to make your own flip-flop chain with a box of BC547s! This is what I love and hate about electronics, so many ways to achieve the same ends, via totally different routes and each with it's own advantages and drawbacks. I guess that is what makes it engineering and not science.

#### Zero999

• Super Contributor
• Posts: 19676
• Country:
• 0999
##### Re: Astable Multivibrator
« Reply #15 on: January 12, 2011, 10:28:25 pm »
In commercial quantities, I still suspect a 41 cent PIC12 would be cheaper than 555/4017+passives or flipflop chain, when you consider the larger board, and costs involved in populating it.
If you want cheap, don't even bother packaging the IC, just do chip on board, like lots of cheap electronics.

Smf