16F726 Capacitive sensing module


Results 1 to 40 of 40

Threaded View

  1. #19
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    I have been using capacitive touch switches for several years with little problem except the
    Q prox chips became obsoleted after a couple of years.

    Any Microchip can be used as the requirements are unbelievably simple:
    An I/O pin to charge with supply voltage and an AD pin to read the cap sense value.

    I sometimes take 20 to 100 readings, bubble sort them highest to lowest, then average
    only array elements 20% to 80% to to remove any errant readings.
    The outcome is stable, varies only one or two at 8 bit.
    The AD needs to be coded for power conservation however.

    The following code is derived almost directly from AN1286:
    Code:
    'PIC18F2520  
    subLOAD_AD_ARRAY:
        ADCON0 = %00000001  'ENABLES AD
        For i = 0 To 99
            LOW PORTA.0
            LOW PORTA.2 
            ASM 
            NOP 
            ENDASM 
            TRISA.0 = 1 'INPUT
            HIGH PORTA.2
            ASM 
            NOP
            ENDASM 
    
            'AD BY REGISTER'S  
            ADCON0.1 = 1   ' START AD  GO/DONE BIT
            While ADCON0.1 = 1 : Wend  ' AD ENDED GO/DONE Bit
            wAD.LowByte = ADRESL       ' 2520 10 BIT AD ONLY
            wAD.HighByte = ADRESH  
            yAD_ARRAY100[i] = wAD >> 2
        Next
        ADCON0 = %00000000  'DISABLE AD
        Return
    The touch button is simply a 3/16" stainless steel machine screw through the faceplate with
    a double nut tightened around a soldered wire loop connected to the AD.
    I add a little grommet for looks.
    The charge lead is simply wound several times around the screw behind the faceplate.

    Another version is individual metal tabs of sheet metal adhered to the underside of the
    enclosure for buttons.
    The AD wire is soldered to each tab and the charge wire only needs to wrap around the
    AD wire or all AD wires.

    The cap sensor readings can vary over time and the base line to compare the readings against
    should be re zeroed and a new max value redetermined at regular intervals.

    I laminate an inkjet photo quality paper (not photo paper) printout for the faceplate.

    The last consideration is ESD.
    A simple 100k resistor in line on both leads is a good solution.

    Norm
    Last edited by Normnet; - 7th May 2010 at 04:50.

Similar Threads

  1. Version Control
    By btaylor in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 16th October 2011, 17:12
  2. Relaxation oscillators (for capacititive touch sensing)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 6th December 2009, 22:03
  3. mTouch capacitive sensing
    By jrprogrammer in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 1st November 2008, 22:54
  4. Replies: 1
    Last Post: - 27th July 2008, 06:14
  5. Rf module
    By tangray in forum Adverts
    Replies: 0
    Last Post: - 7th August 2006, 07:14

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts