Sewing Machine EMI Woes

I think I got my sewing machine to stop randomly rebooting!

(Yes, I am a huge dork…)

LCD with filter capacitor

Motor with grounding wire

This isn’t the first time I’ve delt with EMI problems in my hobby projects, but this one actually turned out to be a lot more annoying than the others. This project has no really high-frequency signals, no super-wide parallel busses, no 100 MHz clocks. But it does have a few ingredients in a small recipe for disaster:

  1. A single power supply input
  2. A pretty high powered DC motor
  3. Several relatively high current items running at different voltages (LCD backlight, LED work light, microcontroller)
  4. Multiple switching power supplies
  5. Analog and digital components
  6. A 10 MHz SPI bus running over perhaps 20 inches of ribbon cable

The symptoms were usually pretty simple. At random intervals while sewing, sometimes after 15 minutes, sometimes after only 2 seconds, the whole system would reboot. The microcontroller resets, and everything goes on like normal. Sometimes instead of rebooting, the LCD would become corrupted but the system would otherwise be fine. Sometimes the motor speed controller (on one of the microcontroller ‘cogs’) would keep running, but the UI (on a different ‘cog’) would crash. Sometimes there would be noise in the tachometer sensor, causing the estimated machine angle to ‘creep’ upwards slowly.

Most of these symptoms seemed like power noise. So I tried adding capacitors, isolating the power supplies, etc. Some of these seemed to make the problem a bit better, but nothing solved it completely. Even with the high-current components totally isolated from the microcontroller, I’d see crashes. So bit by bit, I started the process of elimination, and I ended up with a pretty long list of fixes. I still don’t know if each and every one of these was necessary, but at this point I feel like I’m a doctor trying to cure some terminal illness. I guess about the root cause, prescribe some medication, and if that doesn’t help I try something else. Or if the situation is getting desperate, we’ll just try everything at once. So, before I ended up declaring the problem solved, I ended up doing all of the following:

  1. Tweaked the values of the reset circuit’s RC filter, in case it was spontaneously triggering a reset.
  2. Several additional capacitors on the main board, filtering the input power (6V) as well as the 3.3V supply for the μC
  3. The unused “current sense” output from the LMD18200 was hooked up in such a way as to couple lots of noise into the μC’s ground. Disconnected it.
  4. Some noise was also flowing into the μC’s ground via the outputs for motor PWM and direction. Added series resistors to all of these signals.
  5. An LC filter on the 6V supply as it enters the main board. The higher-current but noise-tolerant loads like the LCD backlight and the LED work light are not protected by the filter, but the 3.3V regulator and the analog circuitry are.
  6. Grounded the motor’s metal enclosure. It was actually throwing off enough EMI that, even with the μC on an isolated power supply, crashes occurred with the motor running but not without. After grounding it, the problem was nearly gone.
  7. I still had occasional crashes, and less occasional LCD glitches. It turns out that the DC-DC converter on the Spark Fun LCD board is rather noisy, and it was coupling noise back into the 6V power supply. Since this power goes overt he long ribbon cable alongside our high-speed SPI bus, it is pretty likely to corrupt bits in that bus. Fixed this by adding a big electrolytic cap directly to the Vbatt input on the LCD board.

Whew.. and after all that, I think it’s finally all fixed.