Author Topic: PWM signal from 555 timer  (Read 38240 times)

0 Members and 1 Guest are viewing this topic.

Offline fsleeman

  • Regular Contributor
  • *
  • Posts: 54
PWM signal from 555 timer
« on: September 26, 2010, 12:14:05 am »
I have been trying to make a PWM generator from a 555 to control a fan and started with this circuit: http://www.kpsec.freeuk.com/555timer.htm#astable. I have been able to make an LED flash at the specified frequency but haven't had luck correctly setting the duty cycle.

The formula is:
 Duty cycle  = (R1 + R2)/(R1 + 2R2)

which I have seen in other places as well. When I try to make that circuit, I seem only get a duty cycle close to 50% when I inspect it with an oscilloscope. When I change the R1 and R2 resistors in the shown circuit, I seem to get a lot closer to the duty cycle I am trying to get.

Can anybody verify if this formula or circuit is correct? If I am trying to get a 75% duty cycle, what values should actually work? If I solve the equation, it seems that if R2 is 10k then R1 should be 20K. Is that correct or am I doing this wrong?
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 8391
  • Country: my
  • reassessing directives...
Re: PWM signal from 555 timer
« Reply #1 on: September 26, 2010, 12:21:06 am »
i strongly believe 555 only produce 50-100% duty cycle, thats the reason i abandoned it :P. you will sometime have to cope with resistor inaccuracy (5%? 10%?) so my advice is to use potentiometer to adjust to desired PWM.
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
Moving Forward to the Future, Breaking the GHz Barrier... (DDA5005)
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 11563
  • Country: gb
  • Hero999
Re: PWM signal from 555 timer
« Reply #2 on: September 26, 2010, 12:33:54 am »
It's possible to go down to near 0% by adding a diode, see the datasheet.

Add a couple of diodes, a potentiometer and you can get PWM from 1% to 99%.
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 8391
  • Country: my
  • reassessing directives...
Re: PWM signal from 555 timer
« Reply #3 on: September 26, 2010, 12:41:55 am »
great!
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
Moving Forward to the Future, Breaking the GHz Barrier... (DDA5005)
 

Offline qno

  • Frequent Contributor
  • **
  • Posts: 422
  • Country: nl
Re: PWM signal from 555 timer
« Reply #4 on: September 26, 2010, 01:01:54 am »
Hi,

If you want a simple 0 to 100% pwm with an 8 pin dil look at this circuit.

http://www.extremecircuits.net/2010/07/luxury-car-interior-light.html

Replace the switch with a potmeter on pin 6 of opamp B and you are in business.
Why spend money I don't have on things I don't need to impress people I don't like?
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 8391
  • Country: my
  • reassessing directives...
Re: PWM signal from 555 timer
« Reply #5 on: September 26, 2010, 01:07:53 am »
great!
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
Moving Forward to the Future, Breaking the GHz Barrier... (DDA5005)
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 11563
  • Country: gb
  • Hero999
Re: PWM signal from 555 timer
« Reply #6 on: September 26, 2010, 01:35:35 am »
If you want a simple 0 to 100% pwm with an 8 pin dil look at this circuit.

http://www.extremecircuits.net/2010/07/luxury-car-interior-light.html

Replace the switch with a potmeter on pin 6 of opamp B and you are in business.
Yes, that circuit's a classic, much better than the 555 since it will go from 0% to 100% and not much more complicated either.

I'd probably replace the op-amp with a comparator IC (e.g. LM393) which will have a faster rise/fall time so will switch the MOSFET faster, although you'll need a couple of extra pull-up resistors as the ouput is open collector. Even better, choose a comparator with a push-pull output (I can't remember one of the top of my head) and get rid of the pull-up resistors.

EDIT:
Some more PWM oscillators based on CMOS logic gates (4000 series or HC, not TTL/LS). The simplest is a Schmitt trigger but you might not have a 74xC14 IC handy, the others use plain inverters so NAND/NOR gates can be used, the one with three gates has the advantage of requiring less external components than the one with only two gates.
« Last Edit: September 26, 2010, 02:06:48 am by Hero999 »
 

Offline fsleeman

  • Regular Contributor
  • *
  • Posts: 54
Re: PWM signal from 555 timer
« Reply #7 on: September 26, 2010, 05:27:15 am »
I will look at the op amp circuit but I am only looking for a very simple, static pwm signal. Since this fan is going to be enclosed in another device, I dont want to use a pot. If these 555 circuits work, I would like to know how to set a specific duty cycle.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 11563
  • Country: gb
  • Hero999
Re: PWM signal from 555 timer
« Reply #8 on: September 26, 2010, 06:58:16 am »
It's pretty easy to figure that out.

The pot can be split into two halves, because the diodes ensure the current takes a different path when charring than it does discharging.

When the pot is at 50% of its setting the duty cycle will be 50% because the charge and discharge times will be the same.

When the part of the pot connected to the diode pointing down is highest (say 90k) and the part connected to the diode pointing up is lowest (say 10k), the duty cycle will be high (about 90%) because it will take longer for the capacitor to charge than it does to discharge.

It works the other way round too, if the part of the pot connected to the diode pointing up is 90k and the part of the pot connected to the diode pointing down is 10k, the duty cycle will be about 10%.

The resistor above the pot should be very small compared to the pot (too high and the minimum duty cycle will be limited) but not too small otherwise the 555 will overheat, 1k is 1% of 100k which is fine.

The frequency is equal to the normal 555 timer formula listed on the datasheet but the value of the pot is halved or if it's two resistors, it's equal to the mean.

The same applies to all the circuits with the logic gates.

The comparator circuit is a little more complicated but it's probably not worth it for a fixed duty cycle.
« Last Edit: September 26, 2010, 07:00:52 am by Hero999 »
 

Offline tecman

  • Frequent Contributor
  • **
  • Posts: 421
  • Country: us
Re: PWM signal from 555 timer
« Reply #9 on: September 28, 2010, 01:19:22 am »
Here is a great little circuit we have used for years.  It uses a 556 (or 2 555 chips).  The upper 555 is an oscillator running at a constant frequency.  The frequency is set by Ton and Toff.  Ton is R2-C1 and Toff is R3.2 and C1.  In this case it is a 50:1 ratio, or 98% max on time.  The lower 555 is triggered and cleared by the first 555, but by modulating the control voltage you can control the duty cycle from 0% to 98%  The output is comprised of the two open collector transistors wired-or'ed.  This is nice since it gives you a constant frequency which is required in some circuits.  Voltage is shown as 12 but can be anything in the usable range of the 555.  Also watch using this at high frequencies as the 555 gets a little unpredictable over about 20 KHz.

Paul
 

Offline Rhythmtech

  • Regular Contributor
  • *
  • Posts: 189
Re: PWM signal from 555 timer
« Reply #10 on: September 28, 2010, 03:43:30 am »
Wow, I am impressed nobody suggested to "just use a micro" Nice pwm circuits, will definitely keep this thread handy for future use.
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: PWM signal from 555 timer
« Reply #11 on: September 28, 2010, 06:45:35 am »
Wow, I am impressed nobody suggested to "just use a micro"

While this is a valid suggestion, I have learned in the past that people just don't want to here that suggestion. Low-end 6 pin or 8 pin micros are cheap, have better oscillator stability, are more flexible, require less additional components than a 555, but people want a 555.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline DavidDLC

  • Frequent Contributor
  • **
  • Posts: 737
  • Country: us
Re: PWM signal from 555 timer
« Reply #12 on: September 28, 2010, 07:22:39 am »
Yes, but you need to:

1.- Create a program
2.- Have a programmer
3.- Who knows.....

And with the 555 just make the calculation, plug the components and it works !!! Oh wait, sometimes is not that simple....

I don't mind to implement either solution, it is just a matter how I feel doing things that day....

 8)
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 11563
  • Country: gb
  • Hero999
Re: PWM signal from 555 timer
« Reply #13 on: September 28, 2010, 09:22:46 am »
While this is a valid suggestion, I have learned in the past that people just don't want to here that suggestion. Low-end 6 pin or 8 pin micros are cheap, have better oscillator stability, are more flexible, require less additional components than a 555, but people want a 555.
MCUs (especially the cheap ones) also have many disadvantages compared to a simple 555 or logic even if one ignores the learning curve or requiring a programmer:

  • The cheapest MCU is still more expensive than a single 555 or logic IC, even when external components are accounted for.
  • A MCU is more picky about the power supply voltage: 2V to 5.5V at best, a typical 555 can operate from 4.5V to 18V (TTL), CMOS 555s operate over 3V to 18V, HC logic works from 2V to 6V and some LV logic can work below 1V. Yes, I know that some MCUs have built-in voltage regulators but they're more expensive and the output high voltage is the regulated voltage, not the supply voltage.
  • A 555 has a high current output capable of sourcing or sinking up to 200mA which is enough to drive a tiny motor directly, switch a MOSFET very quickly or give a power BJT plenty of  base drive. MCUs are limited to a maximum current of 25mA per I/O pin and even if several I/O are paralleled (assuming this can be done) the limit for a port is 75mA.
  • MCUs are more sensitive to noise than simple logic gates or a 555.
  • Using a MCU would need the variable resistor to be replaced with a couple of push-buttons which isn't as ergonomic as a pot and the value isn't saved unless you use an MCU with data flash memory which costs more. The solution of course is to use an MCU with an ADC but, again, that increases the cost.

In my opinion, there's no point in using an MCU for this, unless it's already doing something else, it's purely for educational purposes or your project needs to use push-buttons because there isn't room for a pot.

Another thing: did you know that the whole 555 can be connected with a MOSFET in a bootstrapping configuration so the whole circuit can be just connected in series with the load?

As well as simplifying wiring, it has the advantage of being able to do high side drive with an N-channel device which will be cheaper and have a lower on resistance.

It's better to use a CMOS 7555 because the lower current requirement means the capacitor is discharged less.

The disadvantage is that there's a minimum load requirement and the duty cycle can't be 100% as the capacitor charges when the switching transistor is off. The circuit attached gives calculations which can be used to calculate the minimum load current and the maximum duty cycle. The minimum ripple valley (VC1 - one diode drop - Vripple) should be above the voltage required by MOSFET gate to allow it to pass the required current for the load, otherwise it will get hot.

Another option is to use a logic IC circuit shown above, configured in a similar way but I chose the 555 timer because it's more on topic.
« Last Edit: September 28, 2010, 09:24:28 am by Hero999 »
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: PWM signal from 555 timer
« Reply #14 on: September 28, 2010, 03:56:32 pm »
As I wrote, people just don't want to hear it. E.g. a low-end micro is in the 0.50 USD range in quantity. So much for

Quote
The cheapest MCU is still more expensive than a single 555 or logic IC, even when external components are accounted for.

It could go on, but as I have learned in the past, people just love their 555, deal with its power supply glitches, its temperature drift and instability and all its other nastinesses.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 12418
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: PWM signal from 555 timer
« Reply #15 on: September 28, 2010, 09:45:25 pm »
It's possible to go down to near 0% by adding a diode, see the datasheet.

Add a couple of diodes, a potentiometer and you can get PWM from 1% to 99%.

you can get yet closer to 0/100% by powering the RC circuit from output and no using the discharge pin, in this way you don't need the minimum resistor as during discharge there is no supply to protect from and it discharges through the output whilst low (totem pole output)
https://www.simonselectronics.co.uk/shop New stock now in of EEVblog 121GW and Brymen 235 Now selling a selection of Probe Master probes.

Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 11563
  • Country: gb
  • Hero999
Re: PWM signal from 555 timer
« Reply #16 on: September 29, 2010, 12:53:09 am »
As I wrote, people just don't want to hear it. E.g. a low-end micro is in the 0.50 USD range in quantity. So much for

Quote
The cheapest MCU is still more expensive than a single 555 or logic IC, even when external components are accounted for.

I've heard that many times before but never seen any evidence that MCUs are really cheaper, care to post some links?

So what the cheapest MCU might only be $0.50 in large volumes but the 555 or logic ICs are still much less when bought in the same quantities.

The cheapest MCU I can find in RS is the PIC10F204 at £0.25 each, in quantities of 100.
http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=7047627

The cheapest 555 is only £0.088 each, in quantities of 75.
http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=0785818A

What about logic gates?

A quad NAND IC can be bought for just £0.064 in quantities of just 10, even less than the 555. I found some cheaper single gate packages but you can't make an oscillator with one gate unless it's a Schmitt trigger.
http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=6631887

Then what about using a Schmitt trigger?  Good idea (even though I do say so myself) a single Schmitt trigger IC can be bought in quantities of 50 for just £0.047
http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=0510352

Go on tell me I'm wrong again, show me where you can buy genuine MCUs for £0.047 (just 7.44 US cents) each in quantities of 50 from? All right maybe that's not fair, a Schmitt trigger IC will require a extra resistor (or a couple of diodes in this case) so as add on 0.5p (0.8 cents) assuming you buy your resistors in 100s not 1000s or a little more for a dual diode.

Don't get me wrong, you raised some valid points regarding flexibility, oscillator stability and accuracy but cost is not one of them, sorry it's bullshit.

I like MCUs myself and are just getting into them but would never use one to just flash a couple of LEDs alternately. I'd opt for a logic IC every time, especially if it's run from a higher voltage than 5V: no need for a separate regulator and the old CD4000 series has current low outputs which are handy for directly driving LEDs: no series resistor required.

you can get yet closer to 0/100% by powering the RC circuit from output and no using the discharge pin, in this way you don't need the minimum resistor as during discharge there is no supply to protect from and it discharges through the output whilst low (totem pole output)

You mean as per my previous circuit using the 7555, so it's being used as a Schmitt trigger?

Yes, that will work very well, as long as you're aware that with the NE555 (not the CMOS versions) there's slightly more output saturation loss when sourcing (1.4V) than when sinking (<100mV) which will make the frequency and duty cycle more dependant on the power supply voltage, the load connected to pin 3 and that when the resistor is in the centre position the duty cycle will be higher 50%, especially at low supply voltages.

I'd recommend that sort of configuration for CMOS versions (TS555, TLS555 ICM7555 etc.) rather than the TTL because it doesn't suffer from and of the issues described above, as long as the output isn't loaded too much.

 

Offline TheWelly888

  • Frequent Contributor
  • **
  • Posts: 334
  • Country: gb
Re: PWM signal from 555 timer
« Reply #17 on: September 29, 2010, 04:42:10 am »
It takes longer to program an MCU especially if you are not familiar with the MCU, development software and programming language used.

A 555 circuit is a hell of a lot easier to implement and more fun to learn how it works too!
You can do anything with the right attitude and a hammer.
 

Offline fsleeman

  • Regular Contributor
  • *
  • Posts: 54
Re: PWM signal from 555 timer
« Reply #18 on: September 29, 2010, 05:32:41 am »
As I wrote, people just don't want to hear it. E.g. a low-end micro is in the 0.50 USD range in quantity. So much for

Quote
The cheapest MCU is still more expensive than a single 555 or logic IC, even when external components are accounted for.

It could go on, but as I have learned in the past, people just love their 555, deal with its power supply glitches, its temperature drift and instability and all its other nastinesses.

I wanted to used a 555 because it would less work for me and I wanted to try something other than a micro. Also, since the VCC is already going to be 12V and the PWM is driving a 12V fan, I don't have to deal with input voltage. There are very few technical issues with this trivial project so mostly I wanted to learn something and keep it simple.

Hero999, thanks for the circuit and description it worked without problems. You said that the resistances should be the average of each side of the pot. Does that mean that changing the position will change the frequency as calculated with this formula?

f = 1.44 /((Ra + 2Rb)*C)

 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 11563
  • Country: gb
  • Hero999
Re: PWM signal from 555 timer
« Reply #19 on: September 29, 2010, 06:02:14 am »
Quote
Hero999, thanks for the circuit and description it worked without problems. You said that the resistances should be the average of each side of the pot. Does that mean that changing the position will change the frequency as calculated with this formula?

f = 1.44 /((Ra + 2Rb)*C)
The frequency won't change as the pot's setting is adjusted because when the duty cycle is set high, the capacitor takes longer to charge than it does discharge and when it's low it takes longer to discharge than charge.

In the circuit I posted, Ra = 1k and Rb = 50k, remember it's split into two halves by the diodes and 50k is the average value, regardless of whether the wiper is high or low. Of course with a pot, the formula can be simplified to f = 1.44/((Ra + Rpot)*C)

If two resistors are used instead of the pot, the formula you posted can be used with Rb being equal to the average of the two resistor values.
 

Offline fsleeman

  • Regular Contributor
  • *
  • Posts: 54
Re: PWM signal from 555 timer
« Reply #20 on: October 05, 2010, 02:23:02 am »
Thanks again for the suggestions. This may be a dumb questions, but why are MOSFETs the preferred transistor type for these sorts of applications? Is it max power, heat dissipation, leakage current or something else? Also, is there a reason to use the IRL540 instead of another MOSFET?
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 11563
  • Country: gb
  • Hero999
Re: PWM signal from 555 timer
« Reply #21 on: October 05, 2010, 04:27:47 am »
A MOSFET is faster, requires less current from the 555 IC to drive the same load as a BJT and has lower conduction losses than a BJT.

I suggested an IRL540 because it is a logic level MOSFET so has a lower threshold voltage. Unfortunately, I didn't read the datasheet properly, the maximum gate voltage is only 10V so if you want to run it off higher voltages you should either run the 555 off 5V to 10V (use an LM317, LM7805, LM78L08 etc.) or use a non-logic level MOSFET such as the IRF540 who's gate voltage rated to 20V - more than the 555.

Oh I think I know where I went wrong now. I was confused, the IRL540N has a gate voltage rated to 16V and a is a logic level MOSFET, meaning it can be driven from a 5V logic IC output.
http://www.irf.com/product-info/datasheets/data/irl540n.pdf

What voltage are you running this from? I briefly read the thread again but I could've missed it.
 

Offline fsleeman

  • Regular Contributor
  • *
  • Posts: 54
Re: PWM signal from 555 timer
« Reply #22 on: October 05, 2010, 05:18:25 am »
I am tapping off a 12V source and would run at that voltage if possible. The LM555 data sheet from National Semiconductor rates the chip at max VCC at 16V so I am assuming 12V would be OK.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 12418
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: PWM signal from 555 timer
« Reply #23 on: October 05, 2010, 05:22:00 am »
an IRF540 will be fine then
https://www.simonselectronics.co.uk/shop New stock now in of EEVblog 121GW and Brymen 235 Now selling a selection of Probe Master probes.

Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559
 

Offline qno

  • Frequent Contributor
  • **
  • Posts: 422
  • Country: nl
Re: PWM signal from 555 timer
« Reply #24 on: October 05, 2010, 05:43:39 am »
One reason to implement the PWM controller in Analog is that you can debug the circuit with your oscilloscope.

Its a great learing experience and it brushes up your knowledge of Opamps, Comparators, Mosfets, Ohm's law etc.
Why spend money I don't have on things I don't need to impress people I don't like?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf