Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

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
211
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Activity points
1,746
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
 

VoidMain

Newbie level 6
Joined
Feb 11, 2002
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
44
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.
 

padspcb

Member level 4
Joined
Apr 28, 2001
Messages
77
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Earth
Activity points
828
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.
 

Hardwarekiller

Member level 1
Joined
May 14, 2002
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Germany
Activity points
227
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
 

socketz

Junior Member level 3
Joined
Dec 22, 2001
Messages
31
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
148
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top