Connect the PIC to the relay or optocoupler to communicate from the remote to the home automation circuit. The problem is that I don't know whether to use the relay or optocoupler to connect from the PIC to light and fan. If I use the relay, the output just the LED but if I use the optocoupler, the output can be the the light(bulb) and fan(PC fan). This is because that the relay is a electronics switch. It's function as on and off to the LED.
A relay is an electrically operated switch. Many relays use an electromagnetic to operate a switching mechanism, but other operating principles are also used. Relays find applications where it is necessary to control a circuit by a low-power signal, or where several circuits must be controlled by one signal. A simple electromagnetic relay, such as the one taken from a car in the first picture, is an adaptation of an electromagnetic. It consists of a coil of wire surrounding a soft iron core, an iron yoke, which provides a low reluctance path for magnetic flux, a movable iron armature, and a set, or sets, of contacts; two in the relay pictured.
Optocoupler is a device that uses a short opticaltransmission path to transfer an electronic signal between elements of a circuit, typically a transmitter and a receiver, while keeping them electrically isolated since the electrical signal is converted to a light beam, transferred, then converted back to an electrical signal, there is no need for electrical connection between the source and destination circuits.The opto-isolator is simply a package that contains both an infrared light-emitting diode (LED) and a photodetector such as a photosensitive silicon diode, transistor Darlington pair, or silicon controlled rectifier (SCR). The wave-length responses of the two devices are tailored to be as identical as possible to permit the highest measure of coupling possible.