Relays are mechanical switches ,compare to semi-conductor there switching time are very slow , but it switch in relatively high voltage,One example use of relays are in the Car or bike as electric ignition they increase relatively low current from the battery to high thereby igniting the engine.
we will be making a relay modul to be use with an optocoupler , the optocoupler is the main component of our circuit it separate between the micro controller and the the circuit with higher voltage (using light ) .
Step 1: Components Needed :
1. 5 volt relay(That's depending on the voltage of power supply used)
2. BC547 transistor.(or any other npn but you need to take a look in the datasheet)
3. resistor ( 1k x 2) (220 ohm x 1).
5. Screw terminals(3 pols , and 2 pols)
7.optocoupler (any will do the job)
8.pin male header
9. General purpose PCB
10. Breadboard and Jumpers.
Step 2: Additional Step
I get my optocoupler from an old psu power supply , but after searching down on google with the name of ic i didn't find anything .
Step 3: Always Check the Datasheet !!
Be aware to check the foreword voltage of the optocoupler , it's generally about 1.4v ( luckily with no datasheet mine work fine with 5v and 1 k resistor) .
always use a resistor to cut down the voltage so it does not over power the led inside the optocoupler and burn it out .
Step 4: Schematic :
You can use any schematic you want , in the scond schematic you can replace the relay with a motor or a fan in conditions that the transistor support the max voltage and the max current by the device .
the diode is used across the relay because off the reverse voltage spike that can be generated by the relay coil. The diode would be forward biased to this spike and this short safely the coil.