Go Down

### Topic: 4N25 to run small geared motor ? (Read 393 times)previous topic - next topic

#### DaveO

##### Sep 22, 2018, 09:33 am
Can I use a 4N25 optocoupler ( controlled by an Arduino pin with a 390 ohm resistor ) to run a small geared motor without having to add a relay ?

( I don't understand the terms in the spec sheets enough to figure this out )

Motor specs :
Operating Voltage - 3V to 12V DC
Recommended Operating Voltage - 6V to 8V

I will add a diode over the motor terminals as a flyback diode.

Assuming the speed is controlled by the voltage, the voltage range that will be applied to the motor will be 3V to 9V ( 9V being same used for Arduino power ).

The motor spec says 3V 70mA.
Would the mA increase or decrease when the voltage is changed ?

the 4N25 opto is listing specs as :
Input Forward Voltage IF = 10mA   1.18 - 1.50 V

So I am understanding the Arduino output pin being 5V, 4N25 forward voltage 1.4V and 10mA would need a current limiting resistor ( between Arduino pin and Opto ) of 390 ohms.

This should saturate the transistor in the 4N25 fully.

So what current can the output side of the 4N25 safely manage, and what current would this motor ( variable voltage ) be pulling ?

I also have 2N3904 transistors if they would be better suited.

#### Paul__B

#1
##### Sep 22, 2018, 09:54 amLast Edit: Sep 22, 2018, 10:06 am by Paul__B Reason: Added detail
Can I use a 4N25 optocoupler ( controlled by an Arduino pin with a 390 ohm resistor ) to run a small geared motor without having to add a relay ?
Yes, you need a transistor or - better - a logic level FET to do the actual switching of the motor current.

Motor specs :
Operating Voltage - 3V to 12V DC
Recommended Operating Voltage - 6V to 8V
At 70 mA ...

I will add a diode over the motor terminals as a flyback diode.
Good.

Assuming the speed is controlled by the voltage, the voltage range that will be applied to the motor will be 3V to 9V ( 9V being same used for Arduino power ).
Well, the motor is either switched on, or off, so if it is 9 V, it is 9 V then.

The motor spec says 3V 70mA.
Would the mA increase or decrease when the voltage is changed ?
Yes, massively increase.  More than in proportion to the voltage

the 4N25 opto is listing specs as :
Input Forward Voltage IF = 10mA   1.18 - 1.50 V

So I am understanding the Arduino output pin being 5V, 4N25 forward voltage 1.4V and 10mA would need a current limiting resistor ( between Arduino pin and Opto ) of 390 ohms.
Yes.

This should saturate the transistor in the 4N25 fully.
Only if the load is limited to require no more than 4 mA at most from the optocoupler, since its CTR is only rated to something between 20 and 50%.

So what current can the output side of the 4N25 safely manage, and what current would this motor ( variable voltage ) be pulling ?
Up to about 20 ma, and about 1 A for the motor.

I also have 2N3904 transistors if they would be better suited.
Looking that up ...

No, absolute maximum current 200 mA.  No use at all.  You need a logic level FET rated for at least 2 A.

#### Grumpy_Mike

#2
##### Sep 22, 2018, 09:55 amLast Edit: Sep 22, 2018, 09:59 am by Grumpy_Mike
Quote
The motor spec says 3V 70mA.
So that is the same as your opto coupler output maximum so the answer is no you cannot run that motor with that opto.

Quote
Would the mA increase or decrease when the voltage is changed
Yes, basic ohms law, more voltage gives more current. But unlike ohms law it is not proportional.

#### DaveO

#3
##### Sep 22, 2018, 10:11 am
Sincere Thanks to Paul__B and Grumpy_Mike.

Maybe we are better off using the 2N3904 to switch a 5V relay ( with the motor connected thru the relay ) and that way I don't need be concerned if the user changes to a different motor.

The project is to help one of our local Scouts who is building a quail egg incubator and is making a mechanism to rotate the eggs.

So if the geared motor turns out to be too weak, we may need to add a stronger motor with different specs - having a relay would mean not having to change any of the electronics controlled by the Arduino.

#### Paul__B

#4
##### Sep 22, 2018, 10:22 am
Or just use a logic level power FET -  IRL540 comes to mind for up to about 4 A or so, there are (much) better ones for more power.

#### DaveO

#5
##### Sep 22, 2018, 10:56 am
Or just use a logic level power FET -  IRL540 comes to mind for up to about 4 A or so, there are (much) better ones for more power.

I can source the IRL540 locally.  Can I control that directly from an Arduino output pin, or should it have a transistor or current limiting resistor ?

#### Paul__B

#6
##### Sep 22, 2018, 12:02 pm
I can source the IRL540 locally.  Can I control that directly from an Arduino output pin, or should it have a transistor or current limiting resistor ?
It can be; you will want a 47k pull-down on the Arduino pin simply to keep the FET off while you are booting, and if you use PWM to control the motor speed, you should have a 220 Ohm resistor between the pin and the gate of the FET.

It goes without saying the supply negative will be common to the Arduino ground and the FET source.

#### DaveO

#7
##### Sep 22, 2018, 01:15 pm
It can be; you will want a 47k pull-down on the Arduino pin simply to keep the FET off while you are booting, and if you use PWM to control the motor speed, you should have a 220 Ohm resistor between the pin and the gate of the FET.

It goes without saying the supply negative will be common to the Arduino ground and the FET source.
I have 100K so I assume that would also do as a pull down resistor.

I can add the 220 ohm between pin and gate even if it is only being used on a on/off situation as well, I assume.

Thanks for the guidance Paul__B

#### Paul__B

#8
##### Sep 22, 2018, 05:30 pm
I have 100K so I assume that would also do as a pull down resistor.
Fine.

I can add the 220 ohm between pin and gate even if it is only being used on a on/off situation as well, I assume.
Indeed.  You do have an IRL540 and not an IRF540 I trust.

#### DaveO

#9
##### Sep 22, 2018, 06:43 pm
Drat. just found out the locally available ones are MOSFET Switch Module IRF520

Does that substantially change the circuit for this ?

#### DaveO

#10
##### Sep 22, 2018, 06:56 pm
https://arduinodiy.wordpress.com/2012/05/02/using-mosfets-with-ttl-levels/

and think I understand now that at 5V from the Arduino output pin, the IRF520 will not switch on fully.

I would need to add the 2N3904 transistor to the pin, and have that control a higher voltage ( like the 9V from the power supply ) to the IRF520 to ensure that it switches on fully.

This would invert the status of the IRF520 so Arduino pin High = Load off,  and Arduino Pin LOW = Load on.

#### Grumpy_Mike

#11
##### Sep 22, 2018, 07:54 pm
Quote
like the 9V from the power supply ) to the IRF520 to ensure that it switches on fully.
Well the data sheet says you must have 10V to fully turn on the FET.

Quote
This would invert the status of the IRF520 so Arduino pin High = Load off,  and Arduino Pin LOW = Load on.
Is this a problem? If it is then just define some constants
Code: [Select]
`#define MOTOR_ON 0#define MOTOR_OFF 1`
So you just write
Code: [Select]
`digitalWrite(pin, MOTOR_ON);`
That is even clearer than HIGH and LOW

#### Paul__B

#12
##### Sep 23, 2018, 12:09 am
Drat. just found out the locally available ones are MOSFET Switch Module IRF520
I figured it would be.    That's what happens on this forum, the same thing appears time after time.

That's quite a good article - except where it isn't of course - and that diagram useful.  Duly bookmarked.

Is this a problem? If it is then just define some constants
It is a problem because during boot-up of your system, the transistor is switched off, and the pull-up resistor on its collector turns the FET and the motor ON.  That may be a problem.

To counter this (unless it is convenient to ignore it), you need to have a pull-up resistor of similar value or slightly less that the resistor in series with the 2N3904 base, at the Arduino pin to turn the transistor on until the Arduino is initialised, and the initialisation sequence must be to set the respective pin HIGH before setting pinMode to OUTPUT.

#### wvmarle

#13
##### Sep 23, 2018, 03:56 pm
I see a potential problem with that circuit when applying PWM.

The switching off of the MOSFET will be quite fast as the gate is drained through the transistor, but the 10k resistor makes the switching on quite slow. The bigger the MOSFET (as in: the more power it can deliver) the slower that becomes, and that may result in heat, lots of it, as the MOSFET is longer in half-open, high-resistance state.

Really the best thing to do is to find a proper logic level MOSFET (the IRLZ44N is a nice one as well). Ask your local supplier for suggestions of what they have in stock, or order online (RS is a good one, but you can also try sites like eBay, Amazon, Aliexpress or Element14).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

#### Paul__B

#14
##### Sep 23, 2018, 11:50 pm
I figured that while he did make a reference to the speed being controlled by voltage - which it is - he was also prepared to use a relay and thus was not proposing to implement variable speed control, in which case switching speed is critical.

Of course, we may surmise that he just might later decide that there is some need to alter the rotation speed of quail eggs, however absurd that is.

Go Up