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?
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.
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.
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.
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
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.