I want to drive an electromagnet with my PIC, but I know that 1) I won't be able to provide the current necessary and 2) I won't be able to vary the voltage as much as I want. The PIC outputs 0-5V and I'd like to be able to swing between 0 and 60VDC. Any thoughts on where I should start for this?
I would start with a 60 volt D.C. power supply. Then a NPN darlington arrangement with the opto isolated base connected to the darlington, driven by the controller.
The load is connected between the darlington collector and the 60 VDC. I'm here most of the time. If you want to send me your e-mail address, I will send you a schematic.
You'll need to know how much current will flow on the 60VDC side and whether it's resistive or inductive. If you're driving a relay (which drives something else) then you'll need some additional protection, e.g. a diode. Then you can choose an adequate Opto-NPN or know how much current limiting to design in (e.g. resistor) so as to not fry the Opto-NPN. Darlingtons are useful when you need a lot of gain (but they also typically handle more current) and given the opto-isolation, you may be fine with just an opto-transistor (NPN or PNP depending on your setup). Make sure it's good for 60VDC too. Your other electronic switching (i.e. NPN) options are FETs. Usually provide much higher isolation but some are highly susceptible if the wrong voltage (or out of range) is applied (e.g. MOSFETs). JFETs are less sensitive.
A coworker of mine suggested you use the PIC 0-5V output to drive a switching power supply (feedback input). Switchers can give you a 0-60V with pretty high current output capability. Downside is it'd be a little noisier output.
Hey guys, thanks for the input! Those are some great ideas!
As it will be an electromagnet, I'm assuming that's considered an inductive load. But, I don't think noise would be an issue for an electromagnet, would it? I just don't see the noise being so severe as to affect the performance and I don't think that the EMI would affect the the driver either, whether it be a PIC or something else.
Since you're driving an electromagnet with the 0-5 volt output, are you just turning it off and on, or are you planning to vary the output voltage (DAC output) to control the current through the magnet? The suggestions above are all for just on-off control.
In any case, the current needed to run the magnet is as important as the voltage for the transistor or FET doing the controlling. When the device is Off, it must withstand not only the DC supply, but also any back-emf generated from the inductance in the electromagnet (which is why one person rightly suggested a diode across the magnet). And when it's On, the device must withstand not only the current drawn by the magnet, but also the heat created by the current times the on-voltage (Vce or Vds), which can be non-trivial. Power FETs nowadays have very low Rds(on) (often just a few milliohms), while bipolar transistors rarely have on-voltages of less than a few tenths of a volt. Watch out for that heat dissipation!