Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Do I need a driver to connect 6 optocouplers to a PIC port?

Status
Not open for further replies.

mImoto

Full Member level 4
Joined
Feb 21, 2002
Messages
210
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Activity points
1,733
PIC port question?

Hello,

I am a bit new at low frecuency electronics. I would like to connect some of the output pins of a PIC to 6 optocouplers with a series resistor.


-------
|------/\/\/\------|
| |
|
_|_
\/ \
| \
|
GND


I have been looking, and the current needed for the optos is about 8mA. I have looked to the Microchip 18fxxx datasheet and I have found that the max. current is 25mA but it in the DC characteristics says VOH VDD-0.7 with IOH=-3mA. So it seems that maybe with 8.5mA the VOH could drop maybe more. Could someone tell me if I need a driver or not (in total I have 6 optos)?.

Thanks a lot,

mimoto
 

Most ports don't have the same current specs for giving or taking current. Often, most microcontroller ports can take about 20-30 mA of current, this is when the port is in low state. When giving current, in high state, it is around 1-5 mA.

But to drive an opto you shouldn't have any trouble, as you can wire the light emitter that way:

Vcc
---
|
>
> Resistor
>
|
|
---
\/ LED
|
|
|---------------| Port

VoidMain.
 

Yep, but pics have been designed to drive leds directly
so you dont need any resistor. you can sink or source straight
but some pins are meant to different uses. For instance the
famous RA4, thats open drain, it is meant to tie to the data
pin on serial eeproms, so you don't need to change pages to set
IO direction, just bsf pin to 1
To drive leds with other suply voltages, like 12 or 24v you may
use a simple NPN transistor, like a 2n2222
Tie the base straight on PIC's pin, colector on supply and emmiter
goes to led's anode, place leds cathode on ground, no resistors needed
and you dont use regulated supply for liting leds.
Study, simulate and BUILD and you will c its true.
Pics are realy good for simple stuff.
 

Hi !

I take the most time an 16F877
The current drive to ground ist on all output pins 25mA
The High current is the same, only the RB4 ,ust have an Pullup to Power.
When you drive a simple LED or an optocoupler its easy an will work whisout an Transistor, only you need is an Resistor.

Mike
 

padspcb said:
Yep, but pics have been designed to drive leds directly
so you dont need any resistor. you can sink or source straight
but some pins are meant to different uses. For instance the
famous RA4, thats open drain, it is meant to tie to the data
pin on serial eeproms, so you don't need to change pages to set
IO direction, just bsf pin to 1
To drive leds with other suply voltages, like 12 or 24v you may
use a simple NPN transistor, like a 2n2222
Tie the base straight on PIC's pin, colector on supply and emmiter
goes to led's anode, place leds cathode on ground, no resistors needed
and you dont use regulated supply for liting leds.
Study, simulate and BUILD and you will c its true.
Pics are realy good for simple stuff.

Whoever told you that???
You DO need a resistor to drive a led from any PIC port, 470 ohm should do. As for the transistor, use at least 1K, better 2K2 if the supply is more than 5 V.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top