EEVblog Electronics Community Forum
Electronics => Projects, Designs, and Technical Stuff => Topic started by: salfter on March 25, 2019, 04:24:17 pm
-
I'm working on a 3D-printer control board based on the Teensy 3.6, which has 3.3V I/O. The N-channel MOSFETs commonly used to control things like the bed and hotend heaters tend to deliver lower Rds(on) values as Vgs goes up. I thought it'd be a good idea to shift the 3.3V heater signals from the Teensy up to 5V to switch the MOSFETs.
What I've come up with is in the attached image. HEATER_BED is a 3.3V active-high signal from the Teensy. It goes through 1/6 of a 74LCX07, an open-drain buffer running at 3.3V. The output is pulled to 5V with a 1k resistor, then passes through a 100-ohm resistor on the way to the MOSFET's gate. A 10k pulldown is placed across the MOSFET's gate and source, with the source connected to ground and the drain going to the load: an LED (with dropping resistor) and a bed heater that'll run at 12-24V (or an SSR controlling a 120VAC bed heater). Values for R29 and R31 are ripped from https://toms3d.org/2016/01/11/guide-properly-picking-and-using-mosfets/; the value for R27 is copied from another part of this project that uses the 74LCX07 for level-shifting into a 5V LCD module.
The thing I'm not entirely sure about is having a pullup and a pulldown on the same signal. I'm thinking that the junction to the left of R29 will be at either 5V (if the output of U9A is floating when HEATER_BED is high) or 0V (if U9A is pulling the output low when HEATER_BED is low). The 5V when HEATER_BED is high should then override the pulldown from R31 to turn on the MOSFET, while 0V when HEATER_BED is low should turn off the MOSFET.
Will dueling pullups/pulldowns work like this? Do I even need R31 in this instance? The aforementioned webpage recommended it to ensure that the FET is either full-on or full-off so that it never gets into a resistive state that lets the magic smoke out, but if U9A and R27 are guaranteeing either 0V or 5V output, would it be safe to leave out R31?
-
The thing I'm not entirely sure about is having a pullup and a pulldown on the same signal.
Right question :) Pull-down is not because of MOSFET gate, but microcontroller pin instead - when MOSFET gate is driven directly from uC pin. Pin of uC usually has "hi-z" state (floating) while in reset/uninitialized. Also 10k is unnecessarily small resistance, 100k is good enough.
-
All you need is a pull-up to 5V and another resistor to limit teensy pin output. Direct from teensy to the mosfet gate (no buffer). Then switch the teensy pin between an input (high impedance, which results in 5V on the gate) to a low output (a sink resulting in near zero on the gate).
Do be careful about what happens when the teensy does nothing (heater on may be a bad default).
Another option is to use a mosfet that is OK with just 3.3V on the gate.
-
Or to just use a proper mosfet driver!
-
dueling pullups/pulldowns
A dueling pull-up and pull-down just give you a voltage divider. In this case, with 1.1k on top and 10k on bottom, you get 90% of your source voltage or 4.5V.
Looking at this MOSFET's datasheet, it's fully on at 4.5V and they even specify the on-resistance of 3.0mOhm at 4.5V, so that's actually plenty. If you wanted to get closer to your full 5V, you could change R31 to 100k for ~4.95V. All R31 does is make sure the gate capacitance of the MOSFET discharges when you aren't driving it, so that it turns off when there's no control signal to it. FETs don't turn off until you discharge their gate.
That said, I don't think this is the circuit you want. With an open drain, you not only have very little drive current to turn the FET on, but also with no input to the buffer, the FET will be on(as soon as you power your circuit and before the microcontroller takes control).
Ideally you want an output stage with a pair of transistors that can push/pull the gate. This FET doesn't have a huge gate and I imagine you aren't switching it very often, so that can be almost anything. I attached a simple drive circuit with typical resistor values. I don't guarantee they're ideal values but they're safe values for the microcontroller and drive transistors, so the MCU can't push more than 3mA and the transistors can't push more than 500mA.
If you're trying to drive a lot more than the 10A I've shown through the heater, like the 100A that FET is rated for, you might want to just use a dedicated gate drive IC, or at least use FETs as your drive transistors, and reduce the gate resistance to 1-2ohms, so that your switching times are as short as possible to limit switching loss.
-
All you need is a pull-up to 5V and another resistor to limit teensy pin output. Direct from teensy to the mosfet gate (no buffer). Then switch the teensy pin between an input (high impedance, which results in 5V on the gate) to a low output (a sink resulting in near zero on the gate).
Is the teensy specifically designed and rated for this? Many microcontrollers can't accept a voltage greater than VCC on their pins under any circumstances.
The chosen FET has a maximum gate threshold voltage of 2.35V, and it goes down with temperature. It could probably be connected straight to a 3.3V logic output and it would work perfectly well.
Pull-down is not because of MOSFET gate, but microcontroller pin instead - when MOSFET gate is driven directly from uC pin. Pin of uC usually has "hi-z" state (floating) while in reset/uninitialized. Also 10k is unnecessarily small resistance, 100k is good enough.
Many devices have internal pull-ups which are enabled after reset, to ensure that pins don't float. For this reason, if I need a pull down instead, I'd always choose a value which is guaranteed to be small compared to the pull-up resistance in the device. In this case, I'd use a 1k pull down to GND to make sure it comes up in the 'off' state following reset.
100k would risk being comparable to the internal pull-up in the processor, resulting in an intermediate voltage on the FET which could overheat and destroy it quickly.
Or to just use a proper mosfet driver!
The gate of a FET behaves like a small capacitor, so you don't need any significant current to turn it on, unless you need it to switch quickly. In a power supply application, where it's switching at 10's or 100's of kHz, then yes, you need a low impedance gate driver. If, however, it's just turning a heater on and off, it switches so infrequently that the turn-on/turn-off time is irrelevant.
-
The chosen FET has a maximum gate threshold voltage of 2.35V, and it goes down with temperature. It could probably be connected straight to a 3.3V logic output and it would work perfectly well.
Yeah, connecting straight to the Teensy is the quick and dirty way to make this one work. You can see from fig 1/2 in the datasheet about how well that would work. If the load is less than 20-30A that's probably okay, but at 3V the transistor saturates above that. Make sure it's on a heatsink in that case. If it were me and the load were <15A or so I'd drive it at 5V so I didn't need to heat sink it(The junction would be at 120C with no heat sink at 15A with worst case on-resistance)
https://www.infineon.com/dgdl/irlr8743pbf.pdf?fileId=5546d462533600a4015356719c7e26ff (https://www.infineon.com/dgdl/irlr8743pbf.pdf?fileId=5546d462533600a4015356719c7e26ff)
-
The 74LCX07 is no good for 3.3V to 5V conversion, because it has diodes connected from its outputs to VDD. It really annoys me when they do this. There are no diodes between the inputs and Vdd, so why they do it to the output is beyond me, as the whole point of an open drain output is to enable it to control higher voltages, than the supply.
The 74HCTxx series can be used be used for 3.3V to 5V translation, but why not just use a proper MOSFET driver?
-
I am trying to control a 5VDC 8A power supply to an Odroid HC1 single-board computer using Teensy 3.2. Note that I haven't built this yet, only simulated to verify it should work.
In my case, I'm using a P-channel MOSFET (IRF7410G (https://www.infineon.com/cms/en/product/power/mosfet/20v-250v-p-channel-power-mosfet/irf7410g/)) on the high side (in my case, 5 VDC line), and a standard 2N3904 NPN transistor (MMBT3904 (https://www.onsemi.com/PowerSolutions/product.do?id=MMBT3904)) to turn it on.
These particular components won't work for you, but perhaps you could do something similar?
(https://www.eevblog.com/forum/projects/mosfet-driven-by-open-drain-level-shifter-anything-wrong-here/?action=dlattach;attach=691740;image)
The main benefit of the high-side switching is having common ground. (In my case, that is a hard requirement; that's why I'm not using an N-channel MOSFET on the low side.)
For the simulation, the closest p-MOSFET to the IRF7410G I could find in EasyEDA was a Vishay Si4427BDY (http://www.vishay.com/docs/72295/si4427bd.pdf), which is close enough:
(https://www.eevblog.com/forum/projects/mosfet-driven-by-open-drain-level-shifter-anything-wrong-here/?action=dlattach;attach=691866;image)
Red is power out voltage, green is the p-MOSFET gate voltage, and blue is the transistor gate voltage:
(https://www.eevblog.com/forum/projects/mosfet-driven-by-open-drain-level-shifter-anything-wrong-here/?action=dlattach;attach=691872;image)
As a rough calculation, even at 10 mOhm there is less than 0.1V drop over the MOSFET at 8A. Then, the MOSFET dissipates about 0.64W. At 50°C/W, that's +32°C above ambient.
-
I guess you're using PWM to control bed temperature? What frequerncy?
I'm a bit leery of using a 30V rated mosfet with a 24V rail, given that heating beds have inductance.
I would add a back-emf diode across the heater, or expect the mosfet to repeatedly go into avalanche or damage the LED.
-
> Is the teensy specifically designed and rated for this?
The Teensy 3.2 I used was. But good point, many MCUs (including the teensy 3.6 mentioned) are not 5V tolerant.