EMI / ESD reset issue using AS5600 encoder & Mega 2560

I’m a programmer with little wiring knowledge. I believe I’m seeing an EMI issue that resets the arduino that is coming from when a motor limit switch triggers.

I’ve set up an Arduino Mega 2560 to interface with a linear actuator that has an AS5600 magnetic encoder attached. I have a 3 ft cable attached that has 2 motor wires, and 3 encoder wires. The motor is wired up to an external 12v power supply through a motor controller. The motor controller gets 5v, ground, and 2 digital inputs from the Mega. The encoder has 5v and ground coming from the Mega and the 0-5v signal is attached to A0. The mega is currently powered via USB, but will eventually be powered by a car battery, along with the actuators.

So long as the actuator doesn’t hit a limit switch, the program will run indefinitely. About 75% of the time it hits a limit switch, the program will reset and re-run. I tried isolating the encoder by lining it with faraday tape, but that seemed to make it worse.

How exactly can I wire up my encoder so that it doesn’t cause the arduino to reset? The 5v and ground to the encoder - do those need addressed? The 5v and ground to the motor controller could be getting feedback when the motor stops?

I have no electrical testing tools other than a multimeter so I can’t measure the spike.

EDIT: I isolated the motor controllers to a separate arduino. I connected 5v and ground to another arduino then manually moved the motor on and off the limit switch. The original mega still resets itself so the issue must be on the encoder side of things in this case.

EDIT: After reconnecting the motor controller to the Mega and disconnecting the encoder signal wire, it’s stable. If I connect the encoder signal, it immediately starts resetting the Mega. What do I need to do to the encoder signal wire? TY

Encoder:
https://www.digikey.com/catalog/en/partgroup/as5600-adapter-board/51195

Motor controller:

Actuator:

My favourite page for switch issues.

For longer cable runs shielded cables and ferrite beads / rings are almost always needed too.
Careful routing of cables should also be considered.

ballscrewbob:
My favourite page for switch issues.

For longer cable runs shielded cables and ferrite beads / rings are almost always needed too.
Careful routing of cables should also be considered.

Thanks for the reply! The limit switches are internal to the actuator and would be limited to the 2 isolated motor wires that come from the motor controller. Should I crack it open and modify it or should I do work on the wires that go from the Mega to the motor controller? TY

The internal wires should be OK but depending on the length of the external runs you may want to take any extra precautions.

ballscrewbob:
The internal wires should be OK but depending on the length of the external runs you may want to take any extra precautions.

Thanks!
It turns out that if I remove the encoder signal wire and drive the motor on and off the limit, everything remains stable. Shortly after I place the signal wire on A0, the program resets. Definitely tied to what's incoming on the encoder data line.

Would dropping a 5.1v zener from the signal to ground do the trick?

Ok, I've dropped a 2k resistor on the signal and it's stable. I lost resolution but it at least tells me that it's the issue. What's the proper approach to fix the issue without losing much resolution? TY!

fordfanboi:
I have a 3 ft cable attached that has 2 motor wires, and 3 encoder wires.

Stop right there. The motor wires and encoder wires need to be in separate cables, and
either routed apart, or the sensor wires for the encoder need to be in a separate shielded
cable, possibly allowing it to run alongside the motor wires without too much interference.

The two motor wires should be run as a twisted pair, as with any high current wiring,
to reduce magnetic interference.

MarkT:
Stop right there. The motor wires and encoder wires need to be in separate cables, and
either routed apart, or the sensor wires for the encoder need to be in a separate shielded
cable, possibly allowing it to run alongside the motor wires without too much interference.

The two motor wires should be run as a twisted pair, as with any high current wiring,
to reduce magnetic interference.

TY
The actuators came supplied with the proprietary wiring harness.

I don't have many options here unless someone knows where I can source custom IP66 wiring harnesses for it.
As I mentioned earlier, I've managed to fix the stability by using a 2k resistor on the signal line, but I lost accuracy. I'm hoping someone can explain how I can reduce the accuracy loss. If I can also source a better wiring harness, then win-win!

IP66 only describes the resistance to ingress etc and does NOT name a specific pinout or connector.

Did not see on the link what type it uses either ?

You seem to have it working so pictures of the connector (how have you wired it up), or any details not easily available on the site would be useful ?

ballscrewbob:
IP66 only describes the resistance to ingress etc and does NOT name a specific pinout or connector.

Did not see on the link what type it uses either ?

You seem to have it working so pictures of the connector (how have you wired it up), or any details not easily available on the site would be useful ?

I'm using the VIn, Gnd, and Out pins on the AS5600 encoder. I tried using the I2C connections but the noise was too much so I switched to the analog out.

I've attached a pic of the 5 wire harness.

So basically just an IP66 waterproof box with a small connector pcb ?

Splitting the cables should be quite easy by just adding the gland type cable entries.
Or true IP 66 connectors with a through socket, preferable two different ones to prevent accidental connection to the wrong group of wire.

Look up IP66 glands and IP66 connectors.

Going back to the loss of accuracy the resistir might be too high for what they use as switches inside so maybe a lower value.
OR there is insufficient voltage getting there in the first place which you can check with a multimeter.

My own preference is also to add capacitors besides the resistor.

ballscrewbob:
So basically just an IP66 waterproof box with a small connector pcb ?

Splitting the cables should be quite easy by just adding the gland type cable entries.
Or true IP 66 connectors with a through socket, preferable two different ones to prevent accidental connection to the wrong group of wire.

Look up IP66 glands and IP66 connectors.

Going back to the loss of accuracy the resistir might be too high for what they use as switches inside so maybe a lower value.
OR there is insufficient voltage getting there in the first place which you can check with a multimeter.

My own preference is also to add capacitors besides the resistor.

Thanks, I'll check those out!
I've dropped to a 10k resistor and stability is still great. Noise still sucks, but hopefully a new cable can solve that.

Is there an example of how to wire up a capacitor like you mentioned? TY

Yes see the link I posted earlier as that covers a few methods to help filter noise.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.