Magnetic interference with hall effect sensor

Just a sanity test really ... as I seem to be losing mine :-[ And it might save someone in the future from making the same mistake as me.

I have a robot based on a powerchair chassis with a couple of big 350W motors, and I noticed that the motor shafts protrude enough for me to get a couple of disks onto, so I built encoders by embedding magnets in the disks and using hall-effect sensors to measure the rotation.

Like an idiot, I did all the calibration and measurements to calculate the clicks per metre by turning the wheels by hand with the motors powered down. Everything looked fantastic, until I decided to spin the robot under its own power to get the clicks per rad ... of course as soon as the motors wound up, the sensors went crazy. Same for linear movement - no sensible readings. I'm assuming it's all the magnetic fields that the motors generate - does that sound plausible ?

My new plan is to replace the hall-effect sensors with AEDR8300 infra-red sensors to see if I can catch the reflective surfaces of the magnets, but it's going to be a long few weeks until the slow boat from China arrives, so I wondered if there were any other ways to attack this problem ? I'm even thinking of tapping and extending the motor shafts to physically move the current sensors but I think it might be a lot of effort for little result.

Any input welcome,

David

It might be the magnetic fields from the motors, it might be electrical interference from the motors and/or
motor driver.

Is all your sensor wiring shielded and away from the high current wiring loom? It should be.

You haven't shown your circuit, your components or your code, these are important details we need to see
in case there's something that's easily improved. For instance you might be using Hall sensors with
open-collector outputs and internal pull-ups - not good for a noisy environment.

Thanks for the reply, you've spotted a few things that I hadn't thought of.

It could well be electric interference.

I think I am indeed using Hall sensors with open-collector outputs, these ones: Assemtech 3-Wire Open Collector Hall Effect Sensor switching current 5.2 mA supp PGN-SP-001.

And I'm using internal pull-up resistors, though I've moved the code onto a Raspberry Pi that makes the encoder readings available to the radio/motor control Arduino via a ROS queue. I'm pretty confident the code is OK: I can spin the wheels faster than the motors will ever make them turn and not lose clicks over the course of 100 revolutions.

And my sensor wiring is both unshielded, and running in the same loom as the motor power - so I screwed up there too ! I'll separate them and add shielding just for experimentation, but it sounds like my design is just bad to start with ...

Thanks again,

David

In case it helps anyone in the future ... I got lucky !

I made up a new shielded harness to connect the encoders to the microprocessor, with the shield connected to ground, and the problem has vanished. Now I get nice clean clicks all the time.

I also had a couple of clip-on ferrite ring beads lying around that I wrapped the sensor leads through, though in retrospect, it would make more sense to clip them to the motor power cables ...

Anyway, crisis averted, and thanks for the tips.

David

Internal pullups are very very weak. Better to use 2k2 or 1k external pullups in a noisy environment.

I'll do that, it can only help.

Edit: I did, and it did :slight_smile: The HE sensors generate solid output signals from further away from the magnets with 1k pull-up resistors than without. I'm not sure how to interpret this but the difference is very clear. Without putting a meter on it, I'm guessing that the output signal is stronger/more stable/reliable.

Thanks,

David

The pull-up resistors on a cable are fighting the capactive coupling from nearby wires - for fast pulses capacitive coupling can be very strong (and motors tend to put out some very fast edges especially if not decoupled at the
terminals with 1 to 10nF ceramic capacitors).

If the coupling is strong, you need a low impedance to counter it - basically there is noise current and you want
this to go to ground(*) without making much voltage.

For AC, ground is any supply rail.