Is capacitive sensing possible with batteries?

I'm building a device which uses a capacitive sensor for input. It works, no problem...

...until I switch to battery power.

In a battery system the whole device is floating, right? Does this mean that capacitive sensing can't work?

Does this mean that capacitive sensing can’t work?

No it just means you have to be more careful in designing your ground. That is you have to have one rather than just expecting it to work.

Grumpy_Mike:

Does this mean that capacitive sensing can't work?

No it just means you have to be more careful in designing your ground. That is you have to have one rather than just expecting it to work.

But there's no ground in a handheld device... :-(

How do these work?

https://www.youtube.com/watch?v=9DyTx0hvmqE

Capacitative sensing relies on you changing the capacitance (by changing the dielectric value) between two plates. One of those plates is an analogue input, and the other is ground. Yes, it is possible (though wrong) to use the earth as the ground plate, but you should really have two plates on your PCB layout, and you measure the capacitance between them.

It sounds like you're doing it the lazy way and only having one plate in your design and relying on the ground being the other.

By the way, you're confusing "ground" and "earth". "Earth" is the thing you are standing on. "Ground" is the point in your circuit against which all other voltages in your circuit are measured. It has absolutely nothing whatsoever to do with what you are standing on.

And every device that plugs into the mains with only two-prong plugs have no reference to the "earth", either.

majenko: By the way, you're confusing "ground" and "earth". "Earth" is the thing you are standing on. "Ground" is the point in your circuit against which all other voltages in your circuit are measured. It has absolutely nothing whatsoever to do with what you are standing on.

OK, semantics aside....

I want a Tiny85 based device under the lid of a jam jar. I want it to turn on some LEDs when I touch the lid. It's powered by a coin cell.

How can I do that?

Does this mean that capacitive sensing can’t work?

Your smartphone works, doesn’t it? :wink:

It works when you’re holding it, when it’s on your desk, even when it is sitting on top of a noisy wireless charger.

Atmel are one of the main suppliers of touch screen controllers, after buying Quantum who used Atmel microcontrollers in their capacitive touch screen technology.

Does this have to be the original lid? If you can split the lid, connect one side to circuit ground, the other side to the sense lead. Also works if you make it a center and ring as long as both have roughly equal surface area. Hm...

Wait... if you can insulate the lid from the ring, connect the ring to circuit ground, and the lid to the sense terminal.

Does this have to be the original lid?

Sure it can be. The lid is plastic you just mount your capacitive sensor ( that is two electrodes of which you can call one ground ) under the lid on a PCB.

fungus:

majenko: By the way, you're confusing "ground" and "earth". "Earth" is the thing you are standing on. "Ground" is the point in your circuit against which all other voltages in your circuit are measured. It has absolutely nothing whatsoever to do with what you are standing on.

OK, semantics aside....

I want a Tiny85 based device under the lid of a jam jar. I want it to turn on some LEDs when I touch the lid. It's powered by a coin cell.

How can I do that?

By charging two plates with a constant current for a predefined time, then measure the voltage across them. Your finger, or the air if there is no finger, is the dielectric that affects the capacitance, and hence the final voltage, of the plates. It's up to you how you arrange the plates to achieve the best effect.

Here's one possible design:

Grumpy_Mike:

Does this have to be the original lid?

Sure it can be.

My lid is metal, not much chance of changing it.

Will it work if I put another metal disc under the lid and connect GND to that?

Will it work if I put another metal disc under the lid and connect GND to that?

It could although to get the maximum effect your body should, in some respect, be between the plates.

Grumpy_Mike:

Will it work if I put another metal disc under the lid and connect GND to that?

It could although to get the maximum effect your body should, in some respect, be between the plates.

Tried it, it doesn't work.

It seems to work if I put another lid under the jar and connect one end to that. I'm going to experiment with tinfoil inside the jar.

Update:

A piece of foil in the base of the jar works.

A piece of foil stuck to the side of the jar works too, but not as well as a piece in the base.

nb. The side I touch with my hand is actually the "GND" of the PCB/battery/etc. The foil is on the sense pin is far away. It seems ass-backwards to me, but it works.

If it were a mason jar lid, you could do as I suggested and insulate the ring and lid from each other.

It seems ass-backwards to me, but it works.

It's floating there is no "right" way round.

You could probably glue a piece of PC board to the underside of the lid and use that.

You don't want the PCB on the bottom of the lid to have too much capacitive coupling to it.

I would not glue it to the bottom of the lid. Instead, I'd put it so the circuit is sandwiched between the lid and a metal piece under it. Although a ring around inside the jar would be better than that.

It is about having your conductive hand shorten the path that the electric field has to take between the pieces of metal.