Arduino Stops working when switching mosfet under load

Hey Ive got a strange problem. Ive made a homebrew Motor controller that basically consists of a mosfet that switches a relais these both power the motor. When I turn it on without anything attached to it it works just fine and theres voltage at the output but if i connect a load to the circuit output, the arduino just stops switching. There isnt any voltage on the pin and it doesnt start working again until I reconnect the power supply. Im using an Arduino Nano heres my code. Help is greatly appreciated.

void setup() {
pinMode(12,OUTPUT); //individual pins of the 2channel motorcontroller
pinMode(11,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
digitalWrite(12,HIGH);

}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(12,HIGH);
delay(2000);
digitalWrite(12,LOW);

delay(2000);

}

I think if you supplied at least a rude schematic and some specifications (which MOSFET? resistor values? etc.) you may be less likely to be insulted by a crusty old-timer and more likely to get a useful response.

Ok Im using a IRL234N with a pulldown resistor. The diagramm shows half a channel there is just 2 of those things for each channel and four for the whole controller.

Motord.png

Motord.png

Add a kickback diode across the relay coil similar to K1 in attached cct. see D5.
See R13 and R12 connections to the transistor’s gate.

Thanks for the help.
Ive soldered a LED between the drain of the mossfet and the 9V side of the spool but ive still got the same issues.

You need a ‘diode’ (not a LED) across the inductive load.

A 1N4001 thru 1N4007 will work.

Show us a ‘good’ image of your wiring.

Posting images:

Im sorry I meant Diode. Ok but brace yourself it aint pretty. This is just a prototype

You are correct, not pretty.

Okay, it’s up to you to confirm the wiring as the image is unless.

BTW, your drawing shown in my post #3 is not correct.
Compare it to my drawing for K1.

Yes I know. But its not the overall concept because Ive tried it before and have built a couple of projects with this circuit. I think maybe because of the relais they need a higher voltage to switch than usual.

You have not given any details on the relay.

Is the 9v sagging?

How is the controller powered?

Are GNDs connected?

Your labeling of the output is confusing.

We need to see a ‘good’ and exact circuit schematic of your project.

The power supply is fine its powered by a Lab bench power supply.
The arduino is powered by an L7806 voltage regulator.
Everything has a common ground.
I know the concept works because Ive tried it before. I think just need a way how to decouple the transistor from the Relais in a way where it isnt affected by the induction that occurs when it is under load. Is that even possible?

“The arduino is powered by an L7806 voltage regulator.”
6v is not appropriate for the Arduino.

“I know the concept works because Ive tried it before.”
Well, this implies your current circuit is not the same as the circuit you tested.

Others similar circuits work well, yours does not.
Your current circuit must be at fault if your previous circuit worked well.

Make sure your GNDs are in star configuration.

“We need to see a 'good' and exact circuit schematic of your project.“

Hi,
You all should be shot;
Look at the diagram;
9e1f163445ee5e7aa1959163c85fd126004d0290.png
How is that circuit supposed to work?
With no load the relay will work.
Add a load and the load current will flow through the contacts AND Q1!!!

Suggested edit;
Motordedit.jpg

Thanks… Tom… :slight_smile:

“You all should be shot;” . . .
“How is that circuit supposed to work?
With no load the relay will work.
Add a load and the load current will flow through the contacts AND Q1!!!!!”

Said the cct. was wrong back in #7.
“BTW, your drawing shown in my post #3 is not correct.
Compare it to my drawing for K1.”

Hi,
The Op is taking notice but not seeing the cause if his/her problem as we keep pointing out.
So hopefully editing the diagram he/she seems to understand, may be “clearer”.

A nice picture of a hand drawn, complete diagram would be the best solution.
The diagram being drawn by reverse engineering what to OP has constructed, please.

Tom… :slight_smile:

So hopefully editing the diagram he/she seems to understand, may be "clearer".

Yes.

The first thing often omitted is starting with a 'good' schematic. :sob:

Hey you guys
I thank you for your help. And yes your right id probably deserve to get shot. :sweat_smile: Because the problem was just rushing and not thinking about it and an absolute shit solder job. What I basically did was just redo the whole thing because it looked absolutely abysmal. Also I added a few diodes on the outputs because there was a short there I didnt see when I planned the thing. Who would have known if you do shit properly it actually works…

Schematic_New-Project_Sheet-1_20181213150739.pdf (111 KB)

Hi,
Can you tell us exactly what you are trying to do with two motors and four relays?

Just turn 2 motors ON and OFF with braking effect, or trying to get FWD/REV/STOP.

If just ON/OFF you only need one relay for each motor, and you still have the relays wired wrong, the diodes should be across the relay coils.

Thanks.. Tom.... :slight_smile: