# Controlling a MOSFET with a microcontroller

I'm trying to use a p-channel MOSFET (FQP27P06) to multiplex four large common-anode seven-segment displays. I'm using a TPIC6B595 high voltage high current shift register to sink the segments for each digit.

I'd like to use the MOSFET to multiplex and control brightness of the four digits by giving the common anode 18 V.

Here is a simple schematic for driving the MOSFET. My concern is when the MOSFET is 'open' I'm seeing the 18 V on the pin which would be hooked up to the microcontroller.

Is the NPN transistor even necessary?

The second schematic has an extra resistor forming a voltage divider to limit the voltage going to the gate of the MOSFET. I don't think it is necessary with this MOSFET.

I have put the circuit together on a breadboard, but I am hesitant to hook it up to the Arduino.

• Please share the datasheet for TPIC656 (can't find such a part on TI.com). – Anindo Ghosh Aug 15 '13 at 4:06
• @PeterMotesensen please stop making absurdly trivial edits to ancient questions - it just adds noise to the site for no possible benefit at all. – Chris Stratton Sep 28 '17 at 2:58

Correct: The voltage divider will not be necessary with the particular p-channel MOSFET, since its gate-source voltage is rated at +/-25 volts.

The NPN transistor is necessary, because you would not want to expose the Arduino GPIO to 18 volts.

What is even more necessary is a base resistor on the BJT. This is useful to ensure that the base-emitter current does not exceed the recommended operating current of the GPIO pin - 25 mA is my personal preference, and 40 mA is the datasheet maximum rating for the ATmega328. Other microcontrollers used in various Arduino models have different ratings.

Assuming the Arduino being used is a 5 volt model, the base resistor should be sized for 25 mA maximum, thus: R = (5 - 0.7) / 0.025 = 172 ohms, so a 180 ohm resistor between GPIO pin and Q1's base would serve well enough.

One would also want to ensure that the collector current of Q1 does not exceed 200 mA, the rated maximum for the 2N3904. Even with a 100 mA current across R1, the resistor's current dissipation when Q1 is conducting will be an unhealthy 1.8 watts. Hence limiting the collector current to around 10 mA would be best: R1=1.8k, 180 mW power across resistor.

• Sorry about part number. High power shift register. TPIC6B656. Thanks you very much for reply. I must have something backwards on the breadboard, I'm still seeing 18v on the base of the BJT. Is this just a result of a sensitive high impendence DMM? – Travis Mcgee Aug 15 '13 at 12:49
• @TravisMcgee I can't figure out why you are seeing a base voltage equal to the supply voltage - are you sure you have the BJT pins correctly identified? If the supply were feeding the base, then yes, both collector and emitter could show nearly the supply voltage, as the base junction would act as a diode. – Anindo Ghosh Aug 15 '13 at 13:45
• Thanks, removed everything from breadboard and started over. Circui is working as expected. – Travis Mcgee Aug 24 '13 at 0:52
• The NPN transistor is necessary because you would not want to expose the Arduino GPIO to 18 Volts.. This point is explained in greater detail in the video SparkFun According to Pete 3-5-12: Mosfets, starting at 16:16 – hlovdal Feb 22 '15 at 1:15