Arcade controls

Unfortunately, I wrote this post originally 6 months ago, but I didn’t post it, because I thought I would have time to do followup. Since I am insanely busy right now with kids, life, work, etc. I’m flushing this draft.

I have wanted to have a USB based arcade controller for awhile, but I have never had time to build one. A friend of mine at work had made some arcade controls out of scrap wood but he didn’t have time to complete his MAME project. He wasn’t using them, and I had been talking about making a MAME cabinet, so he brought them in for me to play with.  He did a pretty nice job making them, especially since this was scrap wood from his old CRT constrained entertainment center.

The first thing was to wire them up. I wanted to do it somewhat cleanly instead of soldering directly to everything like I would normally do. Another friend at work happened to have some crimping supplies and tools and so he gave me a tool. F-Connectors (female) are the things that microswitches usually are connected with. So I set to making a daisy chained ground wire and individual wire for each control. I also made a wire for each button. On the other end I wanted to attach to a type of controller so I could expose the controls as a GamePad or keyboard HID device through USB. He also showed me how to crimp female dupont connectors. I must say knowing a bit more about interconnections is awesome and it opens a whole new world of making my own cables. I somehow feel like there is a lot that is easily findable about doing electronics, but the mechanics of connections and making wiring work are not there.

I had a Teensy in mind (actually I had a V-USB Arduino in mind, but I decided against that after I learned about the issue that 5V arduinos need some annoying special treatment to do V-USB i.e. Zener diodes or proper level conversion).  Teensy LC came out just after I ordered by Teensy’s, so I was a little bummed that I could have done the project cheaper.

DSC_4604-3

Once everything was wired up, I needed to do some testing. Since my Teensy board from Adafruit was delayed,  I decided to use a Arduino Mini Pro. I knew that bouncing would be an issue. It seemed like the simplest debouncing solution was just to make  a basic time filter by using a counter. If you read a button state you compare it to your debounced state. If it is different than the debounced state you add to a counter, if it is the same and the count is non-zero you subtract from the counter. If the counter reaches your threshold, then switch the state. That worked fine and eliminated a lot of bounce. In a sense this is similar to a capacitor charge trigger hardware debounce. We are just sampling the button state and assuming it was the same in the time interval of the polling and integrating it. Since the time intervals are all the same we can just use counts as a proxy for the true integral.

I decided it would be good to look at the bounce on the scope. On the first image you can see the a single press and release of the button. The yellow is the unfiltered single, the blue is a filtered with counter signal emitted from the arduino.

 

DSC_4600-1pressAndRelease

If we zoom in to the button press which causes a high-to-low edge trigger, we can see a bunch of noise. However, the filtering works admirably.

bounceOnPress

The situation is similar on the button release, but here you can also see the 500us debounce widow

bounceOnRelease

Once all this was done I used the excellent Teensy library to make  a USB HID Keyboard. It was super trivial. This experience with the teensy is so much better than when I did a PlayStation 2 Guitar Hero Guitar to Play Station 3 Rock Band guitar device using the Pic 18f4550.

Post-modern project documentation.

It’s been a long time since the first web page I put on the internet in 1995. At that time having a web page was a novelty and oddity and much more. I’ve maintained a web presence in the past, and I suppose I always will in the future. Even with the progression to social media being the dominant form of online expression, the individual web-site and blog seems the most powerful way to communicate meaningful technology.

My day job keeps me very busy and my home life too. But I manage to still entertain myself with doing additional side projects. I’ve gotten so much entertainment and inspiration from following others’ content through hackaday and all the sites it links that I feel it is time that I contribute back. I don’t know if this will be a success or just another time-starved and transient fancy.

More recently blondihacks, big mess of wires, and magic-1 were inspiring because the projects are documented, including all the failures, the steps and decisions that are made. These are the most interesting part of any project but they are usually wiped away by the desire to make one’s project look clean and pure.  The individual exploration to learn things is definitely the cause of innovation. It is impossible for someone to tell you the right answer and actually learn as much as discovering that right answer on your own. However, reading someone’s trials and tribulations is perhaps a happy medium.

Showing the final product vs showing the evolution that got to the final project is perhaps the purest expression of modernity vs post-modernity that I have experienced. It seems in engineering, as in life, the absolute truth is fleeting. The quality of your engineered product is more measured by your original design goals and how you approached them.

With that heady and precocious start, I promise to have some real content in the future.