Trouble with Adafruit AT42QT1012 capacitive toggle switch controlling a motor

Thread Starter

peterx

Joined Dec 23, 2023
7
Hi
I'm currently building a set of 'battlebot' type contraptions for students to use. They're very simple - basically just some batteries, a switch and a motor. My plan was that each bot would be equipped with a capacitive toggle switch (Adafruit AT42QT1012) so that competing bots could touch the sensor and switch them off. Just a bit of a fun way to show a use of capacitors.

Anyway, I'm not an electronics expert but I've used MOSFETS to do this kind of thing many times in the past (though not with capacitive switches) and never had any issues. The blurb that comes with these little boards from Adafruit even shows a simple circtuit for controlling a motor - basically just a MOSFET and a diode.

Now, the boards work absolutely fine when there is nothing attached to them. They switch on and off completely as they should do. However, when I attach the circuit (sketch below) they still turn on completely reliably but they don't turn off with out repeated touching of the sensor which isn't much use to me. I have tried the following MOSFETS (all logic level) - IRF540N, IRLZ44N, AO3400, P55NF06L and they all behave exactly the same. I've also tried a small MOSFET switch module and have the same problem. The issue seems to be at the board end as the board is not detecting the touch to switch off.

This is all running from 3 AA batteries (4.5v) which may be a little low for the MOSFETS so I have used 4 AA batteries but it seems to make no difference.

In the circuit below I've added a 10k pull down resistor across the source and gain and I've also added a 0.1 microFarad capacitor as I was advised that this would 'stabilise' (not really sure what that meant) the MOSFET. Anyway, that made no difference.

I've tried putting the sensor at the end of 15cm wires away from anything conductive that might be causing a problem and it also makes no difference.

The issue also doesn't seem to be a defective board as I bought two of these and they both do exactly the same.

Both the Adafruit break out board and my little MOSFET circuit work perfectly well in isolation but they won't work together.

I would be incredibly grateful for any assistance!cct.jpg
 

KeithWalker

Joined Jul 10, 2017
3,603
I am assuming that you are using the same 4.5V power source for both the motor and the switch. When the motor is running, it will introduce electrical interference on the power supply lines. That is probably what is effecting the switch turn off. Make sure that both circuits are wired independently all the way back to the battery. Add 50uF and 0.1uF capacitors across the the supply at the switch power input. If that does not solve the problem, you may have to add more filtering using ferrite beads in the switch power lines.
I don't know how much current your motor will be using, but 4.5V is not enough to turn on most MOS FETs completely. Check that it is not getting hot. If it is, you may need to mount it on a heat sink.
 

MrChips

Joined Oct 2, 2009
34,626
Capacitive sensing is meant to work with human hands touching the switch. It works because the human body is a huge antenna for picking up 50/60 Hz AC line frequency noise.

I think that it does not sense robots touching the switch. Use a micro switch instead.
 

Thread Starter

peterx

Joined Dec 23, 2023
7
I am assuming that you are using the same 4.5V power source for both the motor and the switch. When the motor is running, it will introduce electrical interference on the power supply lines. That is probably what is effecting the switch turn off. Make sure that both circuits are wired independently all the way back to the battery. Add 50uF and 0.1uF capacitors across the the supply at the switch power input. If that does not solve the problem, you may have to add more filtering using ferrite beads in the switch power lines.
I don't know how much current your motor will be using, but 4.5V is not enough to turn on most MOS FETs completely. Check that it is not getting hot. If it is, you may need to mount it on a heat sink.
Many thanks for that - I'll give it a go and see what happens!
 

Thread Starter

peterx

Joined Dec 23, 2023
7
Capacitive sensing is meant to work with human hands touching the switch. It works because the human body is a huge antenna for picking up 50/60 Hz AC line frequency noise.

I think that it does not sense robots touching the switch. Use a micro switch instead.
Any conductor will work. I can switch these on and off with nails, welding rods, tin foil etc even when they're electrically isolated from me. I did originally look at microswitches but they require too much force to operate for what I'm doing plus I do really want to use the capacitive switches if at all possible just so they can be used as an illustration of capacitors at work for younger students.
 

Ya’akov

Joined Jan 27, 2019
10,226
Welcome to AAC.

I would concentrate investigation on this feature of the chip which may be the source of the problem if the motor brush noice is interfering with detection. (datasheet, page 7)

1759049733490.png
 

Thread Starter

peterx

Joined Dec 23, 2023
7
Many thanks for that - I'll give it a go and see what happens!
I added the 0.1 and 50 microFarad capacitors across the supply and that didn't seem to do anything. I then soldered a couple of 0.1 microFarad capacitors from the motor terminals to the casing - still no change. However, I then also upped the supply voltage to 6 volts with 4 AA batteries and it now seems to work fine.

I had a bit of a fiddle about to try to minimise the number of components in the circuit to see if I could get away without the capacitors across the supply. Once I took those out it stopped working again. I also tried just soldering one capacitor across the motor terminals and that also stopped it all working.

Anyway, interesting learning experience and I'm glad it's now working.

Thanks for your help with this!
 

MrChips

Joined Oct 2, 2009
34,626
Another thing you can try is to power the AT42QT1012 via a 100 Ω series resistor and 1 μF decoupling capacitor. The sensor draws only 32 μA @ 1.8 V.
 

Thread Starter

peterx

Joined Dec 23, 2023
7
Another thing you can try is to power the AT42QT1012 via a 100 Ω series resistor and 1 μF decoupling capacitor. The sensor draws only 32 μA @ 1.8 V.
Thanks - I'll give it a go but I seem to have it working now. I've upped the power supply to 6v and added a couple of capacitors between the motor terminals and the motor casing. I've also got 0.1 microFarad and 50 microFarad decoupling capacitors across the power supply to the AT42QT1012 and it all seems ok.

Thanks for your help.
 
Top