DrDAQ is a versatile instrument that connects to the USB port of any PC. Using the supplied PicoScope software it can be used as an oscilloscope, spectrum analyzer and signal generator.
Using an inexpensive PC-based oscilloscope, we can measure the noise that occurs when a mechanical switch changes state. The experiment described here measures the amount of time that a switch takes to settle, and shows one way to reduce the bouncing effect.
Nearly all mechanical switches generate some "bounce". That is, for every time they are switched, they actually open and close their contacts several times before settling down to their new position. For normal switches, this can last from as little as a fraction of a millisecond (ms), to as long as 50 ms. Only very high quality switches generate little or no bounce.
This is not usually a problem if you are merely turning on a light, but if you are working with logic devices, all these extra bounces can create havoc. For instance, what if every time you pressed a button to increment a counter you actually added several counts to the total?
One way of debouncing a switch is by using an RC network to slow either the rising or falling edge of the event. We can use the fact that the time for a capacitor to recover 63% of its voltage, in seconds, is the product of the resistance in ohms and the capacitance in farads.
(It would be a good idea to perform the experiment Measuring the Value of a Capacitor to gain a better understanding of this phenomenon.)
While it may be true that switches bounce, it is also true that a person can only push a button or operate a switch a limited number of times per second. This is the reason why various debouncing methods are practical. As long as the debounce method does not take too long, no one will notice.
Connect the battery, resistor and switch as shown in the circuit diagram. Attach the scope probe to point A.
The PicoScope software should be set up to sample at 1 ms/div, ±10 V, DC. Trigger to repeat, Ch A, falling at around 6000 mV with a -10% pre-trigger.
Actuate the switch several times, and measure the length of "bounce zone", either by eye, or using the scope cursors. Connect up other switches and measure the length of bounce on those as well. Try to test different switches with a broad range of characteristics. Large switches, small switches, buttons that make a tiny "click" when you press them, and ones that don’t. Try simply using a piece of wire instead of a switch. For each switch, write down the main characteristic in a table along with the length of the bounce zone.
Change PicoScope so that it is sampling at 200 ms/div. And change the trigger to Single. Take the switch that is easiest to actuate, (it is also a good idea to make it a strong one!) and "normally" press it as many times as you can while the scope is recording. Look on the trace and find the two rising or falling edges that are the closest to each other Using the cursors, measure the distance between these two rising or falling edges. (An interesting sub-experiment can be done here by making a list of everyone in the class, how many hours of computer games they play each day and the distance between switch presses.) If the switch is an especially bad one, the bounces may interfere with this part. But most likely, you will not even see the bounces that were so obvious in part A.
Using one of the switches that is bouncing for less than 1 ms duration, add a 1 µF to the circuit in the position shown. The PicoScope software should be set up as in part A above.
Capture a switch press as you did in part A. You should see a large improvement. In fact there should be only one descending edge, and perhaps some smaller "bumps" where the bounces were. Can you explain how this works? Experiment with smaller and larger capacitors to see if the bumps get taller or shorter. Change the scope trigger to Rising and look at the trace generated by releasing the switch (or set the time base to a longer period and capture both press and release on the same screen). The rising edge shape should be familiar to you if you worked through the experiment Measuring the Value of a Capacitor, and it should offer clues as to where the extra switch bounces went.
If a TTL counter chip is available, the student may want to connect it up with some LEDs and try clocking it with one of the switches. Then use the de-bounced switch circuit on it to see a graphic example of why de-bouncing switches is necessary in digital applications.