nomech mini - A 4x4 capacitive touch button grid

A place to document your own projects.

nomech mini - A 4x4 capacitive touch button grid

Postby kasbah » Mon Jun 10, 2013 2:09 pm

Image
Image

So this is a 4x4 projected capactive touch board using Atmega32u4 and back-fire LEDs for each button. I want to send the gerbers to Seeed sooon so any advice/feedback is very much appreciated.

It fits SoB 100x80mm but the top acrylic will sit right on top of the PCB as the dielectric properties of whatever is touching the electrodes matters a lot.

If this works well then I might scale it up to 8x8. I want it to work as a cheap monome replacement without using mechanical buttons; hence the name "nomech".

This is designed using KiCAD.


Everything is licensed CC-BY-SA-3.0

Image
Last edited by kasbah on Fri Jul 12, 2013 10:59 am, edited 4 times in total.
kasbah
Newbie
Newbie
 
Posts: 23
Joined: Fri Dec 14, 2012 1:41 am

Re: nomech mini - A 4x4 capacitive touch button grid

Postby Bertho » Mon Jun 10, 2013 3:57 pm

Nice project.

The buttons are very close. You may have some problems with adjacency with the buttons and misaligned touches, even though you have guard-rings. Especially with people that have large fingertips. Something you will need to test with different dielectrics and thickness.

If you want to replace mechanical buttons, then you have to be very careful about response-time, which is very important with the monome. Capacitive touch sensors are not the fastest interactions if you care about stability. Also, the use of USB can inject line-noise and that can make life very difficult.

With all that said, I'd really want to hear your experience while developing this project as it may be a universal usable keyboard for many other uses as well.
User avatar
Bertho
Sr. Member
Sr. Member
 
Posts: 293
Joined: Mon Sep 19, 2011 4:34 pm
Location: Somewhere in the vicinity of Betelgeuse

Re: nomech mini - A 4x4 capacitive touch button grid

Postby kasbah » Mon Jun 10, 2013 4:18 pm

Thanks Bertho!

The buttons are very close. You may have some problems with adjacency with the buttons and misaligned touches, even though you have guard-rings. Especially with people that have large fingertips. Something you will need to test with different dielectrics and thickness.


I will have to test with some fat-fingered people :D
Those are actually not guard-rings but the driving electrodes. What I am trying is very similar to this project by Viacheslav Slavinsky and he has some code I can copy/learn from.

If you want to replace mechanical buttons, then you have to be very careful about response-time, which is very important with the monome. Capacitive touch sensors are not the fastest interactions if you care about stability. Also, the use of USB can inject line-noise and that can make life very difficult.


Yeah, I guess one of my main worries is that the MCU won't be beefy enough for all the DSP that needs to be done. If I have trouble with line noise then that's another matter.

I will post my results either way though.
kasbah
Newbie
Newbie
 
Posts: 23
Joined: Fri Dec 14, 2012 1:41 am

Re: nomech mini - A 4x4 capacitive touch button grid

Postby matseng » Wed Jun 12, 2013 6:48 am

Yea, definitely an interesting project. I've been wanting to do something with the capacitive touch sensors that are builtin in the modern pic/avr microcontrollers for a while now...

I read that having leds under the touch sensors can be problematic as well since the readings differ depending if the led is on or not.

Anyhow, keep us posted.
User avatar
matseng
Hero Member
Hero Member
 
Posts: 876
Joined: Sat Oct 15, 2011 12:29 pm
Location: Kuala Lumpur, Malaysia

Re: nomech mini - A 4x4 capacitive touch button grid

Postby kasbah » Wed Jun 12, 2013 6:56 am

It's not really builtin. Logic pins are doing the driving and ADCs are the analog comparator (AC) is doing the sensing. That you can use an ADC AC pin as a logic pin is essential for this design and the ADC sampling capacitor is useful for single-electrode designs as you don't need any additional components.

Yeah, the LEDs might be a problem. I have followed Atmel's recommendations but we shall see. That's why I am not going for 8x8 right away.

EDIT: Corrections after realizing the ADC is not involved in this design.
Last edited by kasbah on Mon Aug 26, 2013 5:50 pm, edited 2 times in total.
kasbah
Newbie
Newbie
 
Posts: 23
Joined: Fri Dec 14, 2012 1:41 am

Re: nomech mini - A 4x4 capacitive touch button grid

Postby Alex555 » Wed Jun 12, 2013 3:13 pm

If the LEDs do affect the keys, would it be possible to compensate?
Alex555
Full Member
Full Member
 
Posts: 107
Joined: Mon Oct 22, 2012 10:45 pm
Location: USA

Re: nomech mini - A 4x4 capacitive touch button grid

Postby kasbah » Wed Jun 12, 2013 3:26 pm

If the LEDs do affect the keys, would it be possible to compensate?


Maybe, I am havn't spent enough time looking at what the analog readings should look like. It will be easier to do when I have the boards anyway.

I have sent off the gerbers after stitching the ground plane a bit more, removing an unconnnected track and making some of the outside text invisble. I will update the main post from v0.1-alpha to v0.1 and then post some pics when I get the boards.

I ordered 5x PCBS in white and 5 SoB-DP10080 acrylic plates as well (makes two and a half cases). Anyone interested in a PCB?
kasbah
Newbie
Newbie
 
Posts: 23
Joined: Fri Dec 14, 2012 1:41 am

Re: nomech mini - A 4x4 capacitive touch button grid

Postby kasbah » Thu Jun 13, 2013 8:05 am

A few hours after sending of the gerbers I realised a stupid mistake. If the top acrylic is going to sit right on top of the PCB then I should have used an SMT ISP header (on the component side). I contacted Seeed but it was too late as it's gone into production.

I have thought about a few solutions:

  1. Hack up an ISP connector/jig that is semi-permanent and doesn't require soldering to the board
  2. Do a really temp connection to the ISP and just get a bootloader on it ASAP (but connecting a button force-load it will be a problem too)
  3. Try and solder a header on the component side only
  4. Cut/engrave the top acrylic to make room for header legs

I like one and two the best as they have no effect on the look of the device. Two might be the least amount of work if I come up with a clever way to load the bootloader. How does Arduino trigger the bootloader from their IDE? Is it routine in the main program that's automatically included?
kasbah
Newbie
Newbie
 
Posts: 23
Joined: Fri Dec 14, 2012 1:41 am

Re: nomech mini - A 4x4 capacitive touch button grid

Postby Bertho » Thu Jun 13, 2013 8:25 am

You can solder the header on the component/solder side without it protruding to the other side. Alternatively, just put some wires on the side that does not get covered.

Prototypes are prototypes. There are always things that need to be changed. With capacitive sensing, you may need several versions before you have the (semi-)optimal setup. I do not think that I've made one single board in my life that was exactly right the first time. There are always some details that pop up later on.
User avatar
Bertho
Sr. Member
Sr. Member
 
Posts: 293
Joined: Mon Sep 19, 2011 4:34 pm
Location: Somewhere in the vicinity of Betelgeuse

Re: nomech mini - A 4x4 capacitive touch button grid

Postby kasbah » Fri Jul 12, 2013 12:17 pm

So I got the PCBs last week. I got 12 total even tough I had only ordered 5. Likely because they ran a white panel just for me. Thanks Seeed!

I scrambled to order the parts and ordered some wrong LEDs. I decided to solder one up without LEDs and just the bare minimum to get cap sensing done and sent over USB. I ended up soldering the ISP-header on the component side as suggested and I am keeping that side open for the time being as I like to poke around the board with a scope.

Image
Image

One of the first things I noticed before soldering was that I failed to take the routing bit size into account when drawing the cut-outs for the LEDs. They will still fit the LEDs fine but they don't look very nice.

Image

So after some wrangling with the code I got the charging and discharging of the sampling capacitor working.
CH1 is the slope pin which is used for discharging the sample capacitor (and then measuring the time it takes to discharge ).

These are the pulses on the drive side.

Image

This is what the bottom of the sampling capacitor looks like. You can see it charge up and then discharge when the slope pin goes high.

Image

Eventually I got the AVR interrupts to work and could actually measure the time to zero crossing. I took some measurements which I can use as a baseline as I add components and change the code.

Image
See this IPython notebook for details.

But there you have it. It is sensing touch so I am pretty chuffed! I am yet to discover how robust it is.

EDIT: Code is up on github too: https://github.com/kasbah/nomech_mini-code
kasbah
Newbie
Newbie
 
Posts: 23
Joined: Fri Dec 14, 2012 1:41 am

Re: nomech mini - A 4x4 capacitive touch button grid

Postby metRo_ » Thu Jul 18, 2013 8:40 am

hi,
It looks great :)

I understand the yellow line, it is the capacitor discharging and charging. But I don't understand the blue line :s
metRo_
Newbie
Newbie
 
Posts: 26
Joined: Thu Apr 01, 2010 9:00 pm

Re: nomech mini - A 4x4 capacitive touch button grid

Postby kasbah » Sat Jul 27, 2013 5:14 am

The yellow line is actually the slope which causes the capacitor to discharge. The blue line in the first screenshot is the charge pump which is on the bigger electrodes.

The blue line in the second screenshot is the bottom of one of the capacitor accumulating a negative voltage and then discharging when the slope goes high. When it is discharging, the time taken to reach 0V is what is measured to see if that electrode has a finger on top of it.

You can read a better explanation of how this all works on svo's project page.
kasbah
Newbie
Newbie
 
Posts: 23
Joined: Fri Dec 14, 2012 1:41 am

Re: nomech mini - A 4x4 capacitive touch button grid

Postby kasbah » Wed Aug 21, 2013 10:34 am

I have been recording the behavior of this board, still using only one electrode. One thing I noticed right away are some pretty predictable spike(s) when you start reading the serial data, within 200 samples/lines. In these graphs below the blue is the first reading, and the green is a subsequent reading after opening and closing the serial interface programmatically. The y-axis is the charge reading which is reduced if a touch were to occur. The higher it is the more charge there is. So these spikes in charge will occur if I manually stop and close and re-open the serial interface but not if I do it programmatically. Pretty strange. See this IPython notebook for details.

Image

I even tried two different programs to read the serial data.

Then I took some long term stability readings which showed a surprising variance in the untouched charge reading when left to run for several hours.

Image

So I am not sure what to make of that. The read value varies by a larger extent on it's own that it does when it is touched, i.e. the noise actually exceeds the signal. Of course this is over several hours so the next step is to figure out the maximum frequency of these changes and basically high-pass filter the input before trying to detect a touch.
kasbah
Newbie
Newbie
 
Posts: 23
Joined: Fri Dec 14, 2012 1:41 am

Re: nomech mini - A 4x4 capacitive touch button grid

Postby Bertho » Wed Aug 21, 2013 11:31 am

The spikes in the measurements look like feed-forward noise. The opening/closing of the port may depend on the USB bus state and the OS you are running (start/stop a program involves a lot more work than programmatic open/close) . The activity changes the bus voltage and may feed into the rest of the circuit. I think you, at least, need to add ferrite beads to the power input. You may also need to dampen the entire cable with a (larger) ferrite bead.

Secondly, you need to have a very close look at the power plane layout and decoupling setup/routing. A good power design is paramount to noise immunity.

The long time drift can be caused by many things. The majority can be separated into environmental and electrical. The environmental parameters influence your circuit without physical contact and are mainly related to moisture and local EM-fields (mainly 50/60Hz noise). The electrical parameters are PSU stability and noise injection.

You can distinguish between the two by electrically isolating your test-setup. No computer or (mains) PSU connections allowed. You need optical interfaces and a (very low ESR) battery. The result is an indication of the environment. From that you often can deduce which electrical parameters influence your system.

Environmental fluctuations are normally calibrated out in software by the sample-CPU by readjusting the base-line measurements continuously.

Note 1: it may also help to turn the power-plug 180 degrees at your outlet. This is no joke. The effect of exchanging phase/zero of your mains has influence on how noise propagates and how it couples in/to the environment.

Note 2: If you take power from USB and use it directly, you have lost by default. The USB voltage is very unstable and variations from 4.5V..5.2V is no exception. The supply needs to be stabilized before you can do anything sensible with it in sensitive electronics.
User avatar
Bertho
Sr. Member
Sr. Member
 
Posts: 293
Joined: Mon Sep 19, 2011 4:34 pm
Location: Somewhere in the vicinity of Betelgeuse

Re: nomech mini - A 4x4 capacitive touch button grid

Postby kasbah » Wed Aug 21, 2013 12:13 pm

Wow, thanks for your input Bertho. A lot of stuff to think about there.

I have previously done a USB bus-powered device design with a much higher budget. There I raised the voltage to 6V with a switching regulator and dropped it back down to 5V with a linear regulator. Additionally I added a lot of EMC filtering following the advice of our consultants.

For this design I wanted to keep it as bare-bones as possible; see how far I can take it. That said, I think I will experiment with adding a linear regulator and just using 3v3 throughout.

Environmental fluctuations are normally calibrated out in software by the sample-CPU by readjusting the base-line measurements continuously.


My thinking at the moment is to set a minimum magnitude and frequency threshold to classify something as a touch. Those fluctuations caused by moisture, temp, EM-fields whatever are hopefully always much slower than a change caused by touch.

I will take some of the other points into consideration and see how I can use them and measure their effects.
kasbah
Newbie
Newbie
 
Posts: 23
Joined: Fri Dec 14, 2012 1:41 am

Next

Return to Project logs