Teensy 4.1 Swiching 5V with 3.3V pin. Transistor ?

GaryJ

New member
Hi

I need to have 5 x 5v outputs driven by the teensy 4.1 pins. These outputs will then close a 5v Circut to switch on and Off a relay, Such as a Solid State, and drive a Buzzer, now I know that the Solid-state Relay can be driven off the 3.3v pin as it has a control range of 3-32 VDC, and I have tried it. I also know you can get 3.3v buzzers. However, I don't want to overload the Teensy, so would prefer to switch at 5v as its an external source, the grounds are connected and common. Can I use a transistor, Most transistors I have seen NPN, Require a 5v Switching current at the base, and resistor value. Can you please assist if a Transister is the way to go here, if so what model do you recommend. and resistor value. I just need High and low, not PWM.

thank you

Gary
 
NPN transistor needs no more than about 0.7V at the base to turn on, I don't know where you got that idea
about needing 5V. You normally take the transistor output current, divide by 10, set the base resistor to
give than current to the base.

For instance assume 100mA output needed, so divide by ten gives 10mA base current, which from 3.3V
means (3.3 - 0.7) / 0.01 = 260 ohm (nearest value 270 ohm).

Perhaps you confuse MOSFETs with BJTs? MOSFETs have specific gate voltage requirements depending
on the particular device.

NPN and PNP are types of BJT, or simply just "transistor",
p-channel and n-channel are types of FET, specifically enhancement MOSFETs when used for switching
loads. There are also JFETs but they are small signal analog devices typically and not appropriate here.

Be careful about the word transistor - its usually assumed to mean BJT, even though FETs are types of
transistor, FETs are always called FETs to avoid confusion.
 
If you have a need to switch 5v devices then consider an NPN transistor like the 2N2222A or a darlington array such as the ULN2803A. Run them in open collector mode to ground one end of each device. The other device terminal goes to 5v of course.
 
Hi Gary,
For driving relays, buzzers, fans, lamps, etc. by a Teensy I usually resort to using an IRLZ44N. Cheap and easy to get. Vgs of this MOSFET is low enough to be driven safely by a 3V3 output of a Teensy 4.1.

IRLZ44N.png

Paul
 
Darlingtons aren't useful at 5V as they lose about 1.1V

The IRLZ44N is only rated down to 4V gate drive, so its not guaranteed to work reliably at 3.3V (many other MOSFETs
are though, but they nearly all surface mount, not TO220). A BJT like the 2N2222 has only about 10 to 20 fold gain
as a switch, so you may be limited by the microcontroller pin's current rating. For instance for a microcontroller with
10mA max current, you might expect to switch upto 200mA with a BJT, whatever the transistor's max rating, otherwise
it will go out of saturation and start dropping a volt or more.
 
Darlingtons aren't useful at 5V as they lose about 1.1V

The ULN2803A darlington array is specifically designed to work with TTL or CMOS logic at 5v. It can also be used reliably at 3.3v to drive 5v devices. The solid state relays referred to are likely identical to the 40A SSRs that I use to switch audio amp power from Teensy 3.6's and 4.1's. I use the same output to drive 5 and 12v lamps, LEDs, smaller conventional relays, and other outputs all the time. Perhaps you are worrying about the double junctions on the input side of a darlington transistor. Example below for ULN1 and ULN2 being the ULN2803A. Encoder also has provision for 8 potentiometer inputs, 2 SPI channels, and 2 serial channels.

T41schematic.jpg T41layout.png
 
Last edited:
The IRLZ44N is only rated down to 4V gate drive
Hi Mark, just curious, am I overlooking something in the datasheet? I read this

Capture.PNG

and this

Capture2.PNG

that leads me to believe that this MOSFET is OK to be driven by a 3V3 signal reliably.

Thanks,
Paul
 
Hi Mark, just curious, am I overlooking something in the datasheet? I read this

View attachment 21710

and this

View attachment 21711

that leads me to believe that this MOSFET is OK to be driven by a 3V3 signal reliably.

Thanks,
Paul

Yes, firstly threshold voltage is nothing to do with being on, its the point the device stops conducting
at all.

To be turned on with the rated on-resistance you look at the on-resistance specifications, they say what gate
voltage is needed. Typically threshold voltages are 30% of on voltages.

Graphs in a FET datasheet are "typical", not "guaranteed", and there's a big manufacturing spread to
consider, often +/-1V for the gate voltages. This spread will catch you out if you notice one device seems to
work at 3V, then you buy 10 more and some need 4V to work! Gate voltages are determined partly by trapped
ions in the gate oxide, and these can migrate over time and due to applied potentials, changing the threshold
and other voltages gradually over time too...
 
Thanks, this is very educative, learned a thing or two.
So, the Fairchild FDD3706 will qualify as a useable FET to be switch loads up to 15Vdc?
Any other parameters that I should take into account for general purpose, non-PWM switching, apart from power dissipation? I'm interested in a FET that it also reasonably solderable by a hobbyist...
I also see a lot of discussion about adding a resistor between gate and source and adding a resistor between driving pin and gate. The Rgs resistor seems obvious to me to not have the gate floating when the driving pin is floating but for the Rg resistor I'm not sure.
What would be your recommendation?

Thanks,
Paul
 
Hi @markt, could you please share a quick diagram about how the base resistor should be connected?

I'm trying to use a teensy 3.2 (or LC or 4.0) to turn on a MQ-3 (alcohol) sensor. This sensor needs 250mW power at 5V.

Thus, I calculated from your example that the base resistor should be 100ohm.

I'm trying to use a 2N2222 BJT or 2N7000 MOSFET connecting +5V power to the Collector/Drain, connecting the Base/Gate (middle pin) to the +3V output from the teensy, and connecting the Emitter/Source to the +5V VCC of the MQ-3 (which has its GND pin connected directly to ground).

However, when I measure with a multimeter, I see that the voltage from the emitter/source is still only about 2.5V. I don't understand where to connect the 100 ohm resistor other than as a pull-down resistor between the Base/Gate and ground.

Thanks!
 
Why don't you use a Buffer Transistor set up then you can use any voltage you want with the Teensy Adjusting resistors according to needs.

Buffer Transistor.png
 
Back
Top