Arduino MEGA bug after a digitalWrite

Hello,

I'm controlling with 2 MOSFET my 24V source to power 2 motors as you can see attached.

When I do a digitalWrite(HIGH) it works fine ...

But then the digitalWrite(LOW) make the whole project bug ....

I have define the 2 pins ( 7 and 2 on the schema ) on OUTPUT

This drive me crazy !

It's because the two mass sources aren't linked ?



I don't see any back-emf diodes across the motors.
That could cause problems, and even destroy the mosfets.

See this page, first diagram.
Leo..

What motors? What MOSFETs? Where is your code?

What does "make the whole project bug" mean in terms of what actually happens?

Steve

Seba999:
I'm controlling with 2 MOSFET my 24V source to power 2 motors as you can see attached.

Must learn to crawl before learning to walk. Start with 1 motor to begin with, instead of 2. And show us which tutorial site taught you to wire the motors up in this particular way..... with no diodes. Also, never assume that the readers here are clairvoyant..... so when you mention 'bug', you must describe what you see.

Sorry, you haven't explained what is going wrong.

You certainly require diodes across the motors, and you should give full info on
power supply, motors, MOSFETs...

Hi,
Welcome to the forum.

Can you please post a copy of your circuit in a hand drawn circuit in jpg, png?

Please include what your power supply is?
What your MOSFETs are?
What value your gate to source resistor is?

Thanks.. Tom... :slight_smile:

Hmmm sorry If I haven't give enough infos ^^'

I don't really have much information about my motors, basically it's the motors of thoses perilstatic pumps ( the 24V ones )

And I'm using MOSFET FQP30N06L

My source is a 24V DC comming from a 220V transformer(?) ( not sur about how to say it in english )

I can't give you my code right now ( I'm at work ) but I'll do it if needed (anyways it's kinda a large code IMO)

I've read a bit about the

Wawa:
back-emf diodes across the motors.

HERE (easy and good infos IMO)

So I must add diodes between the input and output of the motor ? For each motor ?

How could this possibly make my arduino buggy ? I mean all the wires involved in the motors actions are configured as output by pinMode ( so they shouldn't interfer with my code no ? ^^ )

And which diode should I use ? All of them should work ? Does LED may do the tricks ? ( with pros and cons ? )

Thanks :slight_smile:

Hi,

This may help, they use a NPN transistor, but the basic explanation about the diode is still valid.

and,

Can you tell us what is the value of the gate to source resistor in your circuit?

Tom... :slight_smile:

If I remember well Rgs = 100 Ohms ... Or maybe 1K Ohms ? ( I should verify )

Adding a diode should do the trick to stop the flow back current ? And thus avoid the undesired behaviour ?

As far as I know a LED is light-emitting DIODE so they would do the trick ? ... I ask this because I don't have any diode from now on ^^ ( even if it shouldn't be the most expensive thing to buy :stuck_out_tongue: )

As far as I know a LED is light-emitting DIODE so they would do the trick ?

Yes they are and no they would not do the trick.

With the "Z-Wave Generic Dimmer" driver:

Grumpy_Mike is correct.

The reason is that LED diodes are not designed to withstand much reverse voltage. Many are rated at 10 V
MAXIMUM. In your circuit you will be exposing the diode to 24V each time the motor is on.

Seba999:
]HERE (easy and good infos IMO)[/url]

So I must add diodes between the input and output of the motor ? For each motor ?

Always for every motor, relay, solenoid, anything inductive. Cathode to positive supply.

How could this possibly make my arduino buggy ?

Because of the high voltage spikes flying about if you don't use them - can cause substantial
interference to low voltage signals.

The diode just needs to handle the voltage of the supply, and be pulse current rated for the current
through the load. Any diode type will work, its not critical, unless using fast PWM.

Seba999:
If I remember well Rgs = 100 Ohms ... Or maybe 1K Ohms ? ( I should verify )

Change Rgs to 10K, 100R is too low, you only want to make sure the gate is at source potential if the gate circuit is open circuit.
100R will be drawing excessive current from the controller, 5 / 100 = 50mA, the outputs are only rated to 40mA.
Also fit the 220R resistor in series with the gate.
Thanks.. Tom.... :slight_smile:

MarkT:
Always for every motor, relay, solenoid, anything inductive.

Why thoses diodes aren't included in the motor itself ? I mean if this is mandatory why it's not soldered inside it already ? O.o

TomGeorge:
100R will be drawing excessive current from the controller, 5 / 100 = 50mA

Considering your calculation if I have 1KOhms Resistor it would fit ? isn't it ?

I just looked back to my circuit (already soldered of course) and ... I must have been drunk while doing it 'cause I have 1KOhms AND 10KOhms resistors !! God damn it !

Does it changes something to have some with 1K and others with 10K ?

Does thoses diode will make it then ? :slight_smile:

Here's a picture of the "motors controlling part" already soldered ( Yes, I know I told you there was 2 motors but there's 6 actually ^^' )

In a DC circuit, where the polarity driving the inductive load does not change:
“Always for every motor, relay, solenoid, anything inductive. Cathode to positive supply.”

A 1N4xxx should work but the 1N5xxx works too.

Posting images:
https://forum.arduino.cc/index.php?topic=519037.0

R2 could be 1k or 10k, but 1k would sink ~5mA where 10k would sink 500μA.

.

Why thoses diodes aren't included in the motor itself ? I mean if this is mandatory why it's not soldered inside it already ?

Because:-

  1. A motor with a built in diode can only rotate in one direction, that direction is controlled by the way round the diode is.
  2. A motor may be required to turn in either direction and then the diodes need wiring differently.
  3. Some relays do indeed have diodes incorporated in them but these are not so common.
  1. The inductance of the wires from the switch to the motor may be significant. The diode must be close to the switch so that current can continue to flow around the wires when the switch (transistor Q1 in this diagram) switches.

This would be very rare so it is not usually a problem to solder the diode directly to the back of the motor, once you've worked out which polarity spins it the direction you want.

thanks all for all thoses informations :slight_smile:

Indeed I didn't think about the direction of the rotation :stuck_out_tongue:

I'll try to keep you informed about my project but I don't work on it very often ...

Thanks again !