Monday, August 10, 2015

Opening Doors


Tonight marks a first for the Styra Project: We ordered a batch of custom printed circuit boards (PCBs). For perfectionists like James and I, it is hard to make the call that something is "good enough." And since this was our first attempt at designing custom PCBs, we wanted to get it right.

For the keyboard controller prototypes, we're investigating two different approaches. The first approach repurposes a device designed for building arcade cabinets. The Mini-PAC is a fully integrated keyboard controller designed for attaching arcade buttons, joysticks and other devices to a computer. This device is compact and inexpensive. It supports a large number of buttons and is potentially a fantastic fit for our project. The downside is that it is closed-source and only produced by a single manufacturer in Europe. The PCB board shown in Figure 1 will plug onto the Mini-PAC as a "shield" and allow the connection of up to 32 buttons using standard two-pin headers.


Figure 1: 32 input shield for Mini-PAC

The second approach we're investigating for the keyboard controller is one that leverages open-source hardware and software, specifically the Arduino Leonardo. There are several advantages to this approach, specifically that it allows for a great deal of flexibility in sourcing components as well as customization. Unfortunately the Leonardo does not have sufficient I/O inputs, and while there are techniques that can be used to add more buttons (charlie plexing / scanning/ bit shifting), I have decided that for the Styra Project it makes sense to create input modules that attach to an I2C bus.

Due to the limited scalability of using software debouncing, I decided to add hardware debouncing to the modules as well. Figure 2 shows the design for a 16 input module with hardware debouncing using entirely through-hole components. This design requires more components on the board, but is easy to solder. The EDE2008 chips used in this design have a debounce interval of 25ms, which is more than enough for the buttons we are using.   

Figure 2: 16 input module (version 2)

Figure 3 shows a second 16 input module but with a couple of surface mount components. This design utilizes the MAX6818 chips, which have a 50ms debounce interval and may feel sluggish to people who push buttons lightning fast. The layout is cleaner but the surface mount components can be a pain to solder.

Figure 3: 16 input module (version 3)
The PCBs will be on their way soon, and we will only have a couple more orders to make to have all our hardware for the project.

Finally, I would like to give a shout out to Roy Kimball for his design of the new Styra Project logo. His design was able to capture what this project is all about: opening doors.  :) We got it just in time to get it onto the PCB boards.


Sunday, August 2, 2015

Bug Removal

“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)

(This post comes straight from Luke, as only he can describe the details of his work over the last few weeks. Stay tuned for his report of his meticulous work from the last few days.) 

The Debouncing Continues

 The prototype keyboard depends on a single button press triggering a single corresponding action. As any engineer knows, a project like this requires a lot of testing. However, testing in this case means pressing buttons many, many, MANY times. :) So what I needed was a test harness to push buttons for me! I read several posts online about people having similar bounce issues when working with relays. I tested a few on the oscilloscope and found that they bounce similarly to the buttons I am using for this project. The end result was that I was able to use a second Arduino to drive the relays in specific patterns, then monitor the inputs of the prototype keyboard controller connected to a computer to ensure the pattern is received without error. 




Shown above is the test harness circuit. The Arduino Uno is at the top of the image, connected to one of the MCP23017 chips that I have been playing with for The Styra Project. The MCP23017 is connected to a bank of eight transistors that drive the 12volt relays at the bottom of the image.


This picture shows the test harness connected to the button inputs of my prototype keyboard controller. The laptop is capturing the button presses and tracking any errors. When the test harness is running it sounds like a swarm of crickets in the garage. With the lights off it is like a scene from the Star Trek TNG Schisms episode.





Using the test harness I was able to diagnose several intermittent problems with my initial design. The first was that after five to ten minutes of pressing buttons, the prototype controller stops sending button presses. This was traced to an issue with the i2c bus and a lack of pull-up resistors on the signal lines. A second issue was found in my software debouncer that limited how well it would scale as I increased the number of buttons.

The prototype keyboard project is designed around the idea of assembling panels of buttons into modules that can be connected together.  Up until this point, my testing has been with a single panel, but to prove my design, I need to connect multiple modules together.  The above picture shows a total of five i2c devices connected to a single bus. This configuration supports up to 64 buttons, hardware or software debouncing and hardware interrupts. The oscilloscope is tracing the clock signal to make sure I have good values for the pull-up resistors.  I need to do further testing to determine if I can fine a single resistor value that will work for multiple devices or if I will need to build a chart of values to use depending upon the number of modules attached.

One final note, the gray button panel shown above is Phill's latest design from the 3D-printing side of the project. We had some initial trouble successfully printing larger parts, but Phill has spent many hours perfecting the process and we are now able to print designs the full width of the print bed. Phill made this design specifically to help with my testing as I needed the ability to connect (and manage) 16 buttons to a single module.  Phill is currently working on panel layouts for specific navigation and browsing functionality.  Picture coming soon!  :)