DIY Relay Board




Introduction: DIY Relay Board

An electronics hobbyist

Relays are always used for AC switching circuits...we frequently need AC loads like Fan Bulbs to operate automatically with conditions like decreased light, increased temperature, etc.Also we come across situations like when we need to control appliances remotely using smartphone or we have sensor that detects human presence and turns on light ,fan and turns off when it is not all these applications we use a Relay board and we are now going to make such a Relay board that can be used along with logic circuits or micro-controllers to handle AC loads or High voltage DC loads..

Step 1: Parts Required

1. 5/6 V relay

2. 2 1K resistor

3. 1 1N4007 diode

4. 1 BC 548

5. 1 3 pin Screw connector

6. 1 MCT2E / 817 / 4N35 Optocoupler

7. Male headers

8. Solder kits and perfboard

Step 2: Theory and Breadboard Testing

Relay is an electromagnetic switch. Initially when there is no input signal, the COM(common) and NC(normally closed) are connected. The input coil when energized sets up magnetic field and becomes an electromagnet. This magnetic field pulls the COM terminal and connection is now formed between COM and NO(Normally Open).

The circuit has an optocoupler that is just an optical isolator has a IR led at one end and a phototransistor at the other end. When the IR led glows and light falls on the base of phototransistor, the BJT turns ON, otherwise OFF..

Now the signal from the microcontroller or logic circuit glows up the IR led..and turns it on.

The emitter of Phototransistor is fed into base of another BC548 NPN BJT via a 1K resistor, hence a Darlington Configuration, The overall current gain is now B1*B2+B1+B2 (B1 is current gain of phototransistor and B2 is current gain of BC548)....This gives a better drive to the relay coil.

Now when signal line is high, IR glows, phototransistor and BC548 is On and current flows through the relay coil and energize it..then the COM terminal moves to the NO side and hence COM and NO are shorted, ..when signal line is LOW the COM and NC are shorted..

The diode is used as a flyback diode. After the circuit is operated for a while and is then switched off the stored energy from inductor now discharges, this voltage can even go up to 40-60V for a very short interval and can damage the other components, the diode is used to provide the circular path for that stored energy and is dissipated in the diode, keeping the components safe..

Test the above circuit in breadboard and see if this works, if properly connected it MUST work...

Step 3: Soldering on Perfboard

Now after breadboad testing is complete, move on to soldering, take the schematic beside you and start careful soldering. Be careful since you will be dealing with high voltages with this, hence a single error can damage everything...observe carefully the circuit traces using magnifying glass and light. Check yourself with continuity tester to find the NO and NC, the COM is always the middle one..

now test it first with DC load then you can move onto AC loads

I've attached a sample schematic to test with DC load, look at the video too attached here...

If everything is all right, you are all set..

contact me for any problem regarding schematic or theory or testing at or comment below..



  • Tiny Home Contest

    Tiny Home Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Metalworking Contest

    Metalworking Contest

17 Discussions

I love breadboard projects and this is a good one for those interested in home automation or machine control. The use of an opto-isolator is right on as your controller (and by extention the user) must be protected from potential exposure to hazardous voltages or currents. The isolator and separate 12V relay supply prevents getting relay transients in the control supply resulting in system errors that are hard to troubleshoot. Good design and looks cool!

What made you choose 1K resistor values for R1 and R2?


5 replies

The circuit has complete isolation and hence safety... The ir and Bjt side is fully isolated and if there is any error on the Ac line the user will be safe.... I've done previous experiment and observed datasheets of the optocoupler and found that the ir led will glow at a forward voltage of 1.2 to 1.4V...beyond that will destroy the ir.. So as current is not that too high I used a standard 1k resistor and found the forward voltage of 1.2 across the ir led... The second ir led is a Base current limiting resistor and current there is as low as 20-40 there also I used a 1k resistor and used a Darlington configuration and found the relay being driven properly

Yes. You definitely want transistor T1 to saturate so that transistor dissipation is minimized. Most of these 12V relays have a holding current of around 30mA. Using the BC548 data sheet as a guide for saturated collector current somewhere 10mA and 100mA, the 1K resistor was a good choice.

But at 1.2V LED drop with a 1K resistor the forward current is about 4mA. I was curious if the 1K resistor would allow enough light for the opto-transistor to conduct the 4mA of saturation current needed for T1. At 10mA LED current (330 to 390 Ohm resistor), the current transfer to the opto-transistor is between 6ma and 8mA depending on temperature which is perfect for T1. But at 4mA LED current (1K resistor), current transfer to the opto-transistor is only about 2mA to 3mA depending on temperature. At the high end of the temperature range, T1 may not saturate when turned on. Perhaps that's why you mentioned a Darlington transistor.

I was just curious about your experience with the circuit and the reason for choosing the values you did. Thanks for the response!


The IR Led receives about 4mA of Current and that is sufficient for its glow...the BJT part is fully has no dependance on that is a fully seperate circuit and that bjt is controlled by the IR light falling onto it's base, we apply seperate KVL equation for that BJT part, .....yes that BJT is actually saturating and 1K is good for that

Agreed. I show 800uA worst case base current on T1 at 70 DegC is sufficient to hold T1 in sufficient saturation for 30mA relay hold current between 0 DegC and 70 DegC. At 25 Deg C you are probably getting around 2mA on the Base of T1 which is more than enough to do the job.

As you know these IRLED-Phototransistor isolators aren't digital devices. They have a transfer function from input to output called the Current Transfer Ratio (CTR). A given forward current on the LED results in a photo-transistor current in proportion to the CTR for a given temperature range. Worst-case CTR on the MCT2E is 20% across the full operating temperature range. So for a 4mA forward current on the IRLED, the current in the photo-transistor is estimated at 800uA minimum. I measured 1.2mA on my 4N35 at approximately 70 DegC +/- 5 Deg C which is pretty close to the datasheet.


Thanks for the information Sir!! I'll keep that in mind always, and by the way, you can use either 817 or 4N35 or MCT2E, just reading about the inside BJT characteristics from the datasheet is necessary...

I applaud you for using an opto-isolator in this circuit. That way there is no chance to have line voltages ever get to the controlling signal. I realize you are not using line voltage to energize the relay, but you easily could if you selected such a relay and still use the same setup.

6 replies

I'm planning to use it in my Ac loads and I've tested it with high voltage dc load, it works fine.. and now I'll move on to test with small ac loads like small lights or indicators.. If everything is all right I'll also move on to controlling my fans.... The opto is a vital component... The input and the output side are now fully isolated

I guess I misrepresented my view. Obvious line voltage isn't used in this circuit to energize the relay. However, the relay contacts can be used for any (within its capability of course) AC or DC voltage and that does include typical line voltage. And with a few changes you could use line voltage as well to switch a relay. But that is another circuit design. Sorry some misunderstood what I was trying to convey. I'm sure it was my wording.

No....line voltage is not used to energise the relay...5-6V DC signal is used to energise the relay coil..look at the circuit is a normal 5V relay

By line voltages I'm assuming that means 120/220V AC and that a relay with an 120/220V energizing coil would be used. If that is the case the design presented would not work. The opto-isolator output and switching transistor are designed for DC and would instantly self-destruct at AC line voltages. The circuit would need to be redesigned using an opto-isolator with a zero-cross triac output and most likely an external triac to drive the 120V/220V relay coil. But after the redesign, the relay board could only be used at line voltages. I think the author intended the relay board to be suitable for most any kind of switch control be it low/line voltages, AC or DC. The design presented does that pretty well.

The above relay coil is energised by DC current of 5-6V...and you can attach any DC or AC load at the output

Thanks... You can use this in your arduino and home automation projects

Your instructable will be helpful in my instructable

I've also done a similar project... Cheers..