Good looking unit you made there. Nice work. I guess i'm going to have to start playing a bit with cap sensing on the 16F1827 here shortly...![]()
Good looking unit you made there. Nice work. I guess i'm going to have to start playing a bit with cap sensing on the 16F1827 here shortly...![]()
rmteo,
Nice project. I have a project using CSM (capacitive sensing module) on a 16F727. In that project I'm using only two buttons. Yes, you can do it with any PIC but you will need some extra external components.
How did you do the external plastic cover for the buttons? Was it custom made by some company?
Robert
I used a clear acetate (0.012in.thick) overlay for the buttons. This way, the end user can change legends by printing their own labels on paper using an ink-jet printer. This is one of the nice features of a capacitive switch - you don't have to spend a lot of money for custom labels (and the attendant lead times). And you can change labels easily and cheaply at any time. There is a downside though - there is no feedback (like tactile with a mechanical switch). I implemented an audible click using a buzzer like this one, which is also used for alarms, etc.
![]()
I got the material from a local office supply place - OfficeMax. It is the clear stuff used as covers for book bindings.
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:
The touch button is simply a 3/16" stainless steel machine screw through the faceplate withCode:'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
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.
Hi Norm.
I think you can shorten your code by Left justify the AD results and take only the ADRESH. Same as with the lines:
IoannisCode:wAD.LowByte = ADRESL ' 2520 10 BIT AD ONLY wAD.HighByte = ADRESH yAD_ARRAY100[i] = wAD >> 2
Norm,
There are many ways to do it. You can also use the interrupt TMR1 to detect changes in the output frequency due to a pad being touched by a finger. This is explained in AN1101 "Introduction to Capacitive Sensing".
http://ww1.microchip.com/downloads/e...tes/01101a.pdf
I see that you are using AN1286 "Water-Resistant Capacitive Sensing". If you are using your touch sensors in a wet environment, then you might want to consider using inductive sensors. Take a look at the table I attached to this post.
http://www.microchip.com/stellent/id...param=en538303
Robert
Bookmarks