Author Topic: 555 timer in Astable mode, first pulse problem.  (Read 2943 times)

0 Members and 1 Guest are viewing this topic.

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
555 timer in Astable mode, first pulse problem.
« on: January 31, 2023, 04:14:42 am »
Hi everyone,

I have my 555 timer configured in astable mode outputing 1hz square wave. Following is the circuit that I am using.



But with a small change, I have the reset pin of the 555 timer connected to a debounced push button, which connects it to either VCC or GND. I want to start and stop the square wave with the push button.

The output waveform yellow looks fine. The blue waveform is of the charge/discharge capacitor.



Here comes the trouble, when I release the push button the output turns off immediately as expected but when I push the button to start the output, the timing of the first pulse is longer then the rest due to the completely discharged timing capacitor.



Any idea how to fix this glitch?

Thanks.
« Last Edit: January 31, 2023, 04:26:46 am by Heisen »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: 555 timer in Astable mode, first pulse problem.
« Reply #1 on: January 31, 2023, 07:09:57 am »
That's tricky.  The best option is not to use a 555.  E.g. if you use a CD4060 with a high enough RC clock frequency (i.e. take the output from Q7 or higher Qn), the first cycle error (after you take RST low to release it) will be negligible.

However if you must, you can get there by precharging the 555's timing capacitor to 1/3 Vcc when Reset releases.  The easiest way to do that is to split it into three equal capacitors, two in parallel to Gnd and the other to your Reset signal source, which must be a stiff push-pull output.  See attached LTspice sim.

N.B. a CMOS 555 doesn't need  that BJT + diodes circuit to get a 50% duty cycle - simply drive the timing resistor from the Output
 
The following users thanked this post: Heisen

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: 555 timer in Astable mode, first pulse problem.
« Reply #2 on: January 31, 2023, 12:04:52 pm »
N.B. a CMOS 555 doesn't need  that BJT + diodes circuit to get a 50% duty cycle - simply drive the timing resistor from the Output

You can find this approach on the Falstad simulator:

https://falstad.com/circuit/circuitjs.html

Go to the Circuits menu -> 555 Timer Chip -> Square Wave Generator

That schematic has a 1M pull-up on the threshold/trigger node -- is that needed?

 
The following users thanked this post: Heisen

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: 555 timer in Astable mode, first pulse problem.
« Reply #3 on: January 31, 2023, 12:27:53 pm »
I doubt it - it seems to start OK without it.  However it may be a tweak to square up the duty cycle for a 555 that doesn't quite have a rail-to-rail output.

Try this Falstad version of my gated circuit.

N.B. Falstad is *NOT* a Berkley SPICE based simulator and can give very misleading results.  So can various SPICEs, but usually less often + there are more customisation options to avoid or minimise non-physical behaviours.

Edit: Corrected error with gate signal swing - see Ledtester's comment below.
« Last Edit: January 31, 2023, 01:19:08 pm by Ian.M »
 
The following users thanked this post: Heisen

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1333
  • Country: ua
Re: 555 timer in Astable mode, first pulse problem.
« Reply #4 on: January 31, 2023, 12:30:14 pm »
What if you invert the output and use the low cycle halves as high? This will of course need ANDing with the button's level to prevent getting high output when the timer is off. This will however introduce a delay before getting first high on the resulting output, not sure if it's acceptable for your application.
 
The following users thanked this post: Heisen

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19518
  • Country: gb
  • 0999
Re: 555 timer in Astable mode, first pulse problem.
« Reply #5 on: January 31, 2023, 12:39:24 pm »
Hi everyone,

I have my 555 timer configured in astable mode outputing 1hz square wave. Following is the circuit that I am using.



But with a small change, I have the reset pin of the 555 timer connected to a debounced push button, which connects it to either VCC or GND. I want to start and stop the square wave with the push button.

The output waveform yellow looks fine. The blue waveform is of the charge/discharge capacitor.

Here comes the trouble, when I release the push button the output turns off immediately as expected but when I push the button to start the output, the timing of the first pulse is longer then the rest due to the completely discharged timing capacitor.

Any idea how to fix this glitch?

Thanks.
The problem is C starts at 0V, yet it only discharges to 1/3VCC, so the first pulse is always longer.
Halve the value of C and add another capacitor, with the same value, between pin 6 and your switch. The two capacitors form a divider, so the voltage starts will always start at 1/2VCC, when the switch is connects to VCC. The disadvantage of this is, charging capacitors is hard on the switch, so you can add a low value resistor (try 47R) in series with the switch and the capacitors, to limit the surge.

EDIT:
I stand corrected by IanB. The capacitor voltage should start at 1/3 for the first output pulse to be high for the same length of time as the others.
« Last Edit: January 31, 2023, 02:30:25 pm by Zero999 »
 
The following users thanked this post: Heisen

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: 555 timer in Astable mode, first pulse problem.
« Reply #6 on: January 31, 2023, 12:50:16 pm »
No.  You want it to start at Vcc/3 not Vcc/2 otherwise you'll get a shortened  first pulse.  Use 1/3:2/3 (of existing Tc) capacitor values to fix that and you've basically got my circuit.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: 555 timer in Astable mode, first pulse problem.
« Reply #7 on: January 31, 2023, 01:09:26 pm »
Try this Falstad version of my gated circuit.

The square wave generator is bi-polar. Perhaps you want max voltage = 5V with a 5V offset?

 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: 555 timer in Astable mode, first pulse problem.
« Reply #8 on: January 31, 2023, 01:14:44 pm »
 OOPS!!! Thanks.  It still sorta works in simulation as the doubled swing drives the timing node to 2/3 VCC, so it outputs a runt pulse then starts properly after a discharge half-cycle but  its certain to cause problems and maybe even blow the chip in real life.  |O

As I have fixed the link above, but believe in eating the crow I've cooked, here's the bad version: https://tinyurl.com/2d3zbn3f :-[
« Last Edit: January 31, 2023, 01:21:29 pm by Ian.M »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19518
  • Country: gb
  • 0999
Re: 555 timer in Astable mode, first pulse problem.
« Reply #9 on: January 31, 2023, 02:38:15 pm »
No.  You want it to start at Vcc/3 not Vcc/2 otherwise you'll get a shortened  first pulse.  Use 1/3:2/3 (of existing Tc) capacitor values to fix that and you've basically got my circuit.
Yes, you're right. Starting at 1/2 VCC is no good.

Another way is to use a potential divider to bias the other side of the capacitor, with a potential divider.

50% duty cycle can be achieved by putting a resistor of 42.3% of the value of the pull-up in series with the discharge pin.
 
The following users thanked this post: Heisen

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
Re: 555 timer in Astable mode, first pulse problem.
« Reply #10 on: January 31, 2023, 02:45:38 pm »
The best option is not to use a 555.  E.g. if you use a CD4060 with a high enough RC clock frequency (i.e. take the output from Q7 or higher Qn), the first cycle error (after you take RST low to release it) will be negligible.
Okay, I didn't have CD4060 so I ordered it, I also looked for CMOS version of 555 timer but it was not available in DIP version anywhere on local sites in my area.

In the meantime while the part arrives, I'll try other combinations with the NE555 and post results.

This circuit is a sort of test jig for testing another circuits that I am making, the requirement is 1Hz square wave is needed at different voltage levels (12v roughly, 4.7v, 2.7v) on the push of the button, I went with 555 timer because it works up to 15v VCC, with zener diodes on the output I can get the 1Hz square wave in the other voltage levels.

But now observing that the first pulse is a problem with 555 timer. I can't try the circuit shown by Ian.M because I don't have CMOS 555.

The CD4060 looks promising, hope it works with 32.768kHz crystal but I have to use two CD4060, first divide by 7 and then divide by 8 to get 1Hz. Hmmn lets see, I'll post soon.
 

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
Re: 555 timer in Astable mode, first pulse problem.
« Reply #11 on: January 31, 2023, 02:49:03 pm »
No.  You want it to start at Vcc/3 not Vcc/2 otherwise you'll get a shortened  first pulse.  Use 1/3:2/3 (of existing Tc) capacitor values to fix that and you've basically got my circuit.
Yes, you're right. Starting at 1/2 VCC is no good.

Another way is to use a potential divider to bias the other side of the capacitor, with a potential divider.

50% duty cycle can be achieved by putting a resistor of 42.3% of the value of the pull-up in series with the discharge pin.

Thanks, I'll try this and post back.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: 555 timer in Astable mode, first pulse problem.
« Reply #12 on: January 31, 2023, 02:52:51 pm »
Try splitting the capacitor as per my circuit in your NE555 NPN + 2 diodes circuit.   The capacitive divider to start from 1/3 Vcc on the rising edge of /RESET, is independent of the 50% duty cycle mod.  If your switch can handle approx 200mA and is SPDT between Vcc and Gnd, you can omit the MOSFETs like the Falstad version.  Keep the 22 ohm resistor or it will kill your switch.

While a CD4060 *can* be used with a 32.768KHz watch crystal, LF 'tuning fork' crystals are rather fussy about drive levels and you'll probably have an interesting time getting it to work.  :popcorn:  Personally I'd use a MCU to generate the timing and a level shifter to make the output pulse bigger.   What sort of level shifter is the big question - which depends on what risetime you need and how much current the pulse output must source and/or sink.
« Last Edit: January 31, 2023, 03:10:49 pm by Ian.M »
 
The following users thanked this post: Heisen

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
Re: 555 timer in Astable mode, first pulse problem.
« Reply #13 on: January 31, 2023, 03:41:13 pm »
Try splitting the capacitor as per my circuit in your NE555 NPN + 2 diodes circuit.   The capacitive divider to start from 1/3 Vcc on the rising edge of /RESET, is independent of the 50% duty cycle mod.  If your switch can handle approx 200mA and is SPDT between Vcc and Gnd, you can omit the MOSFETs like the Falstad version.  Keep the 22 ohm resistor or it will kill your switch.
I tried this and it works beautifully except my frequency is not 1Hz most likely it some mistake on my part, working on it.



« Last Edit: January 31, 2023, 03:50:41 pm by Heisen »
 

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1333
  • Country: ua
Re: 555 timer in Astable mode, first pulse problem.
« Reply #14 on: January 31, 2023, 03:43:45 pm »
I tried this and it works beautifully except my frequency is not 1Hz most likely it some mistake on my part, working on it.
But first pulse is still a little bit longer than the following, I'm pretty certain that I see it even without cursors :)
 
The following users thanked this post: Heisen

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
Re: 555 timer in Astable mode, first pulse problem.
« Reply #15 on: January 31, 2023, 03:53:20 pm »
But first pulse is still a little bit longer than the following, I'm pretty certain that I see it even without cursors :)
Yes it is off little bit, but the idea worked, much better than before, I'll come to it once I fix my frequency first.
« Last Edit: January 31, 2023, 03:56:12 pm by Heisen »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: 555 timer in Astable mode, first pulse problem.
« Reply #16 on: January 31, 2023, 04:04:09 pm »
Trim Rt to suit.   I made no particular effort to get it right in the sim, and your circuit doesn't drive Rt rail-to-rail so it will be wrong anyway.  In your circuit, it will also be supply voltage dependent.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19518
  • Country: gb
  • 0999
Re: 555 timer in Astable mode, first pulse problem.
« Reply #17 on: January 31, 2023, 06:25:19 pm »
No.  You want it to start at Vcc/3 not Vcc/2 otherwise you'll get a shortened  first pulse.  Use 1/3:2/3 (of existing Tc) capacitor values to fix that and you've basically got my circuit.
Yes, you're right. Starting at 1/2 VCC is no good.

Another way is to use a potential divider to bias the other side of the capacitor, with a potential divider.

50% duty cycle can be achieved by putting a resistor of 42.3% of the value of the pull-up in series with the discharge pin.

Thanks, I'll try this and post back.
It can be applied to the circuit attached to the original post. Note I removed one of the diodes which isn't needed.
 

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
Re: 555 timer in Astable mode, first pulse/cycle problem.
« Reply #18 on: February 09, 2023, 02:35:36 pm »
Hi, everyone.

I found one more solution on another forum. To fix the first cycle of the 555 timer in astable mode you just need 3 components, 2 resistor voltage divider and a diode, preferable schottky diode. I am unsure about the exact theory behind this but it works. This doesn't need any change to your already configured timing resistors and capacitor.





The voltage divider through the diode will pre charge the capacitor close to 1/3 VCC. To compensate the voltage drop of D1, R5 can be adjusted, if R5 becomes too big the circuit doesn't work, it can also be omitted completely but then the capacitor will pre charge only to (1/3VCC minus the voltage drop of D1).

After trying many solutions on breadboard including this one, the first pulse can not be exactly matched to the rest of the pulses, it will always be slightly longer, but this makes it less noticeable.

I hope it helps.
« Last Edit: February 09, 2023, 02:44:33 pm by Heisen »
 

Online BillyO

  • Super Contributor
  • ***
  • Posts: 1382
  • Country: ca
Re: 555 timer in Astable mode, first pulse problem.
« Reply #19 on: February 09, 2023, 03:35:01 pm »
Why not just use a microcontroller?  Some are nearly as cheap as a (real) 555 these days and you can get precise results very quickly.  It seems a shame to waste all the time that have already spent on solving this problem.  You could have done this in 10 minutes with even a simple PICAXE 08M2 with only adding a push button and resistor.

Anyway, looks like you are getting close.  Maybe only a few more hours of work. :palm:
Bill  (Currently a Siglent fanboy)
--------------------------------------------------
Want to see an old guy fumble around re-learning a career left 40 years ago?  Well, look no further .. https://www.youtube.com/@uni-byte
 

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
Re: 555 timer in Astable mode, first pulse problem.
« Reply #20 on: February 09, 2023, 04:05:24 pm »
Why not just use a microcontroller? 
I thought I could do it in hardware but realized quickly that this is tricky and microcontroller is the right way to go. But then one thing led to another, pain became pleasure and here we are. :popcorn:
 

Offline BlackICE

  • Regular Contributor
  • *
  • Posts: 222
  • Country: us
Re: 555 timer in Astable mode, first pulse problem.
« Reply #21 on: February 11, 2023, 01:50:43 am »
Decades ago I used the 555 timers and 556 timers. But nowadays I would just program Atmega 328p and have it output whatever waveform I want. A little more expensive but easier to do and for low frequencies works fine. You don't care about the exact frequency you can use the internal oscillator and save on the parts count. Besides the 555 isn't that stable anyway.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: 555 timer in Astable mode, first pulse problem.
« Reply #22 on: February 12, 2023, 05:42:36 pm »
Where a 555 still wins is when you need a quick and dirty coarse tolerance delay, or repeating pulse signal in a nom. 12V system.  To get there with a MCU, you need to regulate the 12V down to 5V or 3.3V to power the MCU, then level-shift the output back up to a 12V swing.

 
The following users thanked this post: Heisen

Offline Laurencewilliams

  • Newbie
  • !
  • Posts: 5
  • Country: england
    • Asutpp
Re: 555 timer in Astable mode, first pulse problem.
« Reply #23 on: February 12, 2023, 05:49:18 pm »
Where a 555 still wins is when you need a quick and dirty coarse tolerance delay, or repeating pulse signal in a nom. 12V system.  To get there with a MCU, you need to regulate the 12V down to 5V or 3.3V to power the MCU, then level-shift the output back up to a 12V swing.

Hi! Yes, that's correct. The 555 timer is a versatile and low-cost solution for generating simple delay and repeating pulse signals in a nominal 12V system. Its simplicity and low cost make it a popular choice for hobby and educational projects.

The level shifting requirement is one of the challenges in using a microcontroller (MCU) in such a system. The 555 timer doesn't have this requirement, and its output can be directly connected to a load. On the other hand, MCUs offer greater versatility and programmability, allowing for more complex signal generation and processing.

Ultimately, the choice between a 555 timer and an MCU for a particular application depends on the requirements and trade-offs of the specific application, such as cost, complexity, accuracy, versatility, and power consumption.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: 555 timer in Astable mode, first pulse problem.
« Reply #24 on: February 12, 2023, 05:58:21 pm »
Is anyone aware  of a '555 replacement' ATtiny breakout board with the regulator and output level shifters?  Preferably readily available from the usual far East suppliers . . .
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf