Author Topic: Double debounce design  (Read 103 times)

Joel Moore

  • Full Member
  • Posts: 128
    • View Profile
Double debounce design
« on: September 04, 2019, 05:55:49 PM »
I'm using an optical sensor to detect a gizmo on a part elevator.  Depending on the mode of operation (e.g. loading or unloading) the PLC will either be looking for the sensor to turn off or on to decide when to stop the elevator.  The gizmo is a little floppy so it can cause the optical sensor to oscillate between states at the edge of detection.  So clearly a de-bounce circuit is required.  One that de-bounces both transitions.

The attached image is what I'm using and it works but I'm always interested in finding more elegant/efficient ways to do things.  Have I made this more complicated than necessary or is this about the best that can be done?

Edit: By the way, the 2 second setting for the timer is just to make it easier to watch the behavior.  The actual timer is 100ms
« Last Edit: September 04, 2019, 05:57:29 PM by Joel Moore »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3095
    • View Profile
    • Internet Programmable PLCs
Re: Double debounce design
« Reply #1 on: September 20, 2019, 03:21:27 AM »
Looks like a good circuit. We would have done it similarly.

One other way is to use custom function and sample the input change with refresh and DELAY statement. You want to ensure that once an input is turn ON it last for at least 100ms without changing state.  It will use less ladder logic but with more codes in custom function. Also the scan time is longer using a custom function since the CPU blocks at the CF that samples the input. So ladder circuit with timer is still the most efficient way to achieve this.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS