Why an iPhone gets a jittering touchscreen when plugged into a power inverter

As I had this job driving around town, I needed to keep a bunch of mobile devices charged at all times, including a computer. Since there wasn't nearly enough 12V sockets in the cabin, I had to use a true sine wave inverter, and plug in different USB chargers in. Sure, it wasn't the most efficient use of electrical power, but it worked.

My first contact with this law of physics wasn't really comfortable, if not to say a bit scary. Once, as I was holding the phone in hand (don't worry, I wasn't driving), I felt a slight shock in the hand, and quickly let the phone go, which fell on the rubber mat. Already knowing what en electric shock felt like (I wasn't new to tinkering as I modded my first power adapter aged 7), I unplugged the 12V lighter cord and picked up the phone. This time, no electric shock, the phone was fine.

I thought about what could cause this, and swapped the USB cords with other USB chargers I had, then back to the original USB charger after plugging it back in the 12VDC. While there was no more shock, I noticed that the touchscreen behaved rather erratically when I laid my finger on it, immediately ceasing when I turned the inverter off. Some chargers gave worse performance than others, but none were immune to that behaviour, which was, by the way, not reproducible when used in my home's unstable mains. Adding another test, I turned on the laptop I always carried with me, and noticed the exact same erraticality when using the touchpad. Of course, it relies on the same technology as modern touchscreens, namely capacitive sensors.

I quickly dismissed the first hypothesis that ignition coil noise can make their way through electrical equipment in a vehicle, for the simple reason there's no ignition coil in a Diesel engine. The second hypothesis was that the inverter itself generated a lot of noise that even good-quality USB chargers couldn't filter out (the laptop was using a brand-name power supply), and the third one, which proved more interesting, was that cheaper USB chargers didn't feature good noise filtering nor sufficient safeguards. While I have yet to study the inverter itself, I found out this whitepaper from Cypress Semiconductors (linked from Ken Shirriff's excellent blog demonstrating how bad counterfeit chargers can be - Google was never my friend to find such detailed information) explaining the link between electrical noise and bad touchscreen performance, and attractively titled Noise Wars.

It was clear enough from Ken's blog that switching power supplies usually have much better efficiency than linear regulator's, with the downside of much worse noise from high frequency switching, AC line noise, unless properly designed. Unfortunately these added filtering components also add cost, and while a few cents scrapped off a charger may not seem like much, it is when the final product is sold for a few dollars.

But filtering isn't the only issue. From Ken's pictures, one can easily see even basic safety measures are not taken in low-cost chargers, leading to lethal risks should one little piece fail. It seems my inverter is both badly filtered and may not be properly insulated, but this is difficult to assess before purchase as, say, non-sensitive loads such as incandescent lamps wouldn't cause issues.

So play it safe, stick to well-known brands or at least heavily and positively reviewed USB chargers. As with speakers, if you don't have any other data on them, the more it weighs, the more likely it is to be a quality part.