Debounce Code – one post to rule them all

Last month we asked you to send in your debounce code. You didn’t disappoint and it’s time to share the code received. There were some guideline for sending in code so if you don’t see yours here, it probably didn’t follow the rules, sorry. We also tried to weed out code that using delay loops for debounce. These tend to be a poor way to handle inputs because they monopolize the processor.

We wanted to add upvote/downvote buttons to each set of code to give some idea of a group consensus on code quality but there’s no good system available for multiple up/down vote widgets on one wordpress page. This results in a huge code dump for any one person to go through. If you’ve got any ideas on how to better organize this let us know: debounce@hackaday.com.

We make no guarantees that this code is safe to use, or that it even works. Test it carefully before using for important tasks.

Join us after the break for a whirlwind of code examples.

[Read more...]

Open Call: send us your Debounce code

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.

Send your debounce code to: debounce@hackaday.com

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.

[Read more...]

Make that C64 Keyboard Work as a USB Keyboard

keyboard-to-usb-mapping

Let’s face it, we all have keyboard peculiarities. Don’t try to deny it, everyone who types a lot has an opinion of the keyboard they stroke so frequently. We know [Brian Benchoff] swears by his model M, and we’re guessing he was the one that bumped into [Evan] and convinced him to write about his conversion of a Commodore 64 keyboard for use as a USB device.

This is not [Evan's] first rodeo. We recently saw him fixing up the worn off letters of his own model M. But this time around there’s some clever microcontroller work at play. Apparently mapping 122 keys using an Atmel AVR 32u4 chip (built in USB connectivity) is quite a task. Luckily someone’s already worked out all kinds of good things and is sharing the love with the Soarer’s Keyboard Controller Firmware. Of course it handles scanning, but also includes debounce, muxing, and the trick to scan more keys than the uC has pins for. We still don’t fully understand that bit of it. But [Evan] did post the config file he’s using so perhaps after we get elbow-deep in the code we’ll have a better understanding.

If you give this a try, we want to hear about it. Anyone have any modern keyboards they’re in love with? Leave a comment below.

Judge Spotlight: Jack Ganssle

judge-spotlight-ganssle

This week we’re getting to know The Hackaday Prize Judge [Jack Ganssle] a little better. His depth of experience with embedded systems is formidable, and recently I was very interested to learn about his mission to improve the quality of the product in the embedded code universe. We’ll get to that in a little bit, but I wanted to start off with [Jack's] answer to my final question.


judge-spotlight-q5Is there anything else you’d like our audience to know about you?

judge-spotlight-a5Intel 8008 Chip on white backgroundMy entry into this field was when the first 8 bit processor (the 8008) came out, and still find it endlessly fascinating. I write a lot about embedded topics, and give talks and seminars, on all of the continents except Antarctica (so far!). We live in heavily-wooded Finksburg, MD, which is just stunning this time of year, and, since my office is in the house, the commute is pretty tolerable. Other passions include sailing; I wrote an on-line book (www.ganssle.com/jack) about racing alone across the Atlantic. Great trip, other than losing the boat.

[Read more...]

Vector Graphic Flappy Bird Harder Than It Should Be

 

The dark room at Maker Faire was loud,  after all it’s where Arc Attack was set up plus several other displays that had music. But if you braved the audio, and managed not to experience a seizure or migraine from all the blinking you were greeted with these sharply glowing vector displays on exhibit at the TubeTime booth. We did the best we could with the camera work, but the sharpness of the lines, and contrast of the phosphorescent images against the black screen still seems to pop more if viewed in person.

This isn’t [Eric's] first attempt at driving high-voltage tube displays. We previously covered his dekatron kitchen timer. But we’d say he certainly stepped things up several notches in the years between then and now. He blogged about Asteroids, which is running on the same hardware as the Flappy Bird demo from our video above. An STM32F4 Discovery board is running a 6502 emulator to push the game to [Eric's] CRT vector driver hardware.

Just before we were done at the booth, [Eric] turned to us with a twinkle in his eye. He confessed his delight in purposely leaving out any button debounce from the Flappy Bird demo. As if it wasn’t hard enough it tends to glitch after passing just a few of the pipe gates. Muhuhahaha!

Fubarino Contest: Hackaday In Your Soldering Iron

Solder

Besides a coffee pot, the most important tool on the electronic tinkerer’s workbench is the soldering iron. Surprisingly, though, we haven’t seen many people build their own soldering stations. [Pjkim] did, and went so far as to include an easter egg for our Fubarino contest.

A few years ago, [Pjkim] received a free Soldering Iron Driver from Dangerous Prototypes. This awesome kit provides everything you could want out of a soldering iron – USB and serial data logging, a 2×16 display, compatibility with a whole bunch of solder tips, and it’s completely reprogrammable.

[Pjkim]‘s task for the Fubarino contest was to put an easter egg somewhere in the soldering iron. He did that by having the Hackaday URL display when the iron is ready for use. This isn’t the only firmware modification, either: the new firmware also debounces the button presses and adds auto repeat.

If you’re looking for some code, [Pjkim] put everything up on the Hackaday forums. There’s also a video showing off the easter egg available below.


This is an entry in the Fubarino Contest for a chance at one of the 20 Fubarino SD boards which Microchip has put up as prizes!

[Read more...]

Wireless pinball controller for tablet gaming

wireless-pinball-controller

This wooden box is a wireless pinball controller and tablet stand. The idea is to set it on a workbench to give you some of the thrill of standing and playing the real thing. [Jeff] has been rather addicted to playing a pinball app on Android lately, and started the journey because he needed a way to give his thumbs some relief.

An Arduino monitors buttons on either side of this wooden controller. [Jeff] is new to working with hardware (he’s a Linux Kernel developer by trade) and was immediately struck with button debouncing issues. Rather than handle this in software (we’ve got a super-messy thread on that issue with our favorite at the bottom) he chose a hardware solution by building an SR latch out of two NAND gates.

With the inputs sorted out he added a BlueSMiRF board to the project which allowed him to connect a Nexus 7 tablet via Bluetooth. At this point he ran into some problems getting the device to respond to his control as if it were an external keyboard. His stop-gap solution was to switch to a Galaxy Tab 10.1 which wasn’t throwing cryptic errors. Hopefully he’ll fix this in the next iteration which will also include adding a plunger to launch the pinball, a part which just arrived in the mail as he was writing up this success.

We’ve embedded his quick demo video after the break.

[Read more...]