Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

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

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Posts
    2

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

    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

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    464
    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.

  3. #3
    Junior Member
    Join Date
    Mar 2018
    Location
    Vancouver, WA
    Posts
    6
    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.

  4. #4
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    330
    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.

    Name:  IRLZ44N.png
Views: 123
Size:  5.5 KB

    Paul

  5. #5
    Senior Member
    Join Date
    Jul 2020
    Posts
    464
    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.

  6. #6
    Junior Member
    Join Date
    Mar 2018
    Location
    Vancouver, WA
    Posts
    6
    Quote Originally Posted by MarkT View Post
    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.

    Click image for larger version. 

Name:	T41schematic.jpg 
Views:	11 
Size:	119.2 KB 
ID:	21706 Click image for larger version. 

Name:	T41layout.png 
Views:	7 
Size:	23.4 KB 
ID:	21707
    Last edited by jkinkennon; 09-12-2020 at 05:12 PM. Reason: Include schematic.

  7. #7
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    330
    Quote Originally Posted by MarkT View Post
    The IRLZ44N is only rated down to 4V gate drive
    Hi Mark, just curious, am I overlooking something in the datasheet? I read this

    Click image for larger version. 

Name:	Capture.PNG 
Views:	12 
Size:	5.6 KB 
ID:	21710

    and this

    Name:  Capture2.PNG
Views: 106
Size:  20.4 KB

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

    Thanks,
    Paul

  8. #8
    Senior Member
    Join Date
    Jul 2020
    Posts
    464
    Quote Originally Posted by PaulS View Post
    Hi Mark, just curious, am I overlooking something in the datasheet? I read this

    Click image for larger version. 

Name:	Capture.PNG 
Views:	12 
Size:	5.6 KB 
ID:	21710

    and this

    Name:  Capture2.PNG
Views: 106
Size:  20.4 KB

    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...

  9. #9
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    330
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •