Go Down

Topic: help connecting Arduino UNO to n-ch MOSFET via Optocoupler (Read 8614 times) previous topic - next topic

Terraviper-5

Hi!

I am trying to control a solenoid with Arduino Uno. I want it to go through an optocoupler with darlington driver just in case something goes wrong. Before I try it with solenoid, I wanted to see if everything works with a LED. So I first connected it the same way as in image below, just without the MOSFET (optocoupler acted as transistor, since there isn't so much current) and it worked. Then I tried it with just the MOSFET and without the optocoupler, and again it worked. Then I tried the configuration in the image, and it didnt work. Sometimes the led was on, sometimes off, nothing like Arduino was telling it to do. My guess is that optocoupler doesnt have enough power to turn on the MOSFET, but I really need some help from more experienced users to really identify the problem. Thank you for your time!

Image: https://www.dropbox.com/s/s9jxmo9yb9ae98r/test%20sketches_bb.png

Datasheets:
https://www.dropbox.com/s/3osm1rfnk05ezbn/irlb8721pbf.pdf
https://www.dropbox.com/s/1q9g79o092lpf1b/LTV-8x6.pdf

Grumpy_Mike

The transistor in an opto coupler can only pull down, so there is nothing to supply the voltage to the FETs gate.
You can put a pull up resistor on the gate of the FET to the positive supply.
Alternatively you can put the transistor of the opto between the +ve and the gate and pull down the gate to ground.

Terraviper-5

#2
Oct 28, 2012, 07:26 pm Last Edit: Oct 28, 2012, 07:56 pm by Terraviper-5 Reason: 1
Please excuse my n00bishness, but wont the power from the supply be too much for the gate of the FET? When using solenoid it will be 15V+. Or will the FET take it?


The transistor in an opto coupler can only pull down, so there is nothing to supply the voltage to the FETs gate.


But how come it worked for led? If it pulls down, shouldnt the led then be on when its supposed to be off and off when its supposed to be on?

Edit: Ok, I found this image
But I dont understand how optocoupler will survive the high voltage.

Runaway Pancake

Just wanted to say that's probably going to be OK, but others just looking at it need to know that VG will be about 1/3 of supply: (680?/1680?) * 24V = 9.7V
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Terraviper-5

Oh my, I didnt know that optocoupler is going to complicate things so much.

dhenry

Put the opto-coupler where R3 is, and parallel it with a zener (or a Esaki diode).


Runaway Pancake

T-5,
You're OK there, I was just doing a little explaining for others that R2 and R3 make a voltage divider when the opto output turns on.
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Grumpy_Mike

Quote
but wont the power from the supply be too much for the gate of the FET?

What does the data sheet say the maximum gate voltage is?

Quote
But how come it worked for led?

Because you were pulling current through the transistor not outputting a voltage.

Quote
Ok, I found this image
I dont understand how optocoupler will survive the high voltage.

Look at the data sheet for the opto, but 24V is not a very high voltage for a transistor.

Quote
Put the opto-coupler where R3 is, and parallel it with a zener (or a Esaki diode).

Don't, our dear henry specializes in trying to confuse beginners, it makes him happy.

Terraviper-5


Quote
but wont the power from the supply be too much for the gate of the FET?

What does the data sheet say the maximum gate voltage is?

Quote
But how come it worked for led?

Because you were pulling current through the transistor not outputting a voltage.

Quote
Ok, I found this image
I dont understand how optocoupler will survive the high voltage.

Look at the data sheet for the opto, but 24V is not a very high voltage for a transistor.

Quote
Put the opto-coupler where R3 is, and parallel it with a zener (or a Esaki diode).

Don't, our dear henry specializes in trying to confuse beginners, it makes him happy.

I think its 20V, but I might be looking at a wrong thing.

Oh, that makes sense. Sorry for my beginner stupidities.

It says: Vemittercollector = 6, Vcollectoremmiter = 80 (if again im looking at the right thing). Its says thats absolute maximum.

I have schottky diodes, so Id rather try some other configuration than this anyway.

jwatte

#9
Oct 28, 2012, 09:45 pm Last Edit: Oct 29, 2012, 03:58 am by jwatte Reason: 1
If it has emitter and collector, it is not a MOSFET, it's a BJT (a k a "70's transistor.")

BJTs let current through between collector and emitter when there is also a current (the right way) through the base. This means that there will always be current flowing through the base in addition to the switched current when it is on. This make it easy to switch them on and off with a single switch -- current flows, transistor on; current interrupted, transistor off.

MOSFETS let the current through one way ("body diode" direction) always, with some body diode resistance. However, when you charge the gate capacitor (meaning apply a voltage and a short spike of current) they will conduct equally well in both directions. When wired with the controlled voltage against the body diode (normal,) this means they are "off" when the gate voltage is low, and "on" when the gate voltage is high. This actually saves power, because there is no "wasted" current through the gate, other than when switching state.

However, this also makes a MOSFET annoying to switch, because you need to actively pull it UP (charge) when turning on, and DOWN (discharge) when turning off. (This is for N-channel; P-channel is approximately inverse.) Thus, a simple make-or-break switch won't work, unless you replace one of the "pull" directions with a resistor. The output of the Arduino is already switched both ways -- it either ties to VCC, or to ground, so it can drive a gate directly. The output of an optocoupler is not, though, hence this confusion.

For a MOSFET, the allowable voltage from source to gate (what controls the built-in gate capacitor) is different from the allowable voltage from source to drain (the controlled voltage.) A typical low-voltage device might allow 20V from source (0-reference) to gate, and 30 volts from source (0-reference) to drain. (IRLB8721 for example -- popular 30V D/S device with 4.5V recommended gate voltage and 20V max G?S voltage) Here's an example data sheet showing those voltages:
http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDEQFjAA&url=http%3A%2F%2Fwww.adafruit.com%2Fdatasheets%2Firlb8721pbf.pdf&ei=IZiNUKaZM8LtiwKghYHADA&usg=AFQjCNGUrxQ2jGVS0ZaY7Mic2FOCkETjEQ


Terraviper-5


If it has emitter and collector, it is not a MOSFET, it's a BJT (a k a "70's transistor.")

BJTs let current through between collector and emitter when there is also a current (the right way) through the base. This means that there will always be current flowing through the base in addition to the switched current when it is on.

MOSFETS let the current through one way ("body diode" direction) always, with some body diode resistance. However, when you charge the gate capacitor (meaning apply a voltage and a short spike of current) they will conduct equally well in both directions. When wired with the controlled voltage against the body diode (normal,) this means they are "off" when the gate voltage is low, and "on" when the gate voltage is high.

For a MOSFET, the allowable voltage from source to gate (what controls the built-in gate capacitor) is different from the allowable voltage from source to drain (the controlled voltage.) A typical low-voltage device might allow 20V from source (0-reference) to gate, and 30 volts from source (0-reference) to drain. (IRLB8721 for example -- popular 30V D/S device with 4.5V recommended gate voltage and 20V max G?S voltage) Here's an example data sheet showing those voltages:
http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDEQFjAA&url=http%3A%2F%2Fwww.adafruit.com%2Fdatasheets%2Firlb8721pbf.pdf&ei=IZiNUKaZM8LtiwKghYHADA&usg=AFQjCNGUrxQ2jGVS0ZaY7Mic2FOCkETjEQ




Thank you for explanation. The optocoupler has collector and emitter, so it must be the BJT type.

Grumpy_Mike

Quote
It says: Vemittercollector = 6, Vcollectoremmiter = 80 (if again im looking at the right thing). Its says thats absolute maximum.

The first bit is the negative voltage limit so the emitter should not be more than 6V above the collector, you only get this if you wire it up the wrong way.
The collector emitter voltage is the maximum you can have so 24V is well within the limit in the circuit you want to use it in.

jwatte


Thank you for explanation. The optocoupler has collector and emitter, so it must be the BJT type.


Yeah, I don't know of any MOSFET optocouplers (a MOSFET light transistor?) I thought you meant the data sheet for the transistor you're trying to switch. You have to make sure you don't break that device, too :-)
If the opto-coupler can't take the voltage, a Zener and a resistor can fix that in a pinch.

Grumpy_Mike

Quote
I don't know of any MOSFET optocouplers

Yes you can get opto couplers with FET outputs as well as couplers with SCR and Triac outputs. Do a search in any major distribuitors.

dhenry

Quote
so it must be the BJT type.


All opticouplers are of bjt type: as a minority carrier device, bjts are a lot more sensitive to light than a majority carrier device (mosfet for example).

Go Up