Contact and Coil | Nearly In Control


Due to an increase in the use of solid-state sensors like proximity switches, you’re less likely to see this Ladder Logic Programming Pattern, but the Debounce pattern still comes in handy on many projects:



The Debounce pattern is useful when you’re dealing with “dry contact” inputs that might be prone to “bouncing”. On circuit closure the contacts can bounce, which may cause the input to oscillate between the on and off states temporarily. The input can also oscillate when when the contacts open because of arcing. Electrical noise from nearby high current conductors can actually induce electrical pulses in your low voltage inputs that might fool your logic into thinking the input is in the opposite state for a very brief duration.

The Debounce pattern is a variant of the State Coil pattern. In this case we use a delay on timer as the Trigger of the coil. This timer “makes sure” that the input is really on before we change the state of our Memory coil. The coil then seals itself in. The delay off timer is used to make sure that the input is really off before we allow the seal in circuit of the coil to be broken.

The setpoint times for the timers can be modified to suit the situation. If the Debounce pattern is being used to reject electrical noise, then the timers can probably be shortened to a few milliseconds, but if the problem is mechanical contact bounce then 50 or 100 ms (or even longer) might be necessary.

The Debounce pattern has some disadvantages: first, it delays the response time of the machine when reacting to this input. We want most machines to run as fast as possible, and we want to avoid unnecessary delays. Second, it consumes timers, which is more of a concern on older PLCs which have limited resources. Third, it complicates the logic.

Some programmers have gone so far as to add a Debounce to every single input on the machine. Due to the disadvantages I just listed, I would consider blindly adding Debounce logic to be an anti-pattern. I suggest you only use this pattern when you know you need it, or where there’s a high likelihood of needing it based on past experience.

In most cases Debounce logic can be avoided with some simple alternatives. First, use solid state and/or good quality sensors and switches where possible, which are less likely to bounce. Second, route high current wires on the machine in such a way that they don’t run in parallel with the low current control wiring. Third, check to see if your input cards have a filter function that you can turn on or adjust. The filter can be used to filter out high frequency (short duration) pulses from spurious electrical noise.

The Debounce pattern is often combined with the Input Map pattern.

More Patterns of Ladder Logic Programming.


  • David · January 19, 2018 at 5:51 pm

    You can simplify this DE-bounce logic and you won’t be sacrificing time the machine responds.

    Use the button to start a Time off Timer. Using a One Shot will eliminate a problem if the operator holds the button down but actually not needed as the timer timing bit examine off instruction takes care of that.

    (Button ) (One Shot) Timer Timing Time Off Timer

    —] [———–——-(ONS)————————]/[———-———-TOF —–

    Off Timer Enable Bit

    —-—] [—————————–(Item controlled by button)

    The timer starts as soon as the operator presses the button and as long as it is timing a bounce will not be recognized.

    The ONS (One Shot)and the timer timing bit will allow the the timer to start timing immediately even if the operator holds the button down.

    Set the timer for the lowest value that makes sense for the particular operation. I use 1 second defined as .01 time base x 100.

    This does what you are suggesting much more efficiently.


  • Author comment by Scott Whitlock · January 21, 2018 at 2:08 pm

    @David – This isn’t equivalent.

    Your logic creates a debounced one-shot when you press the button. The original logic can work for a maintained button (such as a “Jog” button) where the signal needs to stay on for as long as the operator holds the button in.

    Also, remember a contact can bounce both during the initial press, and during the release. Using your logic, if the operator holds the button for 2 seconds, and then the contact bounces on the release, it’ll trigger a second one-shot signal, which is almost certainly not what the operator is expecting, and it will only happen once the switch becomes bouncy.

    Furthermore, the original logic prevents electrical noise (like a single scan where the input is high) from triggering the output, because it has to be “really on” for the TON duration before turning on the output. Your logic triggers the output immediately, which means noise on the line could cause it to trigger the equipment.

  • Brian Stilson · March 14, 2018 at 7:53 am

    Signal bounce can and does occur in proximity switches quite often. The switch might be mounted in a way that detecting the ferric surface is right on the borderline between being detectable and not detectable. Corrosion in connector pins, loose connections, corrosion on the surface the sensor is detecting, damaged cables, all of these are things I have personally seen cause Proximity switches to send a “bouncy” signal.

Leave a Reply

Theme Design by