Cap Sense Module Prototype, feedback wanted :) - Page 1
Forum section: electronics / general

author: benjones
author_rank: Contributor
timestamp: January 16, 2014, 03:07:31 am
content: I'm working on making an open source capacitive sensing module. I am still prototyping it and I think I'm at the point that I want to send it off to OSH Park for a couple test boards, but before I do I want some feedback. This is the first time I've designed something in eagle that I wanted fabricated and I'm sure I've made some mistakes. I'd love to know what I'm doing wrong before I get it manufacturedHere's a little info about the moduleThe module uses an attiny84 which uses 2.2m ohm resistors and the Capacitive Sensing Library to detect touchhttp://playground.arduino.cc//Main/CapacitiveSensor?from=Main.CapSenseThe screw terminals on the right are the cap sense inputs, which you can connect to any conductor to sense capacitanceThe screw terminals on the bottom left are the digital outputs which are turned on when the corresponding input is touched. The outputs can be hooked up to an arduino or to some relays or mosfets.The screw terminals on the top left are GND and 5V. I have two 5V and GNDs and large traces between them so these modules could be daisy chained.There is a 10k trimpot that adjusts the sensitivity threshold.There is an on board LED that lights up when any of the inputs are touched. Useful for debugging and calibrating the sensitivity.There is a reset button which recalibrates the cap sense and zeros out the inputsThere are a couple of capacitors to smooth out the powerThere are two mounting holes for mounting the board inside an enclosure.The board is roughly 35mm x 40mmAnd there is a ICSP to program the attinyThat's pretty much it. Let me know what you thinkThanks!-Ben

author: taemun
author_rank: Regular Contributor
timestamp: January 19, 2014, 03:46:37 am
content: I'm not sure if this is the appropriate forum for the question.Probably an idea to provide the schematics as well.In no particular order:How much space have you left around your mounting holes? For M3 screws, you'd typically want to leave ~6mm as a bare minimum.Ditto the ICSP header to the screw spacing.Your vias are square. This is really weird (they are usually circular).Your sensitivity adjust pot can completely short out the input volts. Add another resistor somewhere.Your connectors aren't symmetrical about the edge of the board (right one is closer to edge than left).The resistor value, and designator text ill probably be extremely small, and probably unprintable.Whats the component on PB3/dW/pin 4?

author: senso
author_rank: Frequent Contributor
timestamp: January 20, 2014, 12:02:33 am
content: It seems to be a smd tactile switch.

author: benjones
author_rank: Contributor
timestamp: January 21, 2014, 04:45:01 am
content: Thanks for the input taemunSorry if I posted this in the wrong section. Where would be a more appropriate place to post this? I've been subscribed to the YouTube channel for a while but I'm new to the eevblog forum.Since I posted this, I've been working on condensing the PCB. I'll attach an updated version of the board. The new design is 30.5mm x 30.8mm. I switched the screw terminals to be 3.5mm pitch. I also switched the VCC/GND positions on the top screw terminalOn the new board there is 3mm of space around the mounting hole on the bottom. Is it a general rule of thumb for 6mm of space to the nearest component? or is it 6mm of space to the nearest trace? I have an LCD from adafruit and there isn't much space around the mounting holes. is this a bad design?http://www.adafruit.com/products/181I understand the space around the mounting holes but why would you have so much space around the ICSP?I'll switch the vias to be circles. Eagle made them square by default.Thanks I added a resistor before the trim pot so it doesn't short out the board. I threw in a 1k. What resistance would you recommend?The component on Pin 4 is an smd tactile switch.Thanks for the great feedback-Ben

author: taemun
author_rank: Regular Contributor
timestamp: January 21, 2014, 07:45:47 am
content: I'm not a long-time forumer over here, not sure about the section. No one has moved it, so it's probably fine3.5mm pitch is still pretty usable, so a good choice.3mm radius empty around the middle of the screwhole is good, 3.5mm is better. Freedom from components is essential, traces are fine unless you screw in super hard and break the soldermask (it happens). For a low qty board like this, it probably won't matter. Also, everything here is super low voltage, so the penalty for failure is fairly low.The Adafruit LCD is a random design from China,Ruite Electronicspecifically. I wouldn't be surprised if the design isn't greatKeep in mind that they are 2.8mm holes, made for an M2.5 screw, which will have a smaller head (as will the standoffs).M3 hex standoffs come in a couple of varieties: SW5.5 and SW6. The latter is 6mm between *flats*, not 6mm diameter. I've attached an image showing this. Please excuse the very poor dimensioning tools in Altium.Ignore the comment about the ICSP, it looks ok now.Square vias: Eagle is weird.Doesn't really matter what the value is, as long as you know how to scale the output - you won't be able to get all the way to 5V anymore.Is the input bulk cap aTH ceramicor anAlElectrolytic?Your SM decoupling cap (?C1) should be right at the pins for the micro, not an inch and a couple vias away. (Yes, either would probably work fine in this application, but it's a good practice to get into!)If you rotated your tactile it'd route better.You could get rid of half of the bottom side traces with a few changes. You'd then be able to slap down a ground plane on the bottom side, which'd be better.ICSP p1 could be routed around the back of the one to its right, and then the 5V line could go straight down.If you have a ground plane, then instead of routing ground you just pop down a via, which gets rid of the GND routing problem you presently have.What's with the weird kink in the trace from P1 of the bottom left header?

author: Rerouter
author_rank: Super Contributor
timestamp: January 21, 2014, 08:18:28 am
content: Just a freindly reminded that with SMD, the parts live on the opposite side to through-hole parts in general so you can turn off the silkscreen for those parts while routing to work out how close your willing to squeeze (could possibly rotate power connectors along top)The previous posters comment was about how close the ICSP header was to the screw hole, it doesn't need any larger gap than the silkscreen size if you really want to push it (I've pushed an audio circuit to 25x25 before by double loading, it was interesting)as far as possible suggestions,-The led and dropping resistor can be moved to the lower right of the ICSP header (will actually end up more visible)- Route pin 1 of the ICSP header between pins 4 and 5 this will let you remove 1 via, (my head is even thinking about if rotating it clockwise would clean things up)- Rotate R3 180 degrees and join the ground points, Same for R2,- Route the small trace under the trim pot through it and remove both vias,- Hop the 100uF cap across the center trace of your trim pot and sit it right on top of the micros power pins,- With the ground trace now on the bottom to the micro, run the 5V trace on the top layer from the plug and run it directly to the capacitor,- By moving up the Capsense plug to close to center you could completely remove the vias stitching together the resistors, alternativly just route between the pins if you like it symmetrical- I'm not seeing any external liftup to 5V on your reset line? equally i think it looks messy, but am struggling on how to clean it up without moving around the ICSP

author: benjones
author_rank: Contributor
timestamp: January 22, 2014, 04:21:10 am
content: Thanks for the info and picture on mounting holes taemun. I rotated the ICSP and moved the led and resistor and now have plenty of space around the mountsAll the vias are circles now, also I was able to remove lots of them!I can scale the output of the trim pot in software, no problemDo you think I should switch it to a lower value than 1k?The 100uF cap is an aluminum electrolytic, this is the one I'm using at the moment:http://www.digikey.com/product-detail/en/ESK107M010AC3AA/399-6600-ND/3083015I moved the capacitors to be closer to the attiny, does it matter that the trim pot isn't having it's power filtered by the capacitors? Should the trim pot be powered through the 100uF cap and just keep the .1uF for the attiny?I feel like if I rotate the switch it will force me to make the PCB larger. I'd like to keep the PCB size down if I can so I can fit more in a panel.I found a smaller button and was able to squeeze it between the output traces.This is the one I found, it's 4.2mm x 3.2mm:http://www.digikey.com/product-detail/en/PTS810%20SJM%20250%20SMTR%20LFS/CKN10502CT-ND/4176673I got rid of 12 vias since the last design and it is looking much cleaner. However I do have traces on the right that are close to the edge. Is it bad to put traces near the edge of your board?I've heard that ground planes are a good thing to have, especially if you have analog components. I'll look into how to set one up in Eagle.Thanks for the reminder Rerouter. It is definitely something to remember when you are working with both SMD and through hole components.moved the LED and rotated ICSP, good call, much more visible and more spacererouted the trim pot and capacitors to reduce the number of vias like you suggested.I do like the symmetry of the screw terminals, I think it gives a better user experience and understanding of the module. I looped the traces around and removed the 4 vias stitching it together.I've read that the attiny84 has an internal pull up resistor on the reset pin and that an external one is not necessary. I've read in some forums that some people do put them on, but it's really only an issue if your power supply is noisy, which having the 100uF and .1uf caps should help with.I am trying to keep the orientation of the SMD components the same for faster assembly. I have a Shapeoko CNC that I am turning into a pick and place machine and if I don't have to rotate the components then it's less work for me to hand assemble the boards. That is also why I am using larger components (0805's) since they will be a little more forgiving.Thank you so much, I really appreciate the critique, it will make me a better designer-Ben

author: Rerouter
author_rank: Super Contributor
timestamp: January 22, 2014, 07:58:36 am
content: Now just one more (one of the ones i already covered, but to clarify) then i'll be happy (a truly remarkable feat)Route the ground to the capacitor on the blue side, then from the capacitor route the ground on the red side to the potentiometer,Route 5V straight to the Capacitor on the Red side, you can either branch off to the pot or run its own separate trace back on the red side,- rotate R2 180 degrees to join the common with R3 (it never ends!)- Rotate Capsense silkscreen to match rotation of output(my stubborn head now sees another shift you can play around with for shrinking it.. Tidy up your output traces and shift the reset switch furthur down, {its on the smd side remeber} you could then rotate the power capacitor and sensitivity pot to the right on the top side and this and put the power connecotrs facing the top side with some playing around you could probably even get them to sit nicely in the middle next to one another,)edit: its only dangerous to route a trace on the edge, that large a gap it more than safe enough,- To top it all off, you can reduce the gap for those 2 jumped tracks and put a ground plane on the blue side,

author: benjones
author_rank: Contributor
timestamp: January 23, 2014, 01:50:57 am
content: Thanks Rerouter!I cleaned up the traces to the capacitors and the trim potGood idea about R2, I flipped it around and connected the traces togetherI kind of like having the power and ground on the same side as the outputs. You would need a ground connection for the outputs anyway.I re-positioned the tactile switch and cleaned up the output traces and was about to shrink the board down to be slightly smaller. It's 28mm x 30mm nowI added the ground plane to the bottom layer. It's a little harder to see what going on because of it. I guess I don't really understand advantages to using a ground plane, but I have heard they are good to have in your designs.I feel really good with how the PCB has turned out. It has come a long way since the first post.Is there anything else that you think could make it better? Are you happy yet? hahaThanks-BenEdit:I just uploaded the gerber files to oshpark to see how it would look for real, and it looks damn good if I do say so myself haha. I'm attaching the images below so you can see tooThanks guys!-Ben

author: senso
author_rank: Frequent Contributor
timestamp: January 23, 2014, 02:37:05 am
content: Remove the fat trace connecting the two ground points of your 3.5mm header and enable the thermals in the ground plane properties, it will make soldering easier.

author: taemun
author_rank: Regular Contributor
timestamp: January 23, 2014, 02:45:57 am
content: You have a ground plane: use it as such.Don't run ground tracks on top; everywhere you need ground, sink a via.Why does one side of the switch go so far on the top side before the via?Your bottom left screw looks like its going to foul on the 3.5mm headers, and also the ICSP header.It probably isn't good design practice, but I'd guess that both sides of that switch are connected internally (top/bottom) so you could rotate the switch 180, move it down a bit and use that as a jumper across the two bottom 'Output' traces. That'd save you a bottom side trace.Looking better each time

author: Rerouter
author_rank: Super Contributor
timestamp: January 23, 2014, 03:08:47 am
content: And finally i see a way to remove all bottom side traces (i think i am addicted to giving feedback)This will require shifting and routing the ICSP header differently,Route pin 7 of the AATiny out to the left and then back in between pins 1 and 4 of the ICSP header,This trace and the 2 lower outputs can now be jumped with the body of the button (route them through) but route pin 7's out between the bottom pins of the switch (you can now pick up ground here)Now you can route the reset through the center and out the bottom of the ATTiny to connect to the bottom, and out the top to connect at the top (redundancy)Then if your careful you can route the 5V trace of the ICSP through 4 and 5, and right to its pin skirting next to the pin 7 trace, this would then leave the remaining via clear to connect,* Runs out of range before I'm dragged back *

author: benjones
author_rank: Contributor
timestamp: January 23, 2014, 07:29:18 pm
content: Thanks for the tip senso!I removed the fat trace connecting the GND screw terminals and the thermals were fixed, ThanksI moved the fat trace connecting 5V to the top too, I figured it might help with the soldering as well.Thanks again taemun for the heads up about the mounting bottom hole, I shifted things a bit and made a decent amount of space around it.Ok I think I'm starting to get a better grasp of the usefulness of the ground plane. I pretty much don't have to worry about routing GND traces anymoreGood idea about using the button as a jumperHoly crap Rerouter! hahaI made the changes and there are no more traces on the bottom, except for the ground planeI printed out the design on a piece of paper to scale and positioned my components on the paper. I realized that I had the wrong spacing between the two screw terminals on the left and was able to shrink the height of the pcb a few mm.I also noticed that the name and values of the text weren't showing up when I printed it so I moved the labeling to the bottom silkscreen and kept the names and values on the top.Is there anything else that could be improved? hahaShould I submit an order to OSH Park now? It's pretty inexpensive for 3 copies of the PCB.Thanks for all the help-Ben

author: imjosh
author_rank: Contributor
timestamp: January 25, 2014, 03:32:00 am
content: Read this:http://www.atmel.com/Images/Atmel-42094-QTouch-Schematic-and-Layout-Checklist_Application-Note_AT02259.pdfand this:http://www.atmel.com/images/an-kd02_103-touch_secrets.pdfYou should at least look at removing the ground plane from behind the sensor traces.And then, seriously consider ditching the Attiny and replacing it with this:http://www.digikey.com/product-detail/en/AT42QT1070-SSU%20QS529/AT42QT1070-SSU%20QS529CT-ND/2637953I tried using the arduino touch library too, even the ADC version (which works better) and after much pain and suffering I realized it really doesn't work reliably enough at all. I switched to a qtouch component and it works so much better.OTOH, if your application allows for direct skin on exposed metal contact, you can probably get away with your design no problem. The application notes are still a good read either way.cheers

author: nctnico
author_rank: Super Contributor
timestamp: January 25, 2014, 08:49:54 am
content: I doubt this circuit will ever work. Capsense is intended for use with PCB pads. The size of the pads versus thickness & dielectric constant of the front panel and routing are critical. Cypress has several neat chips that do all the heavy lifting.

author: benjones
author_rank: Contributor
timestamp: January 25, 2014, 07:01:17 pm
content: Thanks for the info about QTouch. I checked it out and it's pretty cool, but I'm not trying to use capsense as buttons on the PCB. The reason there are screw terminals for the cap sense input is for connecting wires to conductors. The people who would most likely use the module would be museums, aquariums, artists, makers, hackers, etc.I've tested using the capsense library on a breadboard using an arduino and it works really well, I'll attach a few pictures to show how I'm using it.There is an alligator clip hooked up to the arduino and a pair of tweezers. When I touch the tweezers it turns on an LED.I kind of like using the attiny and having an ICSP because it allows for some flexibility, like if you wanted to make the cap sense input toggle the output or make the outputs high and then use capsense to make it low.I'll remove the ground plane under the cap sense input thoughThanks!-Ben

author: benjones
author_rank: Contributor
timestamp: January 27, 2014, 03:26:18 am
content: I removed the ground plane under the cap sense inputs and I nudged some of the components so they weren't as close together, which should make assembly easier

author: benjones
author_rank: Contributor
timestamp: January 29, 2014, 02:56:03 am
content: So I was playing around with my breadboard version of CapTouch and hooked it up to this relay module:http://www.amazon.com/gp/product/B0057OC5WK/ref=oh_details_o01_s00_i00?ie=UTF8&psc=1I realized that screw terminals might not be the way some people want to wire up their modules, so I added female headers in addition to the screw terminals to the design. The female headers could also be swapped out for male headers, I'll leave it up the user to decide.I also added a Schottky diode to protect against reverse polarity. The attiny can run on 1.8 volts, so the voltage drop should be fine.This is the diode I'm using:http://www.digikey.com/product-detail/en/CDBA120-G/641-1014-1-ND/1121136I had to increase the size of the board a little bit, it's now 36.5 x 29mm.I printed out the design on paper and "assembled" the board. (the terminals and headers are upside down so they would stay on the board)I'm going to be receiving my first iteration of the CapTouch module in a few days and I'll send out the latest iteration not long after. Any feedback is appreciatedThanks!-Ben

author: benjones
author_rank: Contributor
timestamp: January 31, 2014, 02:44:14 pm
content: I received version 1.0 of my boards in the mail yesterday. I assembled one and uploaded the arduino blink sketch and my test LED was blinkingI uploaded my the code for the CapTouch module and it sort of works. I didn't take into account that the attiny84 can only run at 8mhz (without a crystal) so it can't really handle the 2.2M ohm resistors. I chose the 2.2M ohm resistors because they worked well on my breadboard version using an Arduino Uno.When I touch one of the cap sense inputs on the module the attiny pretty much freezes, until I stop touching the input at which point the test LED lights up for a moment.I am going to try to desolder one of the resistors and test again with a 100k resistor.I am excited that the module is workingthis is my first PCB I have designed and I am so thankful for all of your help in refining the design. I am going to make some slight changes to the silkscreen today and send out the current version to be fabbed.Thanks!-Ben

author: taemun
author_rank: Regular Contributor
timestamp: January 31, 2014, 02:47:39 pm
content: Utterly jealous of the response time from OSH for local orders.Board looks good!

author: benjones
author_rank: Contributor
timestamp: February 04, 2014, 02:45:06 am
content: Thanks Taemun!I made some more changes to the design based on feedback from some coworkers. I switched back to the larger 5mm pitch screw terminals since they are easier to work with and I also kept female headers.I switched the 100uf cap to an smd which should make assembly easier.I decided to add some artwork to the bottom of the board. I added it to the bstop layer so the copper will be exposed.unfortunately I had to increase the size of the board, it's now 43 x 40mmI also discovered that captouch is a trademark of analog devices, so I renamed it to CapModuleI just put in another order through OSH Park for 3 of this version(1.7). They are awesome! Amazing quality, price, and turn around-Ben

author: Lupin
author_rank: Newbie
timestamp: June 22, 2014, 05:59:35 am
content: You will notice that your circuit will depend on a ground connection. It won't ever work stable (without a ground connection), that's for sure.I also played around with capacitive sensing and ended up with the atmel Qtouch approach implemented on a Tiny25.Here you can find my latest project files, it's german but the project files are at the end of the topic and code comments are in english:http://www.mikrocontroller.net/topic/292184Works reliable through ~1,5mm thick glass. It wasn't quite easy to get it working stable.When the circuit heats up the measured value will change and after a while it would detect a touch event.For this reason i added a low pass filter to compensate changes in temperature etc. and get an average value over a long time period.To detect a touch event only the difference of the current measurement in relation to the average value / low pass filtered value needs to be taken into consideration.You could also use two low pass filters. One with a low cut-off frequency for the long-term average value and another one with a higher cut-off frequency that will allow to detect real touch events but filter out unwanted spikes / measurement errors.Make sure you test your circuit without ground connection, because if it works reliable without ground connection, then it will also work reliable with a ground connection.It would be interesting to have an opto isolated interface to the circuit for debugging, so that you can take measurements / output some data without accidently making a ground connection.

author: benjones
author_rank: Contributor
timestamp: June 23, 2014, 12:28:38 am
content: Hi Lupin,Thanks for your feedback. And I have noticed that it is unstable without an earth ground connection. To get around the issue I made a grounding plug out of a small piece of brass rod with a wire soldered to it. The rod plugs into the earth ground in a power outlet. However I would like to make this a little more stable and without the extra wiring.I've been looking into switching over to Qtouch as well. I'm looking at switching to a MPR121QR2 connected to an attiny2313 over I2C.http://www.digikey.com/product-detail/en/MPR121QR2/MPR121QR2TR-ND/2186527Then use a attiny2313 to turn the outputs on and off. The attiny2313 is nice because you don't need an external crystal and it has lots of IO pins. All the pins are digital, but I'm not going to be using any analog inputs so it should be fine.http://www.mouser.com/ProductDetail/Atmel/ATTINY2313A-SU/?qs=sGAEpiMZZMvqv2n3s2xjsRLJ5ROJ0gc0dZSXrqbzGMo%3dThanks for the tips about heat altering the performance. I'll keep an eye on it and try playing with low pass filters if I have any issuesI'm very grateful for all the help I've gotten on this forum, I've been learning a ton!Thanks!

author: LukeW
author_rank: Frequent Contributor
timestamp: June 27, 2014, 05:40:31 am
content: I think there is potentially some value in using the CapSense library on a AVR if you're using the microcontroller to do other stuff in your system anyway, but for what you're doing which is a dedicated front-end module with a fixed function of converting touch sensing into digital outputs I wouldn't bother with a microcontroller at all, just use Atmel's dedicated AT42QT1010 etc. or other capacitive sensing chips from that Quantum/QProx family.Suppose I went to buy this AT42QT1010 basic development board/module from Sparkfun:https://www.sparkfun.com/products/12041How would your board offer superior value or performance to differentiate it?

author: benjones
author_rank: Contributor
timestamp: June 27, 2014, 08:21:48 pm
content: Where i see this board being useful is for when you have multiple capacitive sensing inputs and want multiple outputs, also the ability to switch the outputs to be toggled on/off or momentary on/off. I'm designing this board as something useful for museums, artists, or makers. The screw terminals make it more rugged for installations and a 5v output makes it easy to hook up to a relay module like this one:http://www.sainsmart.com/arduino-compatibles-1/relay/8-channel-dc-5v-relay-module-for-arduino-pic-arm-dsp-avr-msp430-ttl-logic.htmlSparkfun has two capacitive sensing boards, the AT42QT1010 and the MPR121, both are great boards, but the AT42QT1010 only has one input/output and the MPR121 needs to connect to something over I2C to be used. You could get by just fine with a MPR121 and an Arduino but I want to make a more dedicated solution.I could make an array of AT42QT1010's but you can get more IO pins with a MPR121 and an attiny2313 with fewer parts and at a lower cost.