PIC touch switch

Status
Not open for further replies.

Mosaic

Well-Known Member
Hi all, I am hoping to make a touch sensor using just the copper traces on a PCB via a PIC 16f886 at 3V.

I could use some advice on the approach.

Also,
I am a bit concerned about ESD zapping the PIC although this pic has diodes clamping the inputs. Are they sufficient?
 
What's the PIC for?

You can do this with a single transistor (well, two - in a Darlington pair. But a single package).

If the rest of the circuit (whatever the switch is for) needs the 16F then I would suggest perhaps using a single transistor as I mentioned to make that an input on the PIC and remove your concerns. Although I make no claims to know a lot about ESD.
 
The PIC has a primary purpose other than the touch sensor. It also has some mtouch capacitive capability that I have never used so I was hoping for some guidance there.
 
I've use the simple copper thing in the past, it worked for me, just need to poll the pin really often. I've never destroyed a PIC for any HomeUse thing as of yet, some are installed since 4-5 years. the mTouch approach is more clean though... don't need to expose any metallic part.
 
Here is the simple code I used.
Put 100p on input to 0v.

The same line then turns on a transistor via 2 signal diodes so that one line does two things.


Code:
Main    bcf    gpio,4        ;make line LOW to discharge 100p
    call    _10uS    
    bsf    gpio,4        ;make line HIGH to charge 100p
    bsf    status, rp0     ;Bank 1            
    movlw    b'11111000'    ;Set TRIS  GP4 in
    movwf    TRISIO                   
    bcf    status, rp0    ;bank 0        
    call    _20mS
    btfss    gpio,4
    goto    $+3
    bcf    gpio,2
    goto    Main
    bsf    status, rp0     ;Bank 1            
    movlw    b'11001000'    ;Set TRIS  GP4 out
    movwf    TRISIO                   
    bcf    status, rp0    ;bank 0
    bsf    gpio,4        ;turn on LEDs and transistor
    call    _250mS
    goto    Main
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…