First time MOSFET user -, Arduino freezes

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 :slight_smile:

When I run a test program to gather test data from either the IMU (GMPU-6050) or the radio
(NRF 24L01) all is fine :slight_smile:

However :frowning: , 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.

If You cut away the failing tests made earlier Your post will be more interesting and easier to read. The history of Your life is no help, only confuses.

  • Does the transistor saturate ?

  • This MOSFET is inappropriate as it is not logic level.

1 Like

5v at 100 ohms is 50Ma. 33Ma at 3.3 volts. Either is too high. Try 1k's instead.

image

The 3.3V radio cannot tolerate 5V on the SPI connections.
The 3.3V MPU-6050 cannot tolerate 5V on the I2C connections. The schematic does not show the required pullup resistors on the I2C lines.

You need logic level converters to use 3.3V modules with 5V MCUs.

1 Like

DOH, I swear I checked what MOSFETs to use several times before ordering them. I think I got confused between IRLZ44N and IRFZ44N.

I will replace the MOSFETs and retest.

The NRF24L01 module I am using states that it's logic pins are 5v tolerant.

I'm confused about the mpu-6050 needing logic level shifting, all the tutorials I've seen have it connected directly to the Nano, e.g.

The pull ups on the i2c lines, none of the tutorials I have seen show these , and without them I can get connected to the mpu-6050 , how are we getting away with this?

Which one exactly did you buy?

The mpu-6050 is this one https://www.amazon.co.uk/gp/aw/d/B09M6KC11Z?psc=1&ref=ppx_pop_mob_b_asin_title

The Nano I2C pins are 3.3v I believe so I think you're okay. I still think you need to take a look at the resistance values you have going to your mosfet gates though.

These are your words:

They are controlled via a MOSFET - IRF 244N

Your schematic shows otherwise :face_with_spiral_eyes: .

Yes, I thought I'd ordered IRLZ44 , but had actually ordered , and installed IRFZ44 , then got confused about which one was right.

If the MOSFET saturates, you are okay, if not, you need a good logic level MOSFET.

You are looking at tutorials posted by people who have no idea what they are doing.

That often works for a while, but it will eventually destroy one or the other of the connected modules. People who do know what they are doing would never connect 5V and 3.3V modules without using a logic level shifter.

without them I can get connected to the mpu-6050 , how are we getting away with this?

The Wire library activates the weak (30K) internal pullup resistors on the I2C lines. Those sometimes work OK. The industry standard calls for 2.2K to 4.7K pullups.

Ok, to sort this all out then:

  1. Swap MOSFETs for logic level ones (I've found some IRLZ34N)
  2. Add pull up resistors to the I2C lines, something between 2.2k and 4.7k (I've got some 3.9k )
  3. Add a logic level converter to drop the 5v logic from the nano to 3.3v for the IMU.

Anything else wrong?

What is the motor's starting/stall current? Is the 12V ground connected to Arduino GND? Can that power supply provide the current for 2 motors starting at the same time?

External regulator can supply sufficient current for both motors, all grounds are common. I don't think this is the problem.

Thanks for the advice so far.

I've replaced the IRFZ44N MOSFETs with IRLZ34N - which I believe are logic level.

I've put a bidirectional level shifter between the Arduino Nano and the MPU-6050, and I'm powering it of the 3.3v Arduino pin.

The freeze still occurs :cry:

Motor control is fine, MPU-6050 interfacing is fine, but do them together and the Arduino freezes up.

Any suggestions how I go about isolating the cause of this?

Hi,
Can you please post some images of your project?
So we can see your component layout.

Does the 650 breakout board have pullup resistors on the I2C bus wires?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia: