I am building a speed-testing stand for electric wheelchairs with an arduino nano + rotary encoder. The wheelchair is put on cable caddies, which turn the rotary encoders via a belt.

The setup itself with measuring the speed works pretty well. However, due to the rubber wheels on the metal caddies, charge builds up and then there is a static discharge (you can see the flash), which freezes the arduino.

So far, I don't have any protective circuit for this. The arduino is connected to power with a USB-Powersupply. The rotary encoders get their power from the VCC+GND Pins of the arduino. The data pins of the encoders are connected to the arduino digital Pins 4 + 5 (defined as INPUT_PULLUP).

What is the best way to protect the circuit from these voltage spikes / static discharges? There isn't really a way to ground the cable caddies, because they are portable and set-up in sport-halls with plastic floor.

Any hints will be greatly appreciated!


Lets examine some magnetically-induced upsets. Suppose the spark is 100 amps with risetime of 10 nanoseconds, with the 10 nanoseconds edge sized to be a realistic physical size ( several feet of metal structure).

Assume a vulnerable loop on your MCU of 33cm by 33cm, or (0.1 meter)^2 area. And assume a distance between the spark current path and your MCU loop of 33cm.

What is the voltage induced by the spark into the MCU loop?

If we combine Faraday Law of Induction with Biot_Savart Law, for coupling between a long straight wire and a rectangular loop, the wire being in the plane of the loop, and assume the loop is small compared to the wire-loop distance (so we avoid a LOG term in the math), we have this:

Vinduce = [ MUo * MUR * AreaLoop / (2 * PI * Distance)] * dI/dT

and for MU0 = 4*PI*1e-7 Henry/meter and for MUr=1 (air, copper, FR-4), this simplifies to

Vinduce = ( 2e-7 * Area/Distance ) * dI/dT

At this point, I don't know how big or small this magnetically-induced voltage will be. Certainly if 5 volts or larger (than your MCU VDD), you have a problem.

By specifying a "this will be a problem" before we do the math, we bring some integrity to our investigation.

Vinduce = [ 2e-7 * 0.33 * 0.33 / 0.33 ] * 10 Billion amps/second

Vinduce = 2e-7 * 0.33 * 1e+10 and "Houston, we have a problem" as we see just from the exponents of the numbers.

Vinduce = 0.66 * 1e+3 = 660 volts.

Yes, you have a problem with 660 volt induced into your MCU wiring.

Now how to mitigate this?

One method is to insert 10,000 ohm resistor into each lead of the MCU (input and output). This protects the MCU, but may not prevent RESET.

Do you use a Ground Plane, with no slits? to which filtering R+C can be grounded?

Read the comment of Peter Jennings.


Eventually the static discharge will destroy components of your circuitry even if it seems that the μC is only freezing. So your decision to do something about it is not the worst one.

You have different options.

  1. Electrical isolation
  2. Shielding / dissipation
  3. Protective devices in your circuit

Electrical isolation seems to be difficult and if you have moving parts reaching down to your electronic devices, and the encoders are some of them, it may be fairly impossible. But you may be able to increase the distance between the charged parts and your conductive parts by constructive measures.

Shielding (and grounding) with sheet metal or foil was excluded, but I think you should give it a second thought. It might be viable to feed the ground through your sensor lines and connect it to some shielding foil (there are some available with preapplied glue) wrapped around parts being charged.

But dissipation could be another method. Either by selecting wheels made out of rubber with conductive properties. Those are made for ESD-protected areas e.g. for office chairs. Or you can resort to frequent use of antistatic sprays applied to the parts affected.

Finally, having exposed wiring in an electronic circuit is always a risk. I recommend to add TVS-diodes on all exposed wirings. They aren't expensive and when well selected and placed deliver a good measure against ESD related malfunction and, more important, damage.

The third option should be applied all times with exposed parts and wirings, even if other means already deliver a sufficient result. The devil is a squirrel and in many cases electric discharge can happen at places where you never expect it.

  • 3
    \$\begingroup\$ Is there any way you could run the arduino in an shielded box using a battery or a well grounded mains supply then connect to the encoders via opto isolators? Or is this too much of a redesign? \$\endgroup\$ – Peter Jennings Sep 14 '19 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.