Having problems with 555 timers

Thread Starter

citizencoolguy

Joined Jan 17, 2011
12
Hi, I'm trying to design a circuit that makes an IR LED flash in short 56.8kHz pulses (50% Duty cycle) few miliseconds. To do this I am using two LM555 timers, one at 384 Hz and the other at 56.8kHz, with the output of the slower connected to the reset of the faster one. I can get the slower one to work fine, but I cant seem to get the faster one at exactly 56.8kHz in simulation (I've been using LTSPICE and Multisim) or on a board. the configuration I'm using is the "50% Duty Cycle Oscillator" at the end of the data sheet with R1 = 12700Ω, R2 = 5370Ω, and C = 1nF. I'm pretty sure of my values and used mathcad to check them. Whenever I test it I always get results that are about 3kHz low. I realize that the actual chip has some small current draw and capacitance, but i don't understand why the simulation would be wrong if the model is supposed to be ideal. My guess is that there is some capacitance in parallel with the external capacitor that throws it off, but the datasheet doesn't give information on the chips capacitance. I would like to be able to find the source of the problem so that I can rewrite the equations to get a more accurate result. I'm not very experienced with this kind of thing yet so any help would be tremendously appreciated.
Thanks!


http://www.national.com/ds/LM/LM555.pdf (Data sheet)
http://i.imgur.com/Q6dkP.jpg (screenshot of the Circuit)
 

Attachments

Wendy

Joined Mar 24, 2008
23,421
All 555 oscillators have an odd habit. They tend to have their first pulse about 33% longer because the capacitor starts from ground, and once charged bounce between the 1/3 and 2/3 voltage points.

The 555 Projects

My Cookbook

Can you show a complete schematic?

I'll show you how to get rid of the long pulse if it is a problem.
 

Thread Starter

citizencoolguy

Joined Jan 17, 2011
12
Heres the complete circuit (except for the resistors associated with the transistor and diode because I don't think I need them in LTSpice), but thanks for taking a look. I was hoping to be able to reconfigure the equations to give me more accuracy so that I can find the tolerance of each the timing components. I need the frequency to be between 53.6kHz and 60kHz.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
Add a 470 Ohm resistor between the output (pin 3) of U2 and Q1's base.
Add a 150 Ohm resistor between the anode of D1 and the +5v supply.
Change Q1 to a valid transistor model, like a 2N2222 or a 2N4401. Right-click on Q1, and click on "Pick new transistor".

The NE555 model in LTSpice is an "ideal" 555 timer; you can't buy one with it's attributes. CMOS 555 timers can't source that much current. bjt 555 timers (transistorized) can't get within 1.3v of Vcc under load.
 

Wendy

Joined Mar 24, 2008
23,421
I can't view a schematic in that format. As such, I can't be of much help. Given that I do a lot of work with 555's, this is unfortunate.

Please use a graphic format such as .gif, .jpg, or (preferably) .png to post schematics.
 

Thread Starter

citizencoolguy

Joined Jan 17, 2011
12
Ok heres the Circuit. and SgtWookie, Thanks for the information, but the real problem I'm having is that The supposed "ideal" timers in my simulation apparently are not completely Ideal and I can't get the Frequency that I theoretically should. If I knew why my frequency was low i could account for it in the equations.
Thanks again.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
I get 56.666...Khz for the output frequency using the FFT function, plotting the output of U2, after making my suggested changes.

Without them, I get 56.4kHz.

Perhaps you're not zooming in to an extent where the output of U2 is toggling and plotting only that extent?

[eta]
I see the breakdown.
You want a hard-and-fast rule where you can simply plug in the numbers and get a guaranteed exact frequency output from any 555 timer you might happen to pick up off the shelf.

Sorry my friend, that's just not going to happen. If I told you it were possible to "correct" the formula to cover all cases, I'd be lying to you - unless you wanted to go into the 555 model, and do Monte-Carlo type analysis for every possible variation in 555 timer manufacture.

The National Semiconductor datasheet mentions "precision timer" - but it's not really all that precise, and adding to that mix you have resistors with a tolerance, and capacitors with even a wider tolerance. If you want any real degree of precision, you need to go to uC's that have built-in clocks that are good to within 1%; for more precision you can use crystals; for even better precision you can use OCXO's (oven-controlled crystal oscillators) and the sky's the limit from there - along with the price tag.

The question is, how precise do you really need to be? Can you simply accept the fact that there may be a need to adjust the circuit to compensate for variables in capacitance, resistance, temperature, and individual 555 timers, and plan ahead?

For a simple change, replace R1 with a 100k fixed resistor in series with a 50k pot; that will give plenty of adjustment, and your ideal will fall just about mid-range. You could also go with a 110k fixed and a 20k pot
 
Last edited:

Thread Starter

citizencoolguy

Joined Jan 17, 2011
12
Yeah, the problem I was having was that I expected the model in the simulation to give me the exact frequency but it doesnt (at least not in multisim) . I was testing the actual circuit on a breadboard and realized that at the mulisim model of the 555 timer is a pretty good representation of the real thing. So what I did was I pushed the resistor values around so that they gave me 56.8KHz (the values I used were R1 = 12200, R2 = 5170, and C = 1nF) then made 2 spread sheets to calculate the tolerance. On one, I just used the theoretical equations so that I could find where the min and max frequencies occur and on the other I changed the values for each situation in multisim and recorded the frequency. The only thing is that I was expecting the min and max to happen in the same situation as in the theoretical but they didn't. Also, there were 2 circumstances that caused the frequency to alternate from about 54kHz to 57.7kHz which was unexpected. The values still fall within what I need (53.6KHz - 60KHz) but im not sure why I would be getting some of the discrepencies that I did, my guess would be that it has something to do with the way the model is coded. I know that there are still other factors that I have to account for (the accuracy of the actual chip, and temperature) but I thought I'd start with this. I'm working on this for my coop and I don't really have much experience in accounting for these kind of things so thanks for your help.

For now, Im going to do the same tests with the breadboard model that I made

Also, what is the FFT in LTspice? the only way I've been getting the frequency is by sooming in and using the curser to measure the period.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
Yeah, the problem I was having was that I expected the model in the simulation to give me the exact frequency but it doesnt (at least not in multisim) . I was testing the actual circuit on a breadboard and realized that at the multisim model of the 555 timer is a pretty good representation of the real thing.
I think that I mentioned before that the LTSpice NE555 is an "ideal" model that's optimized for speed of execution; it doesn't have models of real parts in it. I've attached LM555.ZIP, that contains a "parts" LM555 model. It's still not precisely like a real BJT 555 timer, but it's pretty good.
There are two files in the .zip:
LM555.sub - goes in \Program Files\LinearTechnology\LTSpice\lib\sub
LM555.asy - goes in \Program Files\LinearTechnology\LTSpice\lib\sym\misc
The connection layout is different from the NE555 model; more convenient for schematics.

So what I did was I pushed the resistor values around so that they gave me 56.8KHz (the values I used were R1 = 12200, R2 = 5170, and C = 1nF) then made 2 spread sheets to calculate the tolerance. On one, I just used the theoretical equations so that I could find where the min and max frequencies occur and on the other I changed the values for each situation in multisim and recorded the frequency. The only thing is that I was expecting the min and max to happen in the same situation as in the theoretical but they didn't. Also, there were 2 circumstances that caused the frequency to alternate from about 54kHz to 57.7kHz which was unexpected. The values still fall within what I need (53.6KHz - 60KHz) but im not sure why I would be getting some of the discrepencies that I did, my guess would be that it has something to do with the way the model is coded. I know that there are still other factors that I have to account for (the accuracy of the actual chip, and temperature) but I thought I'd start with this. I'm working on this for my coop and I don't really have much experience in accounting for these kind of things so thanks for your help.
Sure, no problem.
There are also little discrepancies that come up due to rounding errors. Errors, like enemies, accumulate. ;)

For now, Im going to do the same tests with the breadboard model that I made
SPICE simulations are just to get an idea of where to start, and see if you're stressing things too much. For example, if you went into your LTSpice simulation and held down the ALT key while hovering over D1, you'd see a thermometer being displayed. Clicking on that would show the power dissipation over on the plot side. Then, holding down the Ctrl key and clicking on the plot formula, you'll see the interval start, end, average power and integral.

Also, what is the FFT in LTspice? the only way I've been getting the frequency is by sooming in and using the curser to measure the period.
On the plot, zoom in to just a section where you see the 56kHz output from U2; the more cycles the merrier.
Then right-click, select "View" at the bottom, then select "FFT".
On the next screen that pops up, make sure that just one item is highlighted like V(n007) (I added a resistor to the output of U2 and another before D1, so my node names may be different) and under "Time range to include", click the circle to plot just the current zoom extent - then click "OK".

Since the output is a square wave, you'll see the fundamental frequency at ~56kHz, and all of the odd harmonics to the right of it.

Then zoom in on the fundamental by left-clicking and dragging a box around the peak. You'll see the frequency range decrease on the bottom.
 

Attachments

Top