> >Yes, I'm currently using a transistor but didn't know if a more preferred >practice was to use an opto. I'll continue with the transistor. This is the fun part, where you get out of the software side, and have to deal with a little hardware. Everything has it's weaknesses. The transistor, for example, should have a resistor between the port pin and the base, to limit current when the port pin is high, to some reasonable value, determined by the load current requirement and the transistor beta. It also needs a resistor to ground, so that you can be sure that it is OFF when the pin is tristated during reset. You can use a 2N7000 Mosfet, which eliminates the base current requirements and calculations, but that also needs a turn-off resistor. In this case, just large enough to keep the maximum guaranteed leakage current from the AVR pin from getting up to the mosfet's threshold voltage. If these are driving inductive loads, you can protect them by adding an appropriately sized zener from collector/drain to ground, but beware, this is dumping the flyback current into your processor ground. You can and should also put a conventional diode across the inductive load. Both may not be needed, but I'd want some measurements before removing either one. "I tried it and it worked" doesn't count as a measurement. :) Too many hobbyists miss that last bit, and publish designs that "work" in a controlled environment, with parts of the right date code, etc.
Message
RE: [AVR-Chat] Opto-Isolators
2004-11-26 by Dave VanHorn
Attachments
- No local attachments were found for this message.