Capacitive sliders

Status
Not open for further replies.
Hi there!

I was taking a look at the CapSense library on the Arduino Playground and I thought it could be useful for a project of mine, in particular the capacitive sliders.
http://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense

I'm attempting to build an OSC controller with twelve 40cm sliders detecting position and pressure (I tried earlier with Softpots but didn't like much the result).
I was wondering:
a) whether the Teensy 3.1 has power enough to read all that without suffering significant latency;
b) which general design would be the best.

I tried with a resistance ladder (just a line of 1k resistors wired to each other), but I had a problem with the ratio between position and pressure, much like it states in the article on the Arduino Playground:

"So in this manner when a finger is moved from one pin to the other the two calls to capacitiveSensorRaw will report complementary values that have an approximately constant value to them. The complication comes in when trying to deal with how much contact (capacitance) is present, which raises (or lowers) both values, but not necessarily in a linear manner. "

So, how could I solve that and get more accurate position and pressure info? Is it a matter of geometry or materials, is it more about putting some magic math in the code or should I take readings from several points along the slider?

Thanks for reading,
Jose.
 
Check out the touchRead() function of the Teensy 3.x. It works well and would simplify both your hardware and software. You won't need the resistance ladder and you won't need to write the timing loop to do the capacitance measurement.

I haven't made a slider, but I have made "pressure sensitive" buttons. I put the quotes in because it's not really sensing pressure. Rather, it's sensing "more finger" and thus more capacitance closer to the button. My understanding of how to make a slider is that you wire a conductive plate to the Teensy touch input and the geometry of the plate is such that one end presents more surface area to the finger than the other. The simplest version of this would be an isosceles triangle. When your finger is near the base, there's lots of contact area. When it's near the tip, there's minimal contact area. To avoid the problem of having the sensor be too narrow at the pointy end, you could tile several skinny triangles, like this WW, but with the triangles filled in.

If I were doing this, I'd prototype it using aluminum from a soda can. I'd cut a couple of Ws, file off the burrs, tape the aluminum to a piece of cardboard covering the sharp edges, clip a wire to the aluminum using a stiff clamp and poke the other end of the wire into a breadboard.

If this worked well enough, I'd either move on to copper clad fiberglass or draw up a circuit board to have made at OshPark or somewhere.

You might need to do some filtering on the touchRead values. If I recall correctly, Teensy might do some averaging in hardware but you might also want to add some median filtering or some hysteresis.

http://dangerousprototypes.com/forum/viewtopic.php?t=4606#p45520
http://forum.pjrc.com/threads/13987-Teensy-3-0-capactive-touch
http://njhurst.com/blog/01356576041

We'd love to see a picture if you get this working. :)
 
Hi Pictographer!

thank you for your kind answer. But one little problem I have with that geometry is that I'm trying to get the sliders to be 1cm wide and around 40cm long. Fitting two or more triangles there seems nearly impossible. To which I can think of two solutions, tell me if you don't mind how feasible you find them:
a) by having different layers with different "triangle antennas" stacked on top of each other (with insulation in between, of course).
b) if I can multiplex the touch sensors, I could divide the slider in shorter segments with shorter triangles and read from several points. I'm worried that in that case it could get laggy or have significant latency (it's 12 sliders and it's intended to be a musical instrument), so I also thought of two solutions for this:
b.1) by doing fast readings first with minimum resolution, just to detect which slider is being pressed. Then, reading the segments of that slider with greater resolution.
I will rarely be pressing more than 5 of them.
b.2) by using two layers for each slider: one simply senses pressure all along the slider, the other is the one with the triangles and several segments. Only when pressure is detected in one of the sliders would the Teensy read the position, that way I don't have to cycle constantly through the twelve. But I don't know if the two layers could interfere with each other.

Thank you, sorry for flooding you with questions, and of course I'd love to share some triumphant pictures if I ever get this working :)
 
Ok, here's another idea. Again, I haven't tried it. Instead of cutting shapes, suppose you start with magnet wire or thin stranded wire. For each slider, run the wires parallel to the long edge. Like the tick marks on a ruler, cut the wires to varying lengths so that like before, the conductors are more dense at one end than the other.

A completely different approach would be skip building your own sensor. Get an existing touch sensor or sensors. There are tons of them around from old track pads to cell phone replacement parts to components at vendors like Ada Fruit and Spark Fun.

Regarding your questions, (a) you only need insulation between different sensors, of course. Distance is a big deal. You don't want to put too much insulation between the finger and the sensor. (b) is interesting. I'd keep it in my back pocket if simpler configurations "almost" work. (b.1) could work. Not sure how long it takes to change the touchRead parameters. (b.2) could work also. Since Teensies are small and cheap, you might speed things up by using more than one.

Definitely experiment with one slider before spending lots of time building 12. You can always artificially slow down your code by a factor of twelve by doing all the calculations for a single slider 12 times (or 120 times, etc.)

By the way, have you been following the thread about overclocking? We're getting way ahead of ourselves, but there are a wide range of options for making things go fast.
 
a) by having different layers with different "triangle antennas" stacked on top of each other (with insulation in between, of course).

If you mean stacking two layers on top of each other (e.g. like a PCB), then the capacitive sensor won't be able to detect the one on the bottom (it's shielded by the plate above).
 
If you mean stacking two layers on top of each other (e.g. like a PCB), then the capacitive sensor won't be able to detect the one on the bottom (it's shielded by the plate above).

Well, that sounds quite logical, thanks for pointing out. Although there's the Soundplane ( http://madronalabs.com/DIY ), which solves this using carrier stripes if I understood it correctly, but it's a whole new level of complexity.
I wonder if it'd be possible instead to use two bobbins across an 1cm wide stick, each more dense (with more turns) on each end. I'll experiment to see what happens.

Ok, here's another idea. Again, I haven't tried it. Instead of cutting shapes, suppose you start with magnet wire or thin stranded wire. For each slider, run the wires parallel to the long edge. Like the tick marks on a ruler, cut the wires to varying lengths so that like before, the conductors are more dense at one end than the other.

I like that, if I'm picturing it right: you mean several wires with different lengths, so that they "draw" two opposing triangles? That should be feasible easily, I'm gonna give it a try.

Definitely experiment with one slider before spending lots of time building 12. You can always artificially slow down your code by a factor of twelve by doing all the calculations for a single slider 12 times (or 120 times, etc.)

Oh, don't you worry, I'm way too lazy to build 12 of them before being sure they're going to work :)

By the way, have you been following the thread about overclocking? We're getting way ahead of ourselves, but there are a wide range of options for making things go fast.

Mmm, that's quite good to know.

Thanks guys!
 
I wasn't thinking of opposing triangles. I was thinking of several side-by-side triangles all hooked up to a single touchRead input. Maybe opposing triangles give more resolution somehow, but each of the opposing triangles would need it's own input and I don't know how much of a gap would be needed between them.

slider.png
The picture came out a bit small. The idea is to make wires like the tick marks on a ruler, but elongated to match your 4:1 ratio.
 
Hi there!

So I've been trying all possible sensor shapes. In the end, the only thing I found robust enough to feel satisfied was the brute force approach: many electrodes, I'm using thumb tacks actually. It looks more like a keyboard than a multislider now, but of course the proximity of the keys allows sliding with some change in the code.

Where I'm having a bit of a problem though is multiplexing. I'm using the usual CD74HC4067 ( https://www.sparkfun.com/products/9056 ) but it's giving me a very high base capacitance (around 3000), which slows down the readings, which are around 150. To this I have two possible solutions:

1) Using three Teensies communicating through their serial ports, as with a third of the keys it seems to work at acceptable speeds. I wonder though whether power could be an issue with one teensy connected to the laptop usb feeding the two others through the 3.3V pin, or if it could affect touchRead.
2) Using a different multiplexer. But I have been intensively googling around and reading datasheets and found no relevant info (that I could understand at least). Only a post in this very same forum: http://forum.pjrc.com/threads/23599-Multiplexing-touchRead-with-74HC4067
Someone apparently had the same problem, but didn't post any further. Have you ever multiplexed with touchRead?
 
Any reason not to use something like an MPR121? https://www.sparkfun.com/products/9695 Though it looks like it only comes in a QFN package, so that might be a good enough reason to not want to deal with it.

Mmm, those might be interesting. I don't see the problem with it being QFN if it comes in a breakout board. But from the tutorials I have seen (and I might have misunderstood), it looks like it's not sensitive, it only indicates whether it's pressed or not. That's rather sad for a musical keyboard.
 
Status
Not open for further replies.
Back
Top