I prototyped the circuit on a PCB instead of a breadboard
I made this circuit, because i faced several problems with the touch-pad for my keycode doorlock project. I tried many different touch-pad designs, yet all had problems. Designing a touch-pad is not a simple thing after all. There are several considerations to take into account, and as i found out (the hard way) experience is mostly needed. So, here is one touch-pad that works and you can use it as-is for your designs.
The Circuit
The fundamental rule when designing a touch-pad is this: Keep the wires as close as possible. When i designed my keycode doorlock project, i had only one PIC to handle everything including the touchpad. But the PIC was hidden inside the door, so i had long wires (about 10-15cm) to connect the pads with the PIC. That was a bad idea. So, i came to the conclusion that the touchpad must have a dedicated PIC on-board to minimize the wire length. And here is the circuit: (as always, click to maximize the picture)
The circuit is straight-forward. The 16F1937 has 16 inputs for the capacitance module, so you can use whichever input you want. R1 is 10 KOhms and R2 is 330 Ohms.
The Code (updated at 5/8/2011)
It happens... I totally forgot to upload the code, until someone asked me. Luckily i had the same code already uploaded for my keycode lock hack, in which i use this very same circuit. So:
I could not prototype this circuit on a breadboard, so, i had to make a PCB to test it. I usually do not upload PCBs because i do not know how to design an error-free PCB. But this time, i am pretty much sure that this PCB has no significant errors.
As you will notice, the PCB is double-sided. The top side has the pads and the grounding layer, and the bottom side has the PIC along with the connection pads. And as you are also about to notice, is that the pads for the PIC are SMD. BUT, it happens that i did not have this PIC in SMD package. So, i did something that i use to do, when i come across such situations. I bend the pins in such way that i can solder the DIL package as if it was SMD. It is not a very good technique, but it is simple and it works. After all, this is just a prototype to see if the PCB works. I will order some SMDs for future works.
This is the top side of the PCB
This is the bottom side of the PCB
The package of the PIC is DIL
I bended the pins to solder it as SMD
This is the PCB with the PIC soldered
I plan to cut or bend the unused pins...
The top side with the pads has also a grounding layer. For technical reasons i have this region filled with hatch pattern instead of being solid. A solid area will also work. Notice that at the bottom left corner, there is one hole. This hole connects the top and bottom grounding layers together with a wire. The hole is larger than actually needed, because i also used this hole to hold the PCB during etching.
At the bottom side i connected the ground pad to the grounding layer. This way, the top and bottom grounding layers are both connected with the ground of the power supply. Omitting the top grounding layer or leaving it unconnected (floating) will result in malfunction. The bottom grounding layer is not that important, but it is good to exist.
The supply ground is connected with the bottom side grounding layer
The top-side grounding layer is connected with he bottom side grounding layer via the bottom left hole
And here are the PAD I/Os
Insulating the touch-pads
I used thick tape to insulate and elevate the touch-pads. There are 3 reasons for this step: First, the idea of a touch keypad is that the touch-pad will be behind a cover with the buttons artwork. So, the pads must touch the artwork surface tightly, something that a double sided tape can do very good. Second, there must be a gap between the grounding layer and the artwork surface. The air has very small dielectric constant, and it will help to "separate" the touch buttons between each other, that is why the tape must be thick. And third, each touchpad on the top layer has a via to connect it with the bottom layer. This via has a thin layer of solder to hold the wire. So, the pads must be elevated a little bit otherwise they will not touch the artwork surface. Here is how i do it:
I use 1mm thick double-sided tape.
I cut rectangular pieces same size as the pads.
I did this for all 10 buttons.
Notice the gap between the PCB and a piece of wood
The next step is to remove the cover of the double-sided tape and stick the PCB on the artwork surface. I will do this when i finally decide what this artwork will be. In the meanwhile, i will test it as-is. The artwork that i will use has 2 layers. The first layer is a 4mm semi-transparent acrylic glass, and the second layer is a thin transparent film laser printout with the actual artwork printed on it:
And here is the artwork in gif format and original format
Hello, I'm Brazilian. and living in Brazil.
Their design and very interesting, is that you can send me your code.
I like to do something similar.
sorry I'm using an electronic translator.
my email is digitalgames@hotmail.com
@Ion this has gone even further now... steps above challenge... now it is pure curiosity... i'm very curious to see what those people in microchip have done wrong. The cap sense module works like charm
At 17 March 2012, 4:48:51 user Ion wrote: [reply @ Ion]
@Giorgos Lazaridis
It will be a big one. Before you start, visit this and you will find out by your self http://www.microchip.com/forums/f227.aspx
Also do a short Google on microchip pic18f mtouch projects
You will find out that they are thousands of pages about Pic18f, pages about mtouch - mostly emphasizing the feature, but curious ... no projects, or failed projects with peoples asking for help.
Good luck and let me know your achievements.
Keep in mind that any body can make it working, BUT the challenge is the sensing distance. Never saw one done yet.Everybody wants to have 2-3 mm plastic in top or touch buttons, the plastic cover of the box. Nobody did it yet.
@Ion i will try this for sure, since this has gone above the step of curiosity, it is rather a challenge. I hope i wont experience the same disappointment from microchip...
At 16 March 2012, 22:19:40 user Ion wrote: [reply @ Ion]
@Giorgos Lazaridis
Ctmu on Pic18F it is a big failure of Microchip
Even their development board does not works if the hand does not touch the pad
Microchip forum on CTMU it is full of complains and desperate peoples looking for solutions.
They are some smart guy which said, read the App. notes, but NOBODY proved a working reliable example.
Why do you believe Microchip released so many development software packages, but guess what, ONLY for pic16 and 24? 24 because has 12 bits A/D, and 16 for Cap sense.
If you want to be rich and famous, develop an application for 18F with CTMU. Hey 18F87J90 is what I use :)
Your site will be swamped by visitors to see it, a.k.a. tons of traffic and your You tube channel will go viral.
If you want to beat the challenge, try to do it, and believe me you will be famous.
Biggest problem that everybody complains is sensitivity. With yours I can keep the fingers 10 mm away and it will see it.
With 18F, you put 0.5 gap between finger and button and is gone.
Try it and you will see. Have fun and let me know if you can achieve something
Best regards
Ion
@Ion unfortunately i haven't tried the mtouch at all. i thought it was a good solution though. It is not working correct? hm...
At 15 March 2012, 17:37:17 user Ion wrote: [reply @ Ion]
@Giorgos Lazaridis Hello Giorgio,
did you have any luck to implement touch buttons with Pic18f series which have Mtouch module but not Cap sense like Pic16f ?
I am very interested to know, because on mu application i use a PIC18F87J90 for driving the LCD and real time clock and i do not have room to add a pic16F.
I build your examples for 4 and 10 buttons and works great, but for pic18f, following by book all the app notes, including the famous 1250, i just sens my finger when i touch or through thin piece of plastic. With 2 mm plastic it does not see it.
On microchip forum everybody complain about sensitivity, which is not the case on your example. I had to lower the sensitivity on your example because was too high
Please help if you have any piece of code or example
Thank you
@Ion since you have too many question, i opened a forum thread. Use this thread instead:
http://www.pcbheaven.com/forum/index.php/topic,1522.0.html
At 26 February 2012, 3:02:06 user Ion wrote: [reply @ Ion]
One more question.
I need in some conditions to press a combination of two buttons on the same time
It will work if i press two buttons ?
Lets, say i press I8 and I10 in the same time
What will be the result ?
If does not take two buttons in the same time, will be no problem because i can use an other one to represent the combination of the 2 PB simultaneous pressed
But will be nice to have the opportunity to press two buttons and get the combined result
@Rob Calala The chip that i use (PIC 16F1937) comes also in SMD. Check out here:
http://www.pcbheaven.com/projectpages/Tripple_PID_Temperature_Controller/
It is exactly the same chip, i just got them later. Yet this need programming too. You must find someone to upload the code to the chip after having it mounted on the board. You only need to give them the HEX file that i provide.
For other chips, i know that analog devices have some capacitance touch controllers but i have never use them.
First of all I do love your site.
I am working on designing a ON/Off Slider for various household automation control. Your design is exactly the same way I was going with mine, but alas I know nothing about software programing. So my system will be based on a PLC rather than a PC. The BCD output is exactly what I was looking for.
My question is if there is a SMT chip that would work based off of your code?
At 23 November 2011, 18:00:05 user pinozo wrote: [reply @ pinozo]
thanks, but I thought something simpler ...
unfortunately they are an amateur, I have the knowledge required for this type of changes ...
I successfully executed some of your wonderful projects, perhaps with minor changes, but this does not arrive.
if I can get some more help would be nice ..
@pinozo you will need to alter the schematic as well as the code a bit. Or you can connect a BCD to decimal decoder at the output, and then a D-ff on each of the 10 outputs.
At 21 November 2011, 19:08:11 user pinozo wrote: [reply @ pinozo]
sorry for my ignorance
is possible to turn on the switch button to turn on a relay at the touch of each key?
10 keys ... 10 relays
as in the project "PIC-Change Frequency Capacitance Touch Button," but with 10 or more switches on off
At 20 October 2011, 20:50:42 user ron wrote: [reply @ ron]
Thank You! Artwork_1 is beautiful.
Ron
At 20 October 2011, 11:18:57 user ron wrote: [reply @ ron]
OK, that would be appreciated. Dimensions help! To get the PCD I used
Xnview and kept printing until I got the 40 pin dimension correct so in imperial the board is 4.69 by 3.78 inches, lol
@ron Oh i see! This artwork :D. Ok, i was not going to upload it, because i supposed that people should make it better by themselves. But you are right: You may wanna design it yourself, but it will be better if you have the original artwork with the dimensions. So i will uploaded right now.
As for the forum, you can start posting your work in the "Your projects" section.
At 19 October 2011, 17:18:35 user ron wrote: [reply @ ron]
I am writing this under the "10 Buttons PIC Touch-Pad with BCD Output" comments section. Immediately above this is a picture of your hand holding the artwork... which you said you would post, "when you were ready"
There is nothing wrong with the forums, just so many headings and none said anything about replications of the touch pad. I could post a picture of my start if I knew where it belonged
hello can you help me?
I need to do a project that will utilizes the peripheral mtouch.
I'm going on my project utilizes the pic 16f727.
I need to send via the serial port of the PIC, the states of buttons (touch m). I'll utilizes two models of microcontrollers, a pic 16f727, this will take care of keys and serial communication to send the condition of the keys.
I'll utilizing the pic, 16f876A, this will get your serial port on the conditions in which they are the keys, either open or closed sent through, pic 16f727.
for serial communication between the two pics, I'll start using Zigbee.
you can help me develop this code?
@Rafael Marquez Plascencia Damn, how did i forgot to upload the code! I upload it right away. You can also find the code for this here:
http://pcbheaven.com/projectpages/Servo_Actuated_Door_Keylock_Hack/?p=7&topic=worklog
well the reason of this is ask to you, can you help me?
im on the unaversity and im doing a similar proyec but i need 24 touch pads i think ill meke it on a matrix eny way.
im new on this tecnology can you show me your code? asm or c?
@Amos correct, it is encoded as decimal 10 (binary "1010"
At 17 June 2011, 22:41:17 user Amos wrote: [reply @ Amos]
Excellent project and demo! One question, though: since the steady-state output seems to be zero, how is the zero button encoded? It's never pressed in the video... I'm assuming it's 1010b (10).
@pcb something wrong happens with IE when trying to read large gif files. If you try it with firefox it works perfectly fine. I will upload a zip version for windows users hopefully within coming week.
At 17 June 2011, 14:47:18 user pcb wrote: [reply @ pcb]
top and bottom pcb links dont appear to work for me