If I were wanting to drive i.e. industrial relays which require 24v from a Microchip PIC what would I need to look at in terms of a general transistor circuit (and it's pitfalls when driving such a component).
Electronic – Simple design to switch 24v from PIC
24vpictransistors
Related Topic
- Electronic – I’m buying the first PIC, what kit do I need
- Electronic – arduino – Selecting a MOSFET for driving load from logic
- Electronic – Choosing a transistor and resistor for PIC input pin protection from Car Power
- Electronic – Controlling a 8A DC pump with a PIC
- Electronic – How to switch power supply between two 24V batteries automatically & efficiently
Best Answer
I'm sorry, but I think Matt's answer is not a good one at all.
The MOSFET in his schematic is a P-channel, not an N-channel. The diode doesn't offer any protection for the FET; it may be destroyed together with the FET. Besides it's a 20 V diode, so even if it would protect against the induction voltage the 24 V supply may already kill it. The 7406 is superfluous, besides its maximum voltage is 30 V, not 40 V, and that 30 V is Absolute Maximum Ratings, not for continuous use. The circuit will also draw an unnecessary 5 mA with the relay on, and 10 mA no less with the relay off. Also the 100 Ω resistor doesn't "dampen oscillations".
What you need is a logic level gate MOSFET. You're using a PIC, which probably will have a supply voltage of minimum 3.3 V. Let us know if the voltage is lower. A logic gate FET will switch on with a 3.3 V gate voltage, so the PIC can drive it directly. No 7406 needed.
A relay typically needs less than 500 mW, at 24 V that would be 20 mA, but this is an industrial relay, and will probably need more. Let's be generous and say it needs 1 A (that's 24 W!). If we can find a FET with an \$R_{DS(ON)}\$ of less than 350 mΩ we'll be able to use an SMD; these are much cheaper than PTH parts. At the high 1 A it will dissipate 350 mW. What else? Power supply is 24 V, so let's take a maximum \$V_{DS}\$ of minimum 40 V. One FET which fulfills these requirements is the BUK98150:
Max. \$V_{DS}\$ 55 V
Max. \$I_D\$ 5 A
Max. \$R_{DS(ON)}\$ < 200 mΩ @ 3.3 V
Max. \$V_{GS(th)}\$ 2 V
Looks good. The BUK98150 will sink 2 A at 2.6 V gate voltage.
This graph shows an \$R_{DS(ON)}\$ of 175 mΩ @ 3 V and 2 A, for 1 A it will be less. Then dissipated power will be 175 mW, which the SOT-223 package can handle easily. The 175 mV drop is negligible.
This is the circuit. Contrary to Matt's it only consumes 0.1 mW. I've kept his 100 Ω resistor, which limits the short current spikes when switching; a microcontroller doesn't like capacitive loads much. The 100 kΩ ensures that the gate won't float if the PIC's I/O would be switched to input accidentally.
As you can see the diode goes over the relay, not the FET. You can use a Schottky diode here. This one has a maximum reverse voltage of 40 V.