Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Can a PIC drive a relay?

Status
Not open for further replies.

RawTechie

New Member
Hi, anyone out there know if I can use a PIC to drive a relay to switch a 16V a.c. power supply? Or anyone knows if I might face some unexpected troubles doing that?
 

kinjalgp

Active Member
PIC cannot drive a relay directly! You should connect a transistor at the port pin which will drive the relay. See schematic below.
The diode is any general purpose diode. 1N4007 should be ok.
 

Attachments

  • pic.gif
    pic.gif
    1.2 KB · Views: 3,005

RawTechie

New Member
I have a 0volt and 12volts output that I need to feed into the PIC, which from what I understand, takes 0volt and 5volts. Does anyone have any suggestions for what I could use as a buffer or step-down converter that is cheap and safe? Preferably some sort of integrated circuit as I need 8 inputs to be fed into the PIC, so some kinda octal 12 volt to TTL level converter.
 

kinjalgp

Active Member
There are 2 methods of doing it.
1) Using Optical-Isolator
2) Using Zener diodes
The first method is safer since there is no electrical contact between 12V source and PIC. The output of opto-isolator will be negative logic i.e when input is 12V, the output will be logic zero and vice-versa. This is a bit costly method.

The second method is a cheaper one but does not provide electrical isolation.
 

Attachments

  • Test.gif
    Test.gif
    1.6 KB · Views: 2,593

RawTechie

New Member
thanks! do u know if i could get that zener diode/opto-isolator step-down in some sort of transistor array? I have about 8 inputs and a transistor array or integrated circuit would save loads of space.

anyway, regarding the earlier question on the PIC driving a relay, for anyone who wants to know, there's a high current darlington transistor array that is ideal for TTL levels to drive a relay, lamp, etc. built by motorola (ULN 2803). you can find the datasheets on the net

https://www.electro-tech-online.com/custompdfs/2003/05/ULN2803-DPDF.pdf
 

kinjalgp

Active Member
ULN2803 is 8-output current sink darlington driver array. It is useful only if you want to drive 8 heavy loads. Otherwise it is feasible to use a single transistor.

Reagrding Opto-isolator array, till now I have seen maximum two opto-isolators in a single DIP package. The number is TLP521. Other one is single opto-isolator in a DIP package i.e.P620/MCT2E/4N36 etc.

To save space, get single opto-isolators and put 8 of them in two 16-pin DIP IC sockets. They easily fit into it forming a single IC like package, thus saving space.
 

kinjalgp

Active Member
If cost difference is not much you can go for that too.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top