HI.
I am building a thing, with an IMU and a radio transceiver telling an Arduino Nano to turn two motors on and off.
The motors are being run at 12v, and pull about 600ma.
They are controlled via a MOSFET - IRF 244N
I have the following circuit (I think only one of the mosfet channels is relevant, you can ignore everything else, see description of problem below )
I have an external power regulator (https://www.amazon.co.uk/dp/B07VNKZN1X?psc=1&ref=ppx_yo2ov_dt_b_product_details) connected to a 12v lead acid battery.
The 12v from the battery only supplies Ext. Supply on the schematic.
5v output from the regulator goes to the V5 pin on the Arduino.
The motors are connected at Ext. 1 and Ext. 2 on the schematic.
I have a 0.1uF cap across the motor terminals (not shown of schematic).
When I run a test program to pulse the motor, all is fine
When I run a test program to gather test data from either the IMU (GMPU-6050) or the radio
(NRF 24L01) all is fine
However , when I pulse the motor and gather data the Arduino freezes up.
I have removed the radio, the second mosfet channel, and the switch to simplify things for debugging.
If I run the "blink without wait" test program to pulse the motor, and progressively include more and more code from a minimal MPU6050 test program everything is fine up until I read from the IMU, at which point there is a probability that the Arduino will freeze up.
Previously I have measured a transient voltage spike as the motor starts up (but not when it stops) across the +5 pin on the Arduino and IMU. I sorted this by adding the 0.1uF cap across the motor.
I have run with the external supply + the USB supply, and the freeze still occurs.
I have cut the 5v supply from the external regulator, and supplied 5v solely from the usb (in addition to the 12v form the battery )and the freeze still occurs.
I have replaced the motor with a low current, none-inductive load, an LED with a 470 resistor, and the Arduino does not freeze up.
I am assuming something funky involving capacitance, filtering, inductiveness, ground loops, transient MOSFET drive currents and backlash magnetic field resonance, quantum effects, and possibly also magic, is going on.
Any advice gratefully received.