DC motors pwm causing interrupt to fire.

Following a guide which suggested how to pwm control a DC motor requiring high voltage with this schematic:

my schematic is attached below.
I attached a photo diode to another input with a rising interrupt, that is supposed to cut of the motors when it reads high, this works fine as long as long as the engines are off, the engines and the photo diode share a common ground, though the photo diode is on the low voltage circuit, when the engines are working i get lots of interrupts on the photo diode pin which i believe are caused by the pwm signal getting to the ground or the engines (through an n channel mosfet).

i have tried capping the engines with a 100uf and it didn’t help one bit.

can anyone please help me with this issue?

You should have a common ground for photodiode and motor drive circuit, but you mustn’t
have any ground wiring in common - that means that the Arduino itself is the only place where
the circuits meet (a star-ground arrangement).

That means the ground wire for the 60V supply and MOSFET must not be used for your photodiode,
it should have separate wiring direct from the Arduino.

In an automotive environment there is a vast amount of electrical noise, so you should protect against
interference every step of the way:

Your sensor cables should be shielded and not run alongside high current cabling. Don’t ground the
sensor to its mounting, the sensor should only connect at the Arduino end, and float at the sensor,
otherwise large induced currents could come down that wire.

Your motor wires should be twisted pair as they carry high currents.

Your 60V supply wires should be twisted pair as they carry high currents.

Your 60V supply should be decoupled at the MOSFET switch, so most of the switching noise is confined
to the motor and its wiring only.

Sensor inputs often need RF noise clamping as they come in to the Arduino (a 1nF ceramic to ground perhaps).

Place Arduino in a metal box if its anywhere near the ignition system.


Thanks for your comments,
i went ahead and changed the ground wires are yous suggested and instead of having all the grounds meet close to the batteries, they now meet @ the arduino, this actually helped reduce some of the fase positives i was getting from the interrupt, but on some pwm levels i still get false possessives ( im not creating a specific wave just using analogWrite() for the pwm.

nothing is grounded to shielding only @ the arduino,

Perhaps i failed to mention this since the power sources were in the schematic i included, but this is not in an automotive environment, and im using a 3s 11.1v 2200mah lipo to power the engines and a normal 9v battery for the arduino.

would different pwm waves help? or is the problem just cased because the pwm is causing the engines to rev harder and therefore changing the drain / noise?

any suggestions?

High current motors and their controllers generate loads of interference, you have to defend
against it - did you try the idea of capacitor to ground on the input? Are you able to keep the sensor
well away from the high current wiring? Are you using twisted pair for the high current runs?

Your schematic shows the photodiode connected to an analog input pin, not an interrupt pin?

i tired a 100uf capacitor on the input and to the ground, the sensor is well away from all the high voltage lines, though i couldn't twist the engine wires since the the engine ground comes from a mosfet which is in the opposite direction of where the positive comes from.

Also i think i will try to switch out the mosfet since it might be causing some problems as well (think when i played around with capacitors on the motors i might have given it a big backsurge)

all pins have an internal interrupt (i think its called pin change interrupt ) though all pins share 3 of them so you need additional processing to determine the source.

i couldn't twist the engine wires since the the engine ground comes from a mosfet which is in the opposite direction of where the positive comes from.

Something wrong here - a circuit consist of a circuit - a loop. You aim to keep the area in the loop
as close to zero as you can (otherwise you have a magnetic antenna), by running the current and its
return current in wires side-by-side. Twisting reduces the effective area of the loop even more by
cancelling out magnetism from different parts of the wiring.

If you have a supply wire not running alongside its return (ground) then you have a massive loop
antenna and spectacular (and possibly illegal) levels of interference.

@MarkT, this is all contained within a foot long box, when i say other side, its due to the space limitation of where i can put my mosfet, however moving the low voltage ground away from all the signal wires and caping all 3 engines and the photo diode with small 0.1uf capacitors, the noise the interrupt no longer tigers and the motors stop when needed however, i seem to have made a mistake someplace since i was sure the diode on the single motor would provide motor braking, and it doesn't, it is critical that the motor stop as soon as possible, i thought about using an h bridge driver, but my motors stall is over 10A on 12v so the drivers i found for that application are 100$ plus and way to big, since i don't need reverse i thought about building a half h bridge with two fets however im not sure if can do that since my fet is connected to the negative side

any advice on how i can get the single motor to stop asap?

For active braking you need 2 quadrant drive, not one-quadrant drive, ie you need a half-H-bridge,
not just a single switching device. Something like a BTS960 provides this conveniently in a single