If you’ve ever designed an embedded system with at least one button you’ve had to deal with button debouncing. This is also know as contact bounce, a phenomenon where a button press can be registered as multiple button presses if not handled correctly. One way to take care of this is with a hardware filter built from a resistor-capacitor setup, or by using a couple of NAND gates. We find that [Jack Ganssle] put together the most comprehensive and approachable look at contact bounce which you should read through if you want to learn more.
We’re interested in software solutions for debouncing buttons. This seems to be one of the most common forum questions but it can be hard to find answers in the form of reliable code examples. Do you have debounce code that you depend on in every application? Are you willing to share it with the world? We’d like to gather as many examples as possible and publish them in one-post-to-rule-them-all.
Here’s some guidelines to follow:
- Please only include debounce code. Get rid of other unrelated functions/etc.
- You should send C code. If you want to also send an assembly code version that’s fine, but it must be supplementary to the C code.
- Please comment your code. This will help others understand and use it. You may be tempted to explain the code in your email but this info is best placed in the code comments
- Cite your sources. If you adapted this code from someone else’s please include a note about that in the code comments.
As an example we’ve included one of our favorite sets of debounce code after the break. Please note how it follows the guidelines listed above.
Continue reading “Open Call: send us your Debounce code”
[Okie] designed this audio effect shield for Maple. You’ll remember that Maple is a prototyping system built around an ARM processor, so there’s plenty of power and speed under the hood. First and foremost, the shield provides input and output filters to keep noise out of the system. From there a set of potentiometers let you change the effect, with the manipulation like echo, distortion, and ring modulation happening in the firmware.
[Thomas] and a buddy were sucking down a few brews when they decided to hack their 2001 Chevy Cavalier for a bit better performance. If they could find a way to bring cooler air to the engine they speculated that they’d see an increase in efficiency. Instead of routing the air intake to a hood scoop, they took off the factory air filter and mounted a cold air filter in its place. PVC pipes were then used to create a delivery path from the front of the vehicle with the output in close proximity to the new filter. They tested their work and discovered a drop in intake temperature from 101 to 48 degrees Fahrenheit at 60 mph, and from 109 to 54 degrees Fahrenheit at 45 mph. Now the sedan runs better and generates more horsepower, all for around $35 in parts.
It’s Independence Day, so if you have pets and planned a trip, chances are you wrangled a pet sitter to keep your pet from starving or dehydrating to death. Next time, consider letting this infinite water dispenser help you instead.
The dispenser is made of a Tupperware tub, a fish tank water filter, a float switch, and a water solenoid valve. It works essentially the same way as any toilet: the solenoid valve lets water into the filter where it is dispensed to the Tupperware container. The float switch is activated when the water in the container reaches a certain level. When the water level drops due to evaporation or thirsty pets, the float switch goes down and triggers the solenoid to let in more water. The whole works are powered by a GFI outlet for safety since this project involved water, electricity and pets.