# Eliminating motor noise with hall effect sensor?

I'm trying to build an indexing system for a model railway turntable. I want to use a hall effect sensor as a tachometer for a gear, and control the motor with an Arduino and an H bridge. I have a cheap H bridge motor driver board from Ebay and an Arduino Uno and a latching hall effect sensor from Sparkfun. With the turntable motor I have to use, I am getting tons of electrical noise. It is triggering the interrupts on the Arduino any time it's on. What can I do to reduce this?

Edit:

Here is the schematic for the hall effect sensor portion of the circuit. Sensor Datasheet

simulate this circuit – Schematic created using CircuitLab

I'm using a motor driver board, not the official Arduino motor shield, to drive the motor. It doesn't have a data sheet to my knowledge but here is an Amazon link.

The motor I am using is an Atlas HO turntable motor, and according to the part number on the side, I found this data sheet. [It won't let me post a link because of my reputation being less than 10. The motor is an FK-280PA.]

• First thing you can do is post schematics (use the tool while editing your question), second thing is post links to the exact datasheets of the items you are talking about, if not possible in the question, then use a comment. Mar 24, 2016 at 2:03

A cheap experiment might be to add some capacitance to the signal wire. Doesn't matter if it goes to +5V or GND; it'll work the same either way.

Cutoff frequency = 1 / (2 * pi * R * C) where C is in Farads, R is in Ohms (10k as drawn at the moment), pi is 3.14159..., and the frequency is in Hertz (events per second). Remember to keep the SI prefixes straight.

Keep a comfortable margin between the cutoff and your maximum expected frequency of teeth going by, and it should reject at least some of the motor noise that falls above that.

You'll also want to make sure that you're using a Schmitt Trigger somewhere between this filter and the interrupt, either built into the chip or an external schmitt inverter or something similar that requires a big change in input to actually change state and isn't just an analog amp with ridiculous gain. Because you can't get rid of all the noise, the latter will still give you a bunch of interrupts as the signal transitions from high to low or vice versa; the former will wait for a more solid high or low before switching, which should reduce the number of transitions per tooth.

If you can get a reliable non-count between teeth and still see every tooth, but can't get exactly one count per tooth, then you'll have to do some debouncing in software. The two ways that I like to do it are:

1. Periodically read the pin regardless of activity, slowly enough to miss the bouncing but fast enough to still be responsive.
2. Use a timer to ignore all transitions that are too close to the last one. You'll still interrupt on all of them, but do nothing if it hasn't been long enough yet.

#1 works well for user interfaces, but I think #2 might be better for your situation.

The FK-280PA is a carbon-brushed DC motor which has a stall current of 3.25A at 12V. Provided that it has rf suppression capacitors installed (~0.1uF between terminals or from each terminal to the case) it shouldn't produce much interference.

The most likely reasons for picking up interference are a 'ground loop' (motor current going through the sensor ground wire), or current/voltage induced into the sensor wires.

You should run separate ground wires for the motor driver and sensor. Motor driver Ground should be wired directly to the power supply with a short thick wire. Sensor Ground should go to the Arduino's Ground. That way the sensor signal won't be affected by the relatively high motor current.

Check for induction by moving the sensor and its wiring away from the motor wires. You can reduce induced current by twisting the sensor wires and keeping them some distance from the motor wires. Capacitive (voltage) coupling can be reduced by using a shielded cable, with the shield connected to the Ground wire at one end.

Another possibility - if you are running everything from the same power supply - is that it can't handle the full motor current and is causing the supply voltage to drop out momentarily. To fix it get a better power supply, and/or put a large filter capacitor (eg. 1,000uF) across the power input terminals of the motor driver.

Or it may be that you have the sensor wired up wrong. The recommended circuit shows a 100nF capacitor from Vdd to Vss, and a 4.7nF capacitor from OUT to Vss. Did you include those, and have you checked that the pin numbers are correct?

• I think part of my issue may be a ground loop. The motor driver (see the Amazon link) has a 5v, 12v, and GND screw terminal, and if you're using over 12v you remove a jumper and plug up a separate 5v supply. I had both the motor power supply ground and the Arduino ground connected to the GND terminal (I was using the Arduino's 5v pin as the 5v supply) so would that have caused problems? Mar 24, 2016 at 3:58
• What voltage are you using and where is it coming from? How is the Arduino powered? Mar 24, 2016 at 15:53
• I'm using a 13.8v 19a PSU from RadioShack (its already being used for other things, so I was just going to run everything I could from that one PSU) and the Arduino gets 5v power from USB. I suppose it could be an issue with the USB 5v power. Mar 24, 2016 at 16:16
• If the 13.8V ground and Arduino/USB ground are joined only at the driver board then it should be OK. You can disconnect the Arduino 5V from the driver board and enable the board's 5V regulator (should be OK at 13.8V provided you don't use it to power external devices). What happens if you disconnect the hall sensor wires from the Arduino and pull pin 2 up with a 10k resistor? Mar 24, 2016 at 16:40