Using Ardunio and MOSFET to drive 5V to 12V

Thread Starter

focspike

Joined May 22, 2014
8
Hello,

I am working on a project which involves using an Arduino Mega, and I am trying to use an NMOSFET (BUZ101S) and an NPN BJT(2N3904) to drive the 5V output from the MCU back and forth between 0V and 12V across "SOL".

At the moment, the problem I have is that Vgs always stays high, thus driving SOL on all the time, and I cant figure out why this occurs.

Here is my circuit diagram:

http://i.imgur.com/ls9l9oa.jpg


Any help is appreciated. Thanks!
 

MrChips

Joined Oct 2, 2009
30,824
How much current does the SOL require?

Why do you need the MOSFET?

Place the SOL instead of the BJT collector resistor.
 

Thread Starter

focspike

Joined May 22, 2014
8
How much current does the SOL require?

Why do you need the MOSFET?

Place the SOL instead of the BJT collector resistor.
The SOL requires 300mA of current, and I am using the MOSFET because of the supplies I have available, and I am building a circuit similar to this one:

https://instruct1.cit.cornell.edu/c...06/tj39vls25tmd29/tj39vls25tmd29/circuit2.JPG

As for the replacement of the collector resistor with SOL, would I swap the two components at all? Or just take that resistor out completely?
 

Thread Starter

focspike

Joined May 22, 2014
8
my circuit is not exactly like the one I posted, I replaced the 4N35 optoisolator, with the NPN BJT 2N3904, and replaced the mosfet with my BUZ101. Finally I moved SOL to be attached to source.

In addition I have tried moving SOL to above drain, and I have tried removing the 50k/100k resistors but no luck so far.
 

Potato Pudding

Joined Jun 11, 2010
688
Am I correct that you started with the cornell schematic and modified it to the drawn schematic that you first posted?

What exactly is the difference that you need from the diagram you posted?

Did you only need to change to 12 Volts from 24 volts and attempt a build without the optocoupler? Are you attempting to invert the on an off cycles?

If you just want to know why your hand drawn schematic circuit might not work then I can offer a few suggestions.


An example of P and N type Fets will help and this datasheet is for a device with both in the same IC so that you can look at them both without swapping between two sheets.
To change the location of the Fet relative to the load it would be best practice to use a P-Type when you are switching the Power rail instead of the ground. To use an N-type (indicated by your Source and Drain) you need to have the gate drive from a voltage equal to the Power rail + 5 to 10 Volts depending on the actual Fet. There are several ways to get above the power rails voltage, but I don't expect you would find them very simple. Plus if you can have 20+ volts from gate drive Voltage to the source you are in danger of damaging the gate. That might require protection for the gate.

P-Type will be simpler, but putting your N-type on the ground side of SOL is even better.

Explain more what you want to do with the circuit and we will be able to help you.
 

Thread Starter

focspike

Joined May 22, 2014
8
Am I correct that you started with the cornell schematic and modified it to the drawn schematic that you first posted?

What exactly is the difference that you need from the diagram you posted?

Did you only need to change to 12 Volts from 24 volts and attempt a build without the optocoupler? Are you attempting to invert the on an off cycles?

If you just want to know why your hand drawn schematic circuit might not work then I can offer a few suggestions.


An example of P and N type Fets will help and this datasheet is for a device with both in the same IC so that you can look at them both without swapping between two sheets.
To change the location of the Fet relative to the load it would be best practice to use a P-Type when you are switching the Power rail instead of the ground. To use an N-type (indicated by your Source and Drain) you need to have the gate drive from a voltage equal to the Power rail + 5 to 10 Volts depending on the actual Fet. There are several ways to get above the power rails voltage, but I don't expect you would find them very simple. Plus if you can have 20+ volts from gate drive Voltage to the source you are in danger of damaging the gate. That might require protection for the gate.

P-Type will be simpler, but putting your N-type on the ground side of SOL is even better.

Explain more what you want to do with the circuit and we will be able to help you.

Thank you for your reply.
I believe you have all of the right assumptions, I am basically lacking some materials so I am using an NPN BJT instead of the 4N35. I had some help building the circuit initially so thats why I moved SOL connected to source. I am using a multimeter to measure voltages between Vgs and such but I am not sure what I should be looking for. In addition, the voltage across SOL is remaining at 12V.

SOL requires 12V and at least .3A to operate, which is why I chose this specific NMOSFET
 

t06afre

Joined May 11, 2009
5,934
my circuit is not exactly like the one I posted, I replaced the 4N35 optoisolator, with the NPN BJT 2N3904, and replaced the mosfet with my c. Finally I moved SOL to be attached to source.

In addition I have tried moving SOL to above drain, and I have tried removing the 50k/100k resistors but no luck so far.
Please take a look at the diagram I posted in post #4. But replace the parts with the component you have at hand. Let us consider the two cases
Case 1. Output from Arduino logical 0. The transistor will be in off mode and not conduct. VGS BUZ101S will hence be at ground level and the BUZ101S will be in off mode
Case 2. Output from the Arduino logical 1. The transistor will be fully turned on. It will represent a voltage drop around .1 to 0.2 volt. Hence VGS BUZ101S will be almost 12 volt. And this voltage should turn it fully on
 

Potato Pudding

Joined Jun 11, 2010
688
If you always have 12 Volts across SOL then your FET is probably dead.

Is SOL a relay or Solenoid Valve actuator? Inductors are notorious for killing switching transistors especially if the circuit builder is not conscious of the dangers of inductive switching voltage spikes. Reverse biased fast diodes are always needed across the inductor and or the switching transistors to provide a safe current path for power off.

If not switching relays or solenoids then describe what type of load you are switching.

If you have many spares of the 2N3904 then skip the Fet and use two of them in parallel as the switch, at least as a test build. Burning up a few 10 cent transistors is a reasonable step but if you have other part options then list any that you think might work. For example a 2N2222 would be better than the 2N3904 which is only meant for 100mA. For switching you can cheat at least for testing.
 

Potato Pudding

Joined Jun 11, 2010
688
Note in that diagram you have stated you use 12V instead of 24 and that is a big difference, to your benefit. You would not want to put 24 Volts on the gate of many Fets.
 

Potato Pudding

Joined Jun 11, 2010
688
Sorry but i just took another look at that circuit and I missed something before.

You will never get more than about 4.3 volts on the gate of your FET.

That is the 5V Logic High of the Arduino - 0.7V Base to collector.
 

Thread Starter

focspike

Joined May 22, 2014
8
I see where you are coming from, that makes sense as to why it could not make it to the point which it could trigger the valve.

However, I am not familiar to why this is true, I thought I had the 12V supply to deal with this initially.
 

t06afre

Joined May 11, 2009
5,934
Connect your relay between Drain and +12 volt and Source directly to GND. One thing however your circuit will kind of be an inverter Low level from the Arduino will turn the relay on, and high level off
 

Potato Pudding

Joined Jun 11, 2010
688
The Resistor between the emitter of the BJT and ground will have to pass the current through the transistor in that configuration which is an Emitter Follower.

If you swap the positions of the transistor and resistor so that the resistor is connected from Collector to 12V and the Emitter of the transistor is connected at ground then you will have a Common Emitter which will swing the Collector from 12V to ground based on the Arduino Input.

Your Gate drive is on the Collector Resistor Node.

BUT! Switch the Resistor for something around a quarter watt rated, 330 Ohm (36mA of gate bypass waste current from 12V) so your MOSFET can get its current fast enough to avoid burning out during the transition phase. It will be a very suboptimal drive but if your MOSFET needs a low enough gate charge it will work especially if it is not switching very often. About 5 times a minute or less you should not need to worry.
 

Thread Starter

focspike

Joined May 22, 2014
8
Thanks for the tips thus far,

I am actually not using the BUZ71, rather I am using BUZ101S, but I see that it also has quite a high Id on the datasheet.

I did try to switch the resistor to the top in order to make it a common emitter configuration, but noticed that I only get about 1V across SOL for both CE and EF configurations.
 

Potato Pudding

Joined Jun 11, 2010
688
Keep in mind that for the most part, inverting a drive is very easy to handle in your Arduino code so I don't see any point in even trying to match turn on to the +5 high or 0 Volts low of the pin output.

For an analog output you just inverse map the value before you do your analog write.
 

Thread Starter

focspike

Joined May 22, 2014
8
Thank you for your help!

I realized that my issue was flipping around the power supply..having the negative end on top. This is something I never really considered and ignored through my classes, but either way I did learn quite a bit from you, thanks!
 
Top