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).
|
|
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 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. |
|||||||||||
|
|
I would do something like this.
Use an N channel MOSFET and a 7406. The reason I say 7406 is it is an open collector part and can sink 40mA, and tolerate 40V. It will also provide your uC some isolation from the 24V circuit. When a logic 0 goes into the 7406, the output transistor is off, showing high impedance to the rest of the circuit. R2 and R3 form a voltage divider providing 12V to the MOSFET gate. Check your MOSFET's maximum Vgs to set these values. When a logic 1 goes into the 7406, the output transistor turns on, showing a path to ground. The output will actually be around 0.7V, but that isn't nearly enough to turn on the MOSFET. 10mA will flow through R2, safe for the 7406, but that resistor is going to get warm if it's a typical 1/4W resistor. The MOSFET will turn on, energizing and closing the relay. A couple other notes: R1 is there to dampen the oscillations as the MOSFET turns on. It forms an RC circuit with the parasitic gate capacitance. For this application, you could eliminate it, but for higher speed applications, it is good to have. D1 is Schottky diode, and is needed for flyback protection. Inductive loads generate a flyback voltage, because of L*di/dt. Flyback voltage will kill a FET in a heartbeat. A logic level MOSFET would work fine here, but I prefer this configuration since it is more easily scalable to large power transistors. |
|||||||||||
|
|
I recently did something very similar to this as a beginner, and found MOSFETS very useful. You need a 24V source from somewhere to switch your relay, which should be connected across the drain-source pins of the MOSFET. You apply a voltage to the Gate pin (using the pinout from your PIC), and this essentially switches the relay-driving circuit on. I made the mistake of taking the gate-threshold voltage in the datasheets as the voltage required to fully turn it, so rather than worrying about this it's much easier to just get a logic-level MOSFET, such as the IRL520. You need to make sure that it's capable of switching 24V and whatever current your relay will draw. You also need to connect a diode in parallel with the relay to prevent damage to the transistor when it switches. |
|||
|
|
|
A very simple and integrated solution may be the NUD3160. Basically the same footprint as a discrete MOSFET or transistor but with inbuilt protection for both the input and output. |
|||
|
|



