Author Topic: Need some help with a 555 timer circuit  (Read 7966 times)

0 Members and 3 Guests are viewing this topic.

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Need some help with a 555 timer circuit
« on: August 11, 2020, 02:32:29 am »
This is my first post, so go easy, anything i have missed/done wrong just let me know and i would be more than happy to correct it.

Essentialy, I am trying to create a circuit which outputs a fixed pulse width (1 sec) for all input widths, both longer and shorter than the output. I have tried a bunch of different circuits with discrete components, but after a bunch of failures a friend recommended I use a 555 timer. I ended up finding a circuit I thought would integrate well with my existing project on the Electronics Stack Exchange, and modified it to suit my needs. I don't currently have access to the components needed to fully test it, but i need to finalise a prototype so I was hoping someone with a bit more experience could give some input/advice. (I know the best way would probably be to breadboard/veroboard it but this was my second best option.

I have already made a post on the Electronics stackexchange with what I hope are all the details needed, I am going to link it here, but if linking to another forum is frowned upon here i would be glad to repost all the information.

https://electronics.stackexchange.com/questions/514223/will-my-555-timer-circuit-work-the-way-i-want-it-to

Will this circuit work?
Would you recommend a different circuit (preferabbly without an MCU)?
Any modifications I should make circuit or safety wise?
 

Offline Buriedcode

  • Super Contributor
  • ***
  • Posts: 1652
  • Country: gb
Re: Need some help with a 555 timer circuit
« Reply #1 on: August 11, 2020, 04:21:10 am »
I would suggest using a circuit simulator like LTspice (which has a 555 model I believe).  I'm sure there are simpler and easier ones about, all free, but I have most experience with this.

It sounds like you want an edge triggered monostable, I haven't even thought about such things in years.  So, say, a falling edge on the input will trigger a pulse, so it doesn't care when the rising edge is, so the pulse can be as short or as long as you like, it'll only trigger on the start of the pulse. If you want to change the polarity you can use a bipolar transistor to invert the input or output.

I'm pretty sure the 555 monostable is non retriggerable (multiple edges during the output pulse are ignored), but I can't remember off hand.

Honestly, playing about with a circuit simulator, even just copying schematics from the web to see what is going on can be interesting.

This page has an example of one:
https://electronicsclub.info/555monostable.htm
 
The following users thanked this post: Pizzashape23

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #2 on: August 11, 2020, 04:33:49 am »
Thanks for the reply, I'm pretty sure a falling edge monostable circuit is exactly what im after.


Honestly, playing about with a circuit simulator, even just copying schematics from the web to see what is going on can be interesting.


I tried using LTspice but got nowhere (inept at using it for anything but circuit diagrams). I also used tinkercads circuit program and got it to work exactly as intended, my one issue is that it is aimed at begginers/kids and initial concepts. It doesn't give exact values for transistors or mosfets and it's difficult to monitor what is going on, so i was unsure whether the result I got was because I had the right values or because of the programs leeway.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12986
Re: Need some help with a 555 timer circuit
« Reply #3 on: August 11, 2020, 05:17:11 am »
In the real world, you can never expect your components to have the 'right value' as *everything* has a tolerance. Resistors used to be +/-10%, or +/-5% but now 1% is far more common and nearly as cheap.  0.1% is readily available at a moderate premium.  Capacitors  are much worse - a typical electrolytic may be +/-20%, and +/-10% is typical for many other types.  Most inductors aren't precision components either.   The situation with discrete semiconductors is even worse - typically there will be at least one datasheet parameter for which a 2:1 variation is entirely normal.  Therefore, if you don't want to have to hand-trim every circuit to find its 'sweet spot' then re-trim it when it inevitably drifts you need to get into the habit of designing defensively so your circuit tolerates non-ideal component values.

Its worth persevering with LTspice, though the learning curve is admittedly fairly steep if you haven't previously used any other SPICE software.  If you get stuck with simming something, ask here.   Although your circuit maybe harshly criticised, if you are willing to learn, you wont be! ;)
 
The following users thanked this post: Pizzashape23

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #4 on: August 11, 2020, 05:29:35 am »
I get what you are saying in regards to component tolerance, does this mean the leeway in TinkerCad simulation would carry over into real life, at least to some extent? What I mean is can the simulation be trusted?

Also I was curious if you had an opinion on the overall circuit itself, is there a better way of achieving the same thing or should I go ahead and submit the prototype?
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3245
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #5 on: August 11, 2020, 05:39:14 am »
Looks like it ought to work. I would have put the top of R2 to +12V but it doesn't look like a big deal. Maybe add a 1uF bypass cap from Vcc to GND right at the 555 pins. 555s have been known to pull a current spike when the output changes state.
 
The following users thanked this post: Pizzashape23

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #6 on: August 11, 2020, 05:46:47 am »
Thank you for the response, I will definitely be adding that capacitor, and following the link provided by Buried Code, the circuit there also put the top of r2 to +12v with 10k instead of 100k. Would the values of the resistors in the edge triggered part of the 555 circuit have a big impact on the end result? I have seen both a 4.7k used with a 100k and a 10k used with a 10k, simulating both gives the same result, would one be better than another?
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3245
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #7 on: August 11, 2020, 06:31:42 am »
As long as the pulse going into the trigger input is shorter than the desired output pulse it will be okay.
 

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #8 on: August 11, 2020, 06:34:44 am »
That won't work, As stated in my question the output pulse width needs to be constant even when the input pulse is longer than the desired output. The input is a user activated button so in making the circuit edge-triggered i was hoping to eliminate that source of error.
 

Offline ozcar

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #9 on: August 11, 2020, 07:04:17 am »
Would the values of the resistors in the edge triggered part of the 555 circuit have a big impact on the end result?

If you make R2 too low (relative to R3), then the trigger input would be low all the time the button is pressed. That wouldn't work for what you want.
 

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #10 on: August 11, 2020, 07:10:50 am »
Would the values of the resistors in the edge triggered part of the 555 circuit have a big impact on the end result?

If you make R2 too low (relative to R3), then the trigger input would be low all the time the button is pressed. That wouldn't work for what you want.

That makes sense for that configuration, but what if i was to put R2 up to +12v (instead of connected to R3) and make both 10K, would this be a better configuration? I have seen both online but was curious if one was better than the other, for me anyway it's two less items on the BOM (I am already having to order some 10k resistors)
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3245
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #11 on: August 11, 2020, 07:51:50 am »
That won't work, As stated in my question the output pulse width needs to be constant even when the input pulse is longer than the desired output. The input is a user activated button so in making the circuit edge-triggered i was hoping to eliminate that source of error.
When I said the trigger input I meant the actual trigger input pin on the 555, not where the pushbutton connects to the cct. As long as the CR network on the input makes a shorter pulse than the 555 output pulse.
 

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #12 on: August 11, 2020, 08:03:18 am »
Sorry, your answer makes much more sense now, thanks
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12986
Re: Need some help with a 555 timer circuit
« Reply #13 on: August 11, 2020, 08:12:00 am »
One thing you haven't considered is switch wetting current.   Unless otherwise specified, for reliability its good practice to have a minimum of 10V across a switch  (or other contacts) when open and minimum 10mA through them at the moment they close to provide enough energy to break through any surface contamination that has built up.  Of course this isn't always possible e.g. 5V logic circuits, so one does the best one can.
 

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #14 on: August 11, 2020, 08:35:32 am »
The entire circuit runs on 12v, if that is what you meant, but I'm not sure about the current through the input button. The relays will be at the same 12v and one should be switching around 200ma minimum while the other up to 40A. The circuit runs off a 24v to 12v converter module capable of delivering 2A, so current shouldn't be an issue. It is quite possible I'm wrong, this is the first time i'm hearing about wetting current, so please let me know.
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3245
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #15 on: August 11, 2020, 11:36:48 am »
You could put a capacitor across the switch contacts. When they close the cap gets suddenly discharged and this current should wet the contacts. How big a cap? Others may care to comment.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12986
Re: Need some help with a 555 timer circuit
« Reply #16 on: August 11, 2020, 12:25:23 pm »
Energy conservation is not an issue*.  Simply use a 1K pullup (to +12V) for the switch to meet the 'rule of thumb' wetting current and voltage requirements.  However, if you care about your switch (or relay) contacts and EMI one should also be careful *NOT* to directly short any significant size capacitor without some resistance in the loop to limit the surge current and damp the capacitor ringing with the loop inductance to reduce EMI.

How big does the capacitor have to be before it matters?   Well that depends on the switch.  A massive wall mounted two-handed
knife switch with heavy solid silver alloy wiping contacts can withstand a lot more than a sub-miniature reed switch with only a thin flash of gold over the iron of the reeds for a contact surface. 

For boosting wetting current for small switches without the penalty of a high standing current when closed, 1nF to 10nF is in the ballpark. 

I start worrying about loop resistance and surge current if I'm shorting out caps of 100nF upwards (e.g. in a 'classic' MCU reset circuit).

Considering your circuit over at  StackExchange, remove the 100K resistor across the capacitor, add a 1K pullup to the junction of the capacitor and the switch, and add a small signal diode, cathode positive, across the resistor pulling Trigger high, to clamp it when the switch opens.

However I am *really* not happy with that circuit for a safety system.  Its got absolutely nothing to prevent activation by EMI pickup on the switch wiring or by ESD to the switch.  IMHO using a 555 trigger input almost directly exposed to the outside world is *CRAZY*.  Using another 555 to buffer, debounce and ESD and EMI filter the switch input would make me a lot happier.  I'll see about working up a sim for you so you can see what I mean. 
 

* Its feeding a fricking metal-smelting furnace, so an extra seventh of a watt in the pullup is truely negligable!
« Last Edit: August 11, 2020, 02:34:36 pm by Ian.M »
 

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #17 on: August 11, 2020, 01:14:44 pm »
WOW, I really appreciate the amount of detail you managed to include in that response. One question about your response, if I use a 1K pullup do I still need the capacitor across the contacts?

Correct me If I'm wrong, but your response suggests that the 555 circuit path is the correct way to go about what I am trying to achieve, or is there a better/more efficient way of switching the relays for a fixed pulse width?

Just note, the reason the "safety" is so rudimentary is becasause the circuit it is protecting is ridiculously basic, I could probably find a schematic if you would like. (It would be considered very *VERY* Basic, and is part of the reason why i opted for a safety circuit i the first place). However, if adding an additional 555 and a few more components is all it would take to drastically improve the safety, I whole hartedly agree that it would be the smartest thing to do. Be warned, I wouldn't know the first thing about going down that path and would probably need a lot of help, but I would definitely be up for learning.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12986
Re: Need some help with a 555 timer circuit
« Reply #18 on: August 11, 2020, 03:30:59 pm »
Ok, here's the 2x 555 timer version, as safe as I can reasonably make it.
R1 provides 12mA through the switch and 12v across it when open, so unless you use a particularly crummy switch you don't need to worry about wetting current.

Fs1 and R3 provide protection against shorts to ground in the switch wiring.  If Fs1 trips, IC2 is locked out via its Reset pin.  R4, C7 provide a power-up delay to ensure U2 doesn't pulse the relay at switch-on, and in conjunction with R3 also provide ESD protection to its Reset pin.

R2, C1 provide input filtering for debouncing and in conjunction with R1 provide ESD protection to U1, which is wired as a simple inverting Schmidt trigger with 1/3 Vcc hysteresis*.  Its Out pin is the inverted debounced switch state (i.e. low when pressed).

R5, C4, D3, R6 are the negative edge trigger pulse shaping network, that only triggers U2 on a new button press, once the current  timing period is complete. 

C5, R7 is the timing network and R8 limits the current into the Discharge pin.  R9, R10, Q1 is a 'bog-standard' relay drive circuit, though its imprudent to rely on the diode inside the relay coil to protect Q1.  If you are feeling moderately paranoid, adding a 24V Zener, cathode positive, from ground to Q1 collector, + a fuse in series with the feed to the relay coil wouldn't be a bad idea.

I've minimized the number of values used for BOM reduction. If that isn't an issue, R8 and R9 could benefit by being reduced, and the CV pins don't need so large decoupling capacitors.

LTspice sim with some nasty simulated contact bounce attached.   Zoom in on the edges of  V(in) to see it!  >:D  For the details of how the SIM only Switch Control works, see LTspice: Piecewise Linear Functions for Voltage & Current Sources and my comments on simultating switches [here].

H.T.H.

Ian.
Now everybody's got a chance to bash my ideas to death  :horse: while I chill  :popcorn: and hopefully we all learn something!

* A buffer following a RC filter for debouncing *MUST* have hysteresis.
You should probably (re)read Jack Ganssle's excellent article on debouncing: http://www.ganssle.com/debouncing.htm especially part 2 where he covers RC hardware debouncers.


« Last Edit: August 12, 2020, 12:52:14 am by Ian.M »
 
The following users thanked this post: Pizzashape23

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #19 on: August 12, 2020, 12:01:16 am »
 :clap: :clap: :clap:
HOLY $**T

That has to be the best and most helpful response I have ever recieved. You nailed all of the design goals I set for myself AND managed to reduce the BOM.
In all seriousness, I cannot thank you enough.

I now have just two questions;
How long did this take you? (I probably would have taken a week)
Do you still have the shcematic file? (I wanted to get a custom PCB printed)
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12986
Re: Need some help with a 555 timer circuit
« Reply #20 on: August 12, 2020, 12:50:30 am »
A couple of hours, most of which was wasted on the switch bounce generator- see below. I can layout a basic 555 sim in under ten minutes then its just a matter of a little copy/paste to daisy-chain them and gutting most of the timing components round U1.  I use a mouse macro utility, so a lot of the layout is just muscle memory following my train of thought. Probably the most tedious chore is reordering reference designators.  D3 got away from me as I originally had two more Schottkys for ESD protection at the input, but I decided they were superfluous, removed them and forgot to rename the remaining diode as D1.

There is no separate schematic file as I did it all in LTspice.  If you delete all the simulation crap at the bottom, you can export the netlist, but unless your preferred PCB design package supports working from a raw netlist in a friendly manner, you'd probably do better to manually redraw it.

N.B. the switch bounce portion of the sim is buggy and inefficient.  I've spent the better part of yesterday sorting that out so it simulates switch bounce efficiently
 
The following users thanked this post: Pizzashape23

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #21 on: August 12, 2020, 12:53:27 am »
Yeah, I just finished redrawing it and it looks great, seriously i cannot express how much of a legend you are and how much help you have provided.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12986
Re: Need some help with a 555 timer circuit
« Reply #22 on: August 12, 2020, 12:57:23 am »
Please at least breadboard it and confirm correct operation before you start ordering PCBs!  When you get to the layout, I'd probably put a footprint for a 500K multi-turn preset for the timing resistor, (with a 10K 'end-stop' resistor in series), and some spare footprints for extra timing capacitors in parallel, so you can adjust the pulse-width over a considerable range.
« Last Edit: August 12, 2020, 01:01:21 am by Ian.M »
 
The following users thanked this post: Pizzashape23

Offline Pizzashape23Topic starter

  • Contributor
  • Posts: 37
  • Country: au
Re: Need some help with a 555 timer circuit
« Reply #23 on: August 12, 2020, 01:11:10 am »
Of Course, and yeah, the pot and extra footprints sounds like a great idea.
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3122
  • Country: us
Re: Need some help with a 555 timer circuit
« Reply #24 on: August 12, 2020, 01:18:14 am »
There are possible solutions using a couple of NAND gates or NOT gates:

https://www.electronics-tutorials.ws/sequential/seq_3.html

so you could use a single CMOS logic IC, e.g. a CD40106 or a CD4093.

There are also chips dedicated to this purpose, e.g.: CD4538, 74LVC1G123:

https://www.nexperia.com/products/analog-logic-ics/synchronous-interface-logic/multivibrators/74LVC1G123DP.html

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf