Tuesday, September 15, 2015

Styra Joystick Prototype

The first fully functional prototype to roll off the production line is the Styra Joystick. The concept with this prototype is to provide a mouse alternative for pointer control. After several trial runs, I decided on the following criteria for this prototype:
  1. The prototype needed to provide a perfect "click" and "double-click," regardless of how long a button was pressed. 
  2. The prototype needed to provide a way to grab, aka click-and-drag, an item.
  3. The prototype needed a way to adjust pointer speed on-the-fly, not through an OS control panel setting.
  4. This prototype should not require any modification on the host PC to function.  Just plug it in and go. Since the design is based on the Arduino Leonardo, the requirement is easy.


Figure 1:  State machine for processing clicks
I worked through several different approaches for implementing the desired click functionality before I finally decided on a state machine. Figure one shows the three different flows for processing click, double-click, and latch functionality.




Figure 2:  Flex sensor
Figure 3:  Flex sensor in action
Mouse pointer movements for the Arduino are sent to the computer as X,Y position changes relative to the current pointer position. To implement on-the-fly pointer speed control, we read a value from a sensor connected to an analog input pin on the Arduino. The value from the sensor controls the speed of the pointer.

There are quite a few types of sensors to choose from, but the one that shows the most promise is a flex sensor, shown in figures 2 and 3. This sensor changes its value based upon how much it is bent.  Bend it a little, it returns a small value. Bend it a lot, much greater value. (That could be backward, but you get the point.) A sensor like this could be sewn into something attached to a wrist, ankle, foot, finger, etc. Just bending a finger or moving a foot could control the speed of the pointer.

We have two of these sensors to play with. If you have suggestions on how they might be used, leave some feedback. We're open to ideas.



Figure 4:  Styra Joystick Prototype
Figure 4 shows the completed Styra Joystick prototype. This prototype uses an Arduino Leonardo connected to one of the custom 16 input modules, though it only requires 8 inputs. The knob at the upper left corner of the prototype controls the pointer speed. The four buttons perform the following: left-click, double left-click, left-click hold/release, right-click.

The Styra Joystick requires a little getting used to, but I have used it for several hours to browse the Internet and it really isn't too bad.

We're still getting caught up on the blog posts.  More coming soon!


Monday, September 14, 2015

PCB Modules



Playing catch up again...  The PCBs arrived from Germany on August 21st, professional and practically perfect. Somehow the 'T' in Styra didn't show up, but the design for the electronics printed out just as it should. The boards were assembled and tested in short order and prototyping work is well under way. Before we jump into the prototyping work, I wanted to show off the beautiful printed circuit boards from Fritzing!



Figure 1: 32 input shield for Mini-PAC

Figure 2: 16 input module (version 2)


Figure 3: 16 input module (version 3)

Figure 4:  $250 worth of printed circuit boards

I ordered these boards through the Fritzing project from Germany. I paid a little more for shipping than I would have if I had ordered the boards from a fab in the US, but they were able to process the native Fritzing file format AND part of the proceeds goes to fund further development of the open source Fritzing development environment. I only ordered a total of eight boards, but they included an extra board of each design without any additional charge. The boards turned out beautifully.



Figure 5:  Assembled 16 input module (version 2) 
The fully assembled through-hole version of the 16 input PCB module shown in figure 5 was easy to put together and only required about 25 minutes each to assemble.

Figure 6:  Assembled 16 input module (version 3)
The fully assembled surface-mount version shown in figure 6 required nearly 45 minutes to assemble due to the amount of time I spent checking and double checking the solder connections. Both versions work exceptionally well and they both can be used interchangeably (and simultaneously) in keyboard prototypes. The four pin headers in the lower left of the PCBs allow up to 8 input modules to be daisy-chained together, providing up to 128 button inputs for a single keyboard.


The first batch of Styra 16 input modules is ready for integration into prototypes!  :)

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!  :)



Sunday, July 5, 2015

3D Printing and Button Debouncing


The 3D printer had more lessons to teach once it was put together and working. After several successes and failures in printing, it decided Luke needed to fix some wires to keep it running smoothly. Back in action, it went to stay with Phill for awhile so he could focus on printing while Luke switched to working on the electronics and programming elements. 







Phill designed and printed a way to mount the spool of filament. 



Luke working with an oscilloscope and Leonardo to debounce buttons.


(Luke's learning about surface mount soldering. This is a tiny chip to put in place!)

If you don't know what debouncing is (and perhaps your first thought was Rabbit wishing to debounce Tigger—hey, we've got a toddler in the house) then here is a handy definition from Whatis.com:

"Bouncing is the tendency of any two metal contacts in an electronic device to generate multiple signals as the contacts close or open; debouncing is any kind of hardware device or software that ensures that only a single signal will be acted upon for a single opening or closing of a contact" (Margaret Rouse TechTarget). 

If you find your TV remote doesn't respond correctly when punching buttons, likely it wasn't debounced. Your computer keys, however, should register only the single signals as you type so you shouldn't want to throw the keyboard the way you might throw your remote. 


Tuesday, May 19, 2015

Some Assembly Required

With a clean workspace, a sturdy table, and most of the materials ready and waiting, it was time to really get started on the project. Assembling the 3D printer was a painstaking process. Luke and Phillip Thomas spent the majority of one day building it. Though lots more work than just buying a pre-built model, it was a great opportunity to learn the ins and outs of the machine. 


Phill:  "All the parts just fit together. This will be easy!"


Turns out there was more than just matching screws to holes. Calibrating the machine was no easy step. 




10 hours later...


Once test chips could be printed it became "Goldilocks and The Three Bears": This one's too rough, that one's too thick, that one's not square; This one's too hot, this one's too cold. Oh no! this one scratched the bed. Try, try again. Many days of failed prints followed.


Finally, Luke was able to print without scratching the bed.


 But he still hasn't figured out how to remove the prints without stripping the tape off as well.


These are the first three prototype button mounts, designed by Phillip Thomas. The buttons snap easily into the mounts, which interlock tightly with LEGO bricks.


This is a sample 2x6 layout that combines buttons with LEGO support.

With the 3D printer in action and progress being made, the excitement around here is contagious! Special shout-out to Daddy's little helper—when he wasn't throwing LEGO bricks around the garage!


Monday, May 4, 2015

Getting the Green Light

The Styra Project is up and running!

After much pacing and checking of his e-mail again and again, Luke happily reported that Balihoo accepted his application for a grant to purchase a 3D printer and materials to start building keyboard prototypes. What an amazing company to support this and other projects that center around giving! Does your company do that?

With funds assured, Luke sat down and looked over his plan of what printer and filament to buy and what other essential parts and pieces he needed to get started. He completed his order, and what do you know but the printer is already here! It came as a kit, so it will have to be assembled. Before doing that, the next step was to clean up the lab/workshop, and build a sturdy table for a work surface. Thanks goes out to Herb Ankrum for the time, tools, and skills on a Sunday afternoon putting together an awesome table.






Now Luke just has to figure out how to sleep tonight when all he wants to do is create and build!