Shop OBEX P1 Docs P2 Docs Learn Events
Alternative mode for the QuickStart touch buttons — Parallax Forums

Alternative mode for the QuickStart touch buttons

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2011-06-15 20:37 in Propeller 1
I've discovered that, if you cover the touch buttons with a thin layer of Kapton tape to insulate them completely, they still function -- sort of -- and are impervious to moisture effects. I say "sort of" because they only activate momentarily when released. But the effect is quite dependable with the stock button software. This effect appears to be capacitive in nature and unrelated to any 60 Hz e-field pickup. I can say this with some assurance, because when I place a 1/4" disk of brass shim atop one of the insulated buttons and tilt the board to let it slide off, the LED flashes when it slides off.

Perhaps this phenomenon could be accentuated by a software modification and harnessed for a different kind of button response.

-Phil

Addendum: To increase the reliability of this effect, it's helpful to increase the wait time to 1/20th sec and decrease COUNT to 8.

Comments

  • BeanBean Posts: 8,129
    edited 2011-06-14 10:35
    Phil,
    I did some experimenting with your idea and this code seems to detect the buttons with high reliablity.

    The code turns on all LEDs when no button is sensed (so you can see if it is sensed intermittently).
    ' PropBasic demo program for Parallax QuickStart board
    '  Insulated Buttons demo. Place tape over buttons.
    '  Shows on LEDs which button is pressed.
    '  If no button pressed, ALL LEDs are on.
    '
    DEVICE P8X32A,XTAL1, PLL16X
    FREQ 80_000_000
    
    
    Buttons  PIN 7..0            ' QuickStart Button pins
    LEDs     PIN 23..16 LOW      ' QuickStart LED pins
    
    temp     VAR LONG            ' Holds button value
    
    ReadButtons FUNC 0           ' Function to read QuickStart buttons
    
    PROGRAM Start                ' Start program at "Start:" label
    
    Start:
      DO
        temp = ReadButtons       ' Read the buttons
        IF temp = 0 THEN         ' If no button pressed then,
          LEDs = 255             '   turn on all LEDs.
        ELSE                     ' otherwise
          LEDs = temp            '   turn on the pressed LED.
        ENDIF
      LOOP                       ' Repeat forever
    END
    
    
    FUNC ReadButtons
      __param1 = 0               ' Set sensed button to zero
      __param3 = 0               ' Set count to zero
      DO
        __param2 = __param1      ' __param2 = last button sensed
        HIGH Buttons             ' Sense buttons
        INPUT Buttons
        __param4 = 100           ' Prepare for a maximum of 100 loops
        DO
          PAUSEUS 250
          __param1 = ~Buttons
          IF __param1 > 0 THEN EXIT ' If a button is sensed, exit loop
        LOOP __param4               ' Loop for maximum of 100 * 250 uSec
        IF __param4 = 0 THEN EXIT   ' If no buttons sensed, then exit loop
        LOW Buttons
        IF __param1 = __param2 THEN ' If sensed button = last button then
          INC __param3              '  increase count
        ELSE                        ' otherwise
          __param3 = 0              '  set count to zero (different button sensed)
        ENDIF
      LOOP UNTIL __param3 = 8       ' Loop until 8 counts of same button sensed
      RETURN __param1
    ENDFUNC
    
    Bean
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-06-14 11:16
    Hey Bean,

    I tried your program, and all eight LEDs come on, but no button touches are detected.

    -Phil
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2011-06-14 13:03
    interesting observation Phil. With Kapton film (a stencil from Oharap), I found it could be sensitized by rubbing with a fleece or cloth, and then even waving the edge of it 1 cm from the buttons would cause leds to turn on briefly. Shake it, the LEDs follow suit. It's static cling, I guess. Another feature of the quickstart. iElectrometer. Not surprisingly, I could not make that happen with the shielding bag that the quickstart came packaged in.
  • BeanBean Posts: 8,129
    edited 2011-06-15 05:50
    Phil,
    That's weird. I only have one board at the moment, I wonder if it is variances in the PCB or what ???

    Bean
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2011-06-15 10:08
    Bean,

    It may have something to do with the choice of tape (dielectric+adhesive) and the environment. For me:

    --2.5 mil Scotch magic tape: does not work
    --3 mil Kapton film (not tape, just laid on top of pads): does not work
    --3.5 mil pink polyethylene (bag the quickstart came in, one thickness: works on --p7..p4 but on p3..p0. Needs lots of pressure.
    --1 mil pink polyethylene (antistat, laid on top of pads): works on p7..p5 but not p4..p0
    --0.5 mil polyethylene (white translucent kitchen bag, laid on top): works on all, more pressure required on p0 than on p7.
    --no insulation: works fine, sensitive on all pins.

    If I'm not mistaken, your program does a simple RCtime on all the pins (like the demo) and then goes into a debounce/confirm loop when it finds one pin low. I simply don't see the physics of it. The whole thing depends on having some physical principle to move charge off of the combined capacitance of the Prop pin gate and the pcb traces. The way David intended for that to happen is supposed to be the ohms of resistance provided by your fingertip. But it could also be displacement current (capacitance) through an insulator, and that could be AC electric fields, or static electricity from your body, or charge on the plastic itself, or even perhaps piezoelectricity. Results would vary. The standard demo program does not work anything like Bean's when the 0.5 polyethylene is in place. With the standard program lights occasionally flicker.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-06-15 11:15
    My Kapton tape is 2 mils thick. I was somewhat concerned about triboelectricity, so I sealed it down very tight, to the point that the pad contours can be felt on the tape's top surface.

    For reliable capacitive sensing, the resistive-sensing circuit topology is not optimal. Something like the following might give better results:

    attachment.php?attachmentid=82189&d=1308161240

    Here, each button is excited by a frequency, in turn, with the capacitively-coupled signal referred to a common sigma-delta-like structure. The I/O pins are coupled to a counter with negative feedback, as with a sigma-delta ADC, but a separate counter with logic inputs is used as a synchronous detector. This would work similarly to the way my AM radio detector works, except that there's no need for quadrature detection, since we already know the phase of the incoming signal. Using synchronous detection like this should also cancel out any effects of 60 Hz e-field pickup or static electricity.

    To detect a button press, you'd have to compare the incoming signal strength to a predetermined background level.

    -Phil
    290 x 240 - 5K
  • LeonLeon Posts: 7,620
    edited 2011-06-15 11:32
    Microchip has a lot of techniques for capacitive touch sensing:

    http://www.microchip.com/en_us/technology/mtouch/

    The pads on the QS board won't be suitable, although it might be possible to modify them.
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2011-06-15 17:07
    qProx sensors (now from Atmel) use an easier to understand method for simple buttons. It uses the technique of charge transfer.

    sampled_C.png


    The unknown capacitor (finger on pad + strays) is Cx, a small value in the pF to nF range, and CA is a much larger accumulation capacitor. Sw is a mosfet switch, for charge transfer. Cx is repeatedly charged by CPU pin p0 as a output, which then becomes an input, and then pin p1 causes Sw to close and transfer the charge on Cx over to CA. Pin p2 monitors the voltage on CA. Since CA is much larger than Cx it takes many charge transfer cycles to bring it up to threshold. The count of how many is inversely proportional to Cx. By playing with the pulse widths and spacing, it can account for leakage and soakage in Cx, factors which are important in some practical applications.

    There is a writeup in the QT113 data sheet.

    This technique is not applicable to the quickstart board pads, as is. I've used the technique with the SX20 chip, which was well suited to quick manipulation of the pins in firmware. The Prop could do that too, for DIY simple capacitive buttons.
    403 x 181 - 8K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-06-15 20:37
    I sacrificed a QuickStart board to isolate the switch common pads from ground so I could try my circuit in the post above. It was pretty much a bust, I'm sorry to say. Individually, and without the insulating tape (so the switch mode was a combination of resistance and capacitance), I got reliable results. Plus, breathing on the contacts did not produce any hits. Where things fell apart, though, was when multiple buttons were pressed at once, sometimes yielding spurious results on non-touched buttons.

    -Phil
Sign In or Register to comment.