# How to stop a switched current affecting an IC?

I have 10 circuits each consisting of a Touch IC (Atmel at42qt1010) and electrode, and 2 x 350mA Constant current regulators (NSI50350AST3G) and LED's. All connected to a Arduino Mega, by ~1 meter cables.

The header pin is as follows:

1. +5v (for Touch IC)
2. LED2 (HIGH switches circuit on)
3. TOUCH OUT (When touch is detect this is HIGH)
4. LED1 (HIGH switches circuit on)
5. +7.5v (for Constant current regulators)
6. GND

So on all circuits 1,5,6 are commonly connected. 2,3,4 are isolated and connected to the MCU.

The problem occurs when switching pins 2 & 4, doing so seemingly causes random circuits to output 3 as HIGH. Even if I switch the LED'S on say circuit 1, circuit 5 may falsely start detecting a touch.

The only way I have found to remedy this is two always maintain the same loading, for example on circuit 1 if LED1 is ON & LED2 is OFF, if I toggle there states at the same time, everything is OK. However if there is a delay say 20ms, it will cause the problem. Or if I want them both off, the major problem I have now...

This behavior can also be seen (not to the same extent) when +7.5v, is not even connected.

Attached is my schematic. I have 10 of these, connected to an Arduino Mega. +5v is provided by the Arduino and USB +7.5 is provided by an external supply. GND's are connected.

I am not using PWM, just HIGH and LOW to control the LED's

UPDATE

After following the advice given here, and reading these further application notes, I have revised my schematic and also incorporated a three channel LED, rather than the two previous LED's. I will also plan to run these with a PWM signal now.

The Application note 'Secrets of a Successful QTouch Design - Atmel Corporation'

The Application note 'Power Supply Considerations for Atmel Capacitive -touch IC's' Shows a LM78L05 regulator

Schematic 2.0

PCB Layout 3.0 - Routing and trace widths still need to be optimised.

Questions

1.Should I use the LDO regulator mentioned in the above application note instead?

2.Will I be OK using this 7.5V - 10V across 10 of these circuits, therefore having 30 PWM high current circuits impacting on each other? It will be provided by a switched mode psu such as http://uk.farnell.com/xp-power/jpm80ps07/psu-80w-7-5v-10-7a/dp/1109830

3.Have I gone overboard with the 3x 100uF electrolytic caps?

4.Anything else I should do? I will then re-design the PCB.

• Have you followed all the rules relating to wiring the touch sensor to its pad, including keeping it away from the other wires and ground? A picture of the board might help us. – pjc50 Jan 4 '13 at 16:56
• Ditto: Your board layout may be causing the stray EMI. Try adding additional GND lines in your header/cable or re-arranging their order to separate the signal lines from each other and the power lines. A suggested header arrangement: 1) LED1, 2) LED2, 3) +7.5V, 4) +5V, 5) GND, and 6) TOUCH OUT (assuming a single row header). – shimofuri Jan 4 '13 at 17:18
• I've added the layout above - I thought I followed the rules regarding the touch IC, ie keep trace from UM to P1 short and avoid other traces and ground planes, I guess C1 should have a closer ground route to the IC? – davivid Jan 4 '13 at 17:19
• This has nothing to do with your problem, but all of the traces that are carrying the 350mA diode current should be much wider than the default width (10 mils?) you used. And keep in mind that the +7.5V and Gnd traces from the header are going to be carrying twice this current. A ferrite bead on each of the power supply lines right at the header will help reduce the coupling of fast edges among the wires of the cable. – Dave Tweed Jan 4 '13 at 17:33
• At a glance, your layout needs rework. You need to compress the components closer especially the header. You also need to improve the GND plane and traces. Here's something to guide you: sva.ti.com/AU/design/courses/270/… – shimofuri Jan 4 '13 at 17:34

Try adding a couple of capacitors across Res3 and R4, e.g. 100nF, to slow down the switching and minimise EMI. Also add some bulk capacitance to the touch sensor power rail (e.g. >100uF electrolytic) and the +7.5V rail. Let us know the results.

Also, you can try reducing the sensitivity of the touch sensor. Make sure you ahve followed all the guidelines in the datasheet regarding PCB layout and noise immunity - notice it is recommended to use a dedicated voltage regulator if the power supply is shared with another electronic system:

NSI50350AST3G and PWM

The mention of the capacitors above and in the datasheet is to reduce the higher frequencies that can causes issues when switching large currents at high speeds. Note that "high speed" here refers mainly to the rise time of the PWM signal rather than it's primary frequency.
If we leave the capacitors out, and we switch using the Arduino pin the rise time at the base will be fast (which means the transistor switching will be fast) I don't know about the ATmega specifically, but most modern microcontrollers have very fast I/Os. Many can switch in under 10ns, take for example this scope shot I just grabbed from a dsPIC:

You can see the rise time is just over 5ns, this is pretty fast. I'll assume it will be faster than the ATmega, but we'll assume the ATmega switches in 10ns. Remembering that any waveform can be made up from a sum of sinewaves (see Fourier Transform) a good rule of thumb to calculate the significant spectral power density (very roughly - the frequency components large enough to be worth bothering about) from the rise time is:

Fknee = 0.5 / risetime

Fknee is the point where the spectrum rolls off much quicker (e.g. like the -3dB point of a low pass filter) so this is a significant point.

So for 10ns:

Fknee = 0.5 / 10e-9 = 200Mhz(!)

Now the transistor will switch a lot slower than this, the datasheet gives a value of 100ns maximum for 30V, 750mA and a base current of 15mA. According to a simulation model I found, it is indeed pretty quick. So 100ns still equates to 20MHz, faster than we would like. Luckily, our base current is not 15mA, so the rise time is more like 600ns, which gives us a knee frequency of 1.2MHz, getting much better. Let's have a look at this:

And the simulation with rise time shown (under "Diff cursor2 - cursor1"):

The current risetime is only 985ns (open in new tab for larger version)

Okay, now let's add the capacitor and see what we get:

And the same simulation we now have a ~15.6us current risetime:

This is fine for an LED PWM, since the frequency will be low (e.g. 100-300Hz or so) and significantly reduces the high frequency component.

BUT

The (rather large) downside is that the transistor base current is not sufficient to switch the 350mA fully (notce the maximum current in the plots above, and hence now disspiates more heat, since it spends more time in between fuly on/off - to be precise, it doesn't turn on fully)
This not be efficient and you don't have your LEDs as bright as you want them (if you do the sim, it's disspating around 0.25W)

SO

Replace the 4.7k resistors with 1k resistors, and then you should have enough base current to switch the full 350mA. But hang on - what about the rise time if we change the resistors? it decreases to around 2.5us (not so bad), but you can increase the capacitor to 220nF or 360nF if you wish to keep the risetime slow.

• Thanks - I will give that a go. re the Bulk capacitance to the power rails - do you mean on the power board or on each circuit. Would it be worth adding a jumper wire to C1 – davivid Jan 4 '13 at 17:34
• If there are none present on the power board then both (can be tantalum or Al). Larger ones on the power board, and some smaller electroltyics on each circuit would be a good idea. The large electrolytics provide a local transient current source, and also low ESR at low frequencies, which the ceramics can't cover adequately. – Oli Glaser Jan 4 '13 at 17:42
• Hi, I've created a new schematic and found some more application notes regarding the power supply. How do the changes I've made look? I will hope to get new PCBs manufactured this week. – davivid Jan 15 '13 at 17:27
• Cool will do. The datasheet for the NSI50350AST3G, suggests putting those capacitors in to reduce EMI (Although I don't understand how to work out the value correctly), What do you think? still remove or not? – davivid Jan 17 '13 at 13:38
• At a quick glance, it looks better if the sensor chip is separately regulated (the LM78L05 should be okay). The main thing is to keep the IC supply separate, well decoupled, and the electrode well away from any switching also. Try not to run anything that switches (especially a highish current) anywhere near the electrode trace. Start designing the PCB and post your progress (doesn't have be finished). You will notice I deleted the previous (stupid) comment on the caps, keep them in - will update the answer on with some details on how to calculate values. – Oli Glaser Jan 17 '13 at 14:32