Internet PLC Forum

General => General Discussions => Topic started by: Joel Moore on September 04, 2019, 10:55:49 AM

Title: Double debounce design
Post by: Joel Moore on September 04, 2019, 10:55:49 AM
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
Title: Re: Double debounce design
Post by: support on September 19, 2019, 08:21:27 PM
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.
Title: Re: Double debounce design
Post by: ernest2219 on April 22, 2021, 09:55:16 PM
The connected picture is the thing that I'm utilizing and it works however I'm constantly keen on discovering more exquisite/effective approaches to get things done. Have I made this more muddled than needed or is this about all that that should be possible? google (https://www.google.com/)
Title: Re: Double debounce design
Post by: BetterBath on September 08, 2023, 06:56:48 AM
It's great to see your insights into optimizing this circuit. Using a custom function and sampling the input with a refresh and DELAY statement does sound like a viable alternative. It's interesting how this approach can reduce the ladder logic complexity but might require more code within the custom function.
You've also pointed out an important consideration regarding scan time. It's essential to strike a balance between ladder logic efficiency and scan time for the specific application's requirements.
Please (https://secure.linkcentre.com/status/?url=https://orlandobathremodel.com)click here (https://www.bizbangboom.com/orlando/real-estate-20-construction/orlando-bath-remodeling-renovation)for (https://www.bizbangboom.com/orlando/real-estate-20-construction/orlando-bath-remodeling-renovation)more (https://www.a-zbusinessfinder.com/business-directory/Orlando-Bath-Remodeling-Renovation-Orlando-Florida-USA/33882783/)info (https://www.folkd.com/detail/https%3A%2F%2Forlandobathremodel.com%20https://folkd.com/user/BetterBath)about (http://adbritedirectory.com/Our-website_398067.html)our bathroom (https://homedirectory.biz/https://wwworlandobathremodelcom--Orlando-Bathroom--Remodeling-Renovation_332348.html)remodel (http://classdirectory.org/details.php?id=240541)shower (http://classdirectory.org/details.php?id=240541)replacement (http://ask-dir.org/bathroom-remodel--https://orlandobathremodelcom_286618.html)renovation (https://bedirectory.com/bath-remodel-orlando_315085.html)services (https://facebook-list.com/Our-wbsite_335569.html)near you (https://www.eagleswing.org/florida/orlando/home-services/orlando-bath-remodeling-renovation)