The De-Bounce circuit filters chatter or noise and produces a consistent output signal.
This is a useful circuit for filtering “noisy” input signals and can be used for many applications. The circuit can be used for sensors, noisy communication signals or any number of peripheral devices.
The ladder circuit is comprised of three rungs. The first two ladder rungs filter both states of the input. The last ladder rung incorporates the two filtered inputs and provides a single filtered output. Click on the images for a full size view.
Rising Edge De-Bounce or Filter
This rung filters the rising edge of the input sensor. The rising edge De-Bounce timer begins timing on the rising edge of the input signal. The signal needs to stay on continuously for at least the preset time. Once the timer is done the De-Bounced sensor signal is latched on in the third rung of the ladder circuit.
Falling Edge De-Bounce or Filter
This rung filters the falling edge of the input sensor. The falling edge De-Bounce timer begins timing on the falling edge of the input signal. The signal needs to stay off or low continuously for at least the preset time. Once the timer is done the De-Bounced sensor signal latch is cleared in the third rung of the ladder circuit.
The simple latch in rung provides a De-Bounced sensor signal for use in any application. The Rising Edge of the signal is filtered with the first ladder rung, while the falling edge of the signal is filtered with the second ladder rung. The Latch circuit provides the filtered output for use in the application.
Completed three rung filter circuit.
The timing diagram pictured below shows the raw signal before filtering in red and the filtered output signal in blue.
Let’s take the example of a sensor that counts checked baggage on an automatic conveyor system.
When passengers check their baggage at the ticket counter a sensor counts the baggage placed on an automated conveyor belt which in turn transports the baggage to a Make-Up Carousel where the baggage is loaded onto a cart destined for a waiting plane.
Baggage comes in all shapes and sizes. There are rectangular bags, duffel bags, square bags, gym bags, etc. On top of all the irregular shaped baggage there are handles, straps, and IATA tags (the tracking sticker the ticket agent puts on the handle).
As you can imagine when the baggage is conveyed past the bag count sensor all of the variables described above will trigger the sensor multiple times for any single piece of luggage. Without the De-Bounce circuit it would be impossible to get an accurate count of bags. With the De-Bounce circuit the bag count will be spot on every time.
You can copy the following code and paste it into your application:
XIC(SENSOR_INPUT)TON(RisingEdgeDeb,?,?); XIO(SENSOR_INPUT)TON(FallingEdgeDeb,?,?); [XIC(RisingEdgeDeb.DN),XIC(DebouncedSensor)]XIO(FallingEdgeDeb.DN)OTE(DebouncedSensor);
Once the code is pasted into a project you will have to define the following tags:TAG NAME DATA TYPE SCOPE
SENSOR_INPUT BOOL CONTROLLER RisingEdgeDeb TIMER CONTROLLER OR PROGRAM FallingEdgeDeb TIMER CONTROLLER OR PROGRAM DebouncedSensor BOOL CNTROLLER OR PROGRAM
If you are not sure how to paste the code into the ladder editor check out this tutorial for a quick and easy explanation.