Sunday, 12 January 2014

Panelolu 2 Capacitive Button Interface ...


Touchololu Panel Overlay
The Curvy Panelolu 2 case has no buttons and its beautiful lines would be ruined by ungainly knobs and switches. To maintain the Curvy Panelolu 2's clean lines, I interfaced a Microchip micro controller incorporating m-Touch capacitive touch sensor support, in place of the usual rotary knob. The capacitive touch sensors replace all button functions in the case, with minimum space claim. Micro controller firmware then mimics, the usually deployed, rotary knob output so as to interface to a RepRap without host software modifications.


Implementation
Capacitive sensors are usually made up of conductive pads or plates and it is common to form pads on printed circuit boards attached to the back of a case.

The pads act to detect capacitance changes when a target object, such as a finger, passes in proximity to the pad,  as shown in the image below. For reliable detection the pads need to be a minimum size and the supporting panel made of suitable material. The typical recommended size for a pad is approximately 15mm square and the panel material typically used in 3D printers, such as PLA or ABS, is suitable as a supporting panel. My pads are slightly smaller but there is a 'tweak' available to address this. As I don't have conductive filament to hand; to construct the touch pads, I used adhesive backed copper tape (542-5460) on the back of the printed case.

Capacitive touch system used on Curvy Panelolu
To sense the capacitance change reliably, a part from one in my 'bits' box was selected. The circuit is based on a Microchip 16F1825. The device supports 4 capacitive touch channels of which 3 are used, leaving sufficient output pins to simulate the rotary knob 623-4237 (ALPS  EC12E2424407 encoder).

To connect the pads to the PCB in the implementation, an IDC ribbon cable was used for the harness. I found the harness was best protected from external influences by separating each conductor connecting to a pad, with a ground (or zero volt) conductor. A further two conductors, one on each of the extremities of the IDC cable would provide additional screening. Other cable arrangements will work, the main requirement is to ensure that accidentally coupled capacitance is not affecting the wiring harness i.e. fingers at the side of the box un-intentionally selecting a function. The screening conductors achieve this nicely and fixing the cable in place (initially using tape or blue tack) allowed testing of the harness installation.
Location of capacitive sensor plates for Touchololu

Connection are soldered to the pad before fixing the adhesive backed tape to the plastic case. As the heat from your soldering iron is likely to deform the case as a minimum. It's important to avoid placing the connection where the LCD panel will sit as clearances are by design small and solder and wire would get in the way. Kapton tape was placed over the display bezel to ensure the metal bezel does not touch the copper strips.


The neat thing about the mTouch library is that at start up it works out what the starting capacitance is for each of the pads. This means that it will accommodate the wiring harness automatically, adjusting for differences in length or routing. It helps to avoid noise sources and keeping the wiring harness fixed in place ensures that sensing occurs only for the desired items such as fingers. If you leave contamination over the buttons, the code has a 'long term average' feature to allow it to compensate.

Block diagram of Curvy Panelolu configuration
The code for the Microchip 16F1825 is written using the free HiTech C compiler supplied with MPLAB and uses the free Microchip m-Touch library. The code implements a simulation of the rotary encoder, generating signals equivalent to physical rotation. The button press is supported from the central pad. Running the micro controller at 5v provides additional noise immunity over a 3.6v system and at 5v, interfaces directly with the Sanguinololu board used in Huxley #710.

One of the advantages of the capacitive touch sensors interface is that a graphic overlay can be used on the front panel of any desired form, the technique is described below. Care needs to be taken not to create too thick an overlay. As the thickness affects sensitivity of the touch system, although it is possible to make some adjustment in software to compensate. The sensitivity is adjusted from the default in the implementation. As the copper strip I have is 10mm wide and square pads would make the box ungainly. I cut three lengths of 35mm for each button. The up down buttons are typically aligned with a finger in the implementation. Whereas the action / select pad is at 90 degrees to a finger. Were the same sensitivity deployed, the action / select button 'feels' unreliable. Tweaking the sensitivity allowed the same 'feel' to be achieved on all pads.
Curvy Panelolu 2 Capacitive Touch Interface circuit

As can be seen from the block diagram the default configuration of a typical Panelolu interface was extended using a Microchip micro controller. The 16F1825 device selected was one in my bits box although others will no doubt work just as well.


The implementation required only the microchip IC and 3 resistors together with connections to the copper pads. The diagram looks a little more complex as its has the Panelolu 2 basic connections. Although this implementation does not show the card reader connected, as I don't currently use the card reader.

The firmware on the Microchip 16F1825 micro controller emulates the output sequence from the typical encoder switch. The encoder output has two channels which are out of phase with each other so that the direction can be discerned. The firmware on the micro controller has filtering and de-bounce implemented to produce clean signals to feed to the MCP23017.

Construction of panel overlay
In fact if desired it would be straight forward to implement a dial using the capacitive sensor pads arranged in a slightly different manner so as to achieve the same implementation as the rotary encoder. With little additional effort, the push action can be implemented as well to completely mimic the functionality but with much more flexibility.


The panel technique I used is straightforward. First the graphic is printed onto adhesive backed paper. The paper can then be covered with transparent adhesive backed plastic for a wipe clean surface. This material is usually not optically correct, so where some graphic displays are deployed, fringing will be seen . In these cases a window should be cut in the transparent film plastic and optically correct plastic inserted. Alternatives are to print buttons in different colours set into the panel, perhaps being formed from conductive filament.

If you decide to make your own Touchololu panel graphic, the templates are here:
Template For Panel Graphic

Link to Touchololu PowerPoint template
Link to Touchololu PDF template

Link to Button documentation

Marlin had a few bugs in the non interrupt button implementation that I came across when testing out the interface. So there was some debugging of Marlin as well.

A short video showing a test of the capacitive sensor sensitivity


Another short video showing the built unit working with Marlin. Note that in Marlin, the pulses per change was modified from 5 to 1 pulse and the dead zone from 10 to 2 pulses. 

I usually use green LCD displays, this display is a Displaytech 204A series module. In some lighting conditions seems to have less clarity than the green units. Note the 'feature' in Marlin where decreasing the number needs a reverse direction, it's not Touchololu. The drift of my finger is due to the close proximity of the camera and attempting not to block its view of the screen.


There is an update post to follow this...

No comments:

Post a Comment