# Using a MOSFET to generate a particular voltage

So ,i wish to cycle 1.4v and 5v through a sensor for 60seconds each. I have a mosfet STP90NF03L with Vgs(th)=1v (min).I am using arduino's analogWrite(pinnumber,value) to get 1.4 v output.. but i want the current to be at a higher limit then 40mA (arduino can source max 40mA).Is it possible to achieve that using the mosfet with arduino pin output connected to gate of the mosfet ?

• How much current do you need to provide ? you say more than 40mA, but you don't say how much exactly. – dim Jun 2 '16 at 8:38
• 1. How much current do you need from the 5V source and, as dim asked, from the 1.4V source. $\$ 2. What are the tolerances on both voltages at the load? – EM Fields Jun 2 '16 at 10:16
• need around 100-150mA at 1.4v and around 300mA at 5v . – omkar joglekar Jun 2 '16 at 11:27
• Just be aware that the arduino version of an analog output is just a square pwm where the average of this is equal to the analog voltage you want (a multimeter will effectivley average this for you so it won't report the pulsed voltage), but adding a low pass filter will turn the "analog" pwm into a true analog signal. Unless of course your arduino had a dedicated DAC, in which case, disregard this – Sam Jun 3 '16 at 5:38

Since you're already using an arduino, you could use a closed loop control to get rid of all the external components except the mosfet. Basically, you would connect the analogwrite pin to the mosfet gate, and connect an analogin pin to the sensor, then adjust the analogwrite until you get the voltage you want. Of course, you would need to smooth the voltage either before or after the mosfet, depending on what your sensor is.

simulate this circuit – Schematic created using CircuitLab

This will not work quite as well as the opamp circuit suggested in the other answer here, and will require programming, but it means that you dont have to add another IC. If you know that the characteristics of your load and power supply wont change, then you could just find the correct values for 5V and 1.4V and hard code them without feedback.

300mA at 5V means that your load resistance at that voltage can be as low as 15 Ohm. That means the maximum resistance of your mosfet should be around 0.1ohm. The mosfet specified above will actually be fine for that application, although thats actually an n type, whereas the circuit i showed uses a p type. To use that mosfet, all you would do is switch the position of the load and the mosfet.

Edit: Additional filtering on the sensing pin

simulate this circuit

• I am using an MQ7 gas sensor sparkfun.com/datasheets/Sensors/Biometric/MQ-7.pdf – omkar joglekar Jun 2 '16 at 13:40
• That should be ok with this circuit. You might want to add another low pass filter going to the analog in pin, i.e. put a resistor between the analog in pin and the circuit, and put a capacitor between the analog in pin and 0V like in the second circuit – BeB00 Jun 4 '16 at 18:32
• Also When i Output 5v from the analog pin of arduino using (Pinnumber,255) i get only 3.8v out from the mosfet stp90nf03l. any suggestion to correct that ? – omkar joglekar Jun 6 '16 at 6:22
• How is your mosfet connected? The stp90nf03l is an n-channel mosfet, so it should be connected between the load and ground (i.e. the mosfet and the load should switch places in the diagram I've written). – BeB00 Jun 6 '16 at 11:25
• Connections are similar to diagram above , i am measuring voltage between the points where the load is placed (multimeter probes where the load is placed ). IF i measure voltage in between VCC and drain and grounding the source pin then it measures 5V but when i measure in between source and ground it measures 3.8 . Is something wrong with my connections wrt stp90nf03L ? – omkar joglekar Jun 6 '16 at 13:00

Not directly.

One arrangement for getting a higher current at a known voltage uses a follower with a transistor in the feedback loop:

simulate this circuit – Schematic created using CircuitLab

Provided the amplifier can drive the loop (i.e. the output is not in saturation), then the voltage at the load is at the value 'VSET'.

You could use a MOSFET here, but for the N channel device you have specified, the gate would need to be about 5V above the load voltage, so you would need to run the amplifier at V(load) + Vgs + Amplifier saturation.

Note that $V_{gs(th)}$ is specified at 250μA and may be as high as 2.5V. This is a common misconception with MOSFETs, incidentally. To get a decent current, read the $R_{DS(on)}$ line below the $V{gs(on)}$ line:

So if I used the N channel MOSFET you suggest in place of Q1, then the voltage at the gate may need to be as high as 10V, and the amplifier would probably need to be powered from about 12V (for most common amplifiers if it is not a rail to rail output type.

simulate this circuit

If you needed current limiting (I do not know what your sensors are), that would need to be added.

Depending on the current you want to feed to the sensor, you would need to evaluate the heating of the transistor ($P = I_D \cdot V_{DS}$) using the thermal resistance table.

With no heat sink, use the highlighted line.

• Thanks for that detailed reply ! I need this application to be running off 5V itself (its intended to be battery powered) , what could be a probable solution in this case ? – omkar joglekar Jun 2 '16 at 11:24