Introduction: 4 Channel Relay

--by Bhawna Singh, Prerna Gupta, Maninder Bir Singh Gulshan

Step 1: RELAY

A relay is an electrically operated switch. It consists of a set of input terminals for a single or multiple control signals, and a set of operating contact terminals. The switch may have any number of contacts in multiple contact forms, such as make contacts, break contacts, or combinations thereof.

Relays are used where it is necessary to control a circuit by an independent low-power signal, or where several circuits must be controlled by one signal.

Relays are frequently used in our electronics applications especially when we need to drive high loads from microcontroller circuits.

Step 2: Components Required

  1. SPDT Relay 12v
  2. 817 Opto coupler
  3. Transistor BC547
  4. SMD LEDs
  5. 1N4007 Diode
  6. 1k Resistor
  7. Burger sticks male
  8. Power supply
  9. Connecting wire

Step 3: Component Description


  • PC817 is a 4 Pin optocoupler, consists of an Infrared Emitting Diode (IRED) & photo transistor, which enables it optically connected but electrically insulated.
  • Inrared Emitting Diode is connected to first two Pins and if we apply power to it, then IR waves are emitted from this diode, which makes the photo transistor forward biased.
  • If there’s no power on the input side, diode will stop emitting IR waves and thus photo transistor will reverse biased.
  • PC817 is normally used in embedded project for isolation purposes.
  • In my embedded projects, I place PC817 after Microcontroller Pins to isolate back EMF, in case of motor control etc.
  • PC-817 has several applications e.g. noise suppression in switching circuits, input/output isolation for MCU (Micro Controller Unit).

PC817 Pinout

  • PC817 Pinout consists of four (4) pins in total, first two are connected with the Infrared Emitting Diode (IRED) while the last two are connected with Photo Transistor.
  • All of these four pins are given in the table shown below, along with their name & status.

Step 4: Transistor BC547

BC547 Transistor Features

  • Bi-Polar NPN Transistor
  • DC Current Gain (hFE) is 800 maximum
  • Continuous Collector current (IC) is 100mA
  • Emitter Base Voltage (VBE) is 6V
  • Base Current(IB) is 5mA maximum
  • Available in To-92 Package

BC547 is a NPN transistor hence the collector and emitter will be left open (Reverse biased) when the base pin is held at ground and will be closed (Forward biased) when a signal is provided to base pin. BC547 has a gain value of 110 to 800, this value determines the amplification capacity of the transistor. The maximum amount of current that could flow through the Collector pin is 100mA, hence we cannot connect loads that consume more than 100mA using this transistor. To bias a transistor we have to supply current to base pin, this current (IB) should be limited to 5mA.

When this transistor is fully biased then it can allow a maximum of 100mA to flow across the collector and emitter. This stage is called Saturation Region and the typical voltage allowed across the Collector-Emitter (V­CE) or Base-Emitter (VBE) could be 200 and 900 mV respectively. When base current is removed the transistor becomes fully off, this stage is called as the Cut-off Region and the Base Emitter voltage could be around 660 mV.

Step 5: SMD LEDs

The SMD LED chips come in a variety of sizes. SMD LED can accommodate chips with complicated designs, like the SMD 5050, which is 5mm wide. The SMD 3528, on the other hand, are 3.5mm wide. The SMD chips are small, almost close to the design of the flat, square computer chip.

One of the distinct features of SMD LED chips is the number of contacts and diodes they have.

SMD LED chips can have more than just two contacts (which makes it different from the classic DIP LED). There can be up to 3 diodes on a single chip, with each diode having an individual circuit. Each circuit would have one cathode and one anode, leading to 2, 4 or 6 contacts in a chip.

This configuration is the reason why SMD chips are more versatile (comparing SMD vs COB). The chip can include a red, green, and blue diode. With these three diodes, you can already create virtually any colour simply by adjusting the output level.

SMD chips are also known to be bright. They can produce 50 to 100 lumens per watt.

Step 6: 1N4007  Diode


  • Average forward current is 1A
  • Non-repetitive Peak current is 30A
  • Reverse current is 5uA.
  • Peak repetitive Reverse voltage is 1000V
  • Power dissipation 3W
  • Available in DO-41 Package

A diode is a device which allows current flow through only one direction. That is the current should always flow from the Anode to cathode. The cathode terminal can be identified by using a grey bar as shown in the picture above.

For 1N4007 Diode, the maximum current carrying capacity is 1A it withstand peaks up to 30A. Hence we can use this in circuits that are designed for less than 1A. The reverse current is 5uA which is negligible. The power dissipation of this diode is 3W.

Applications of Diode

  • Can be used to prevent reverse polarity problem
  • Half Wave and Full Wave rectifiers
  • Used as a protection device
  • Current flow regulators

Step 7: 2-Pin PCB Mount Terminal Block Connector

Step 8: Resistors 1kΩ & 4-pin Header

Step 9: Basic Connections

Logic GND: Connect to GND on your microcontroller.

Input 1: Connect to a digital output from your microcontroller, or leave unconnected if channel not used.

Input 2: Connect to a digital output from your microcontroller, or leave unconnected if channel not used.

Input 3: Connect to a digital output from your microcontroller, or leave unconnected if channel not used.

Input 4: Connect to a digital output from your microcontroller, or leave unconnected if channel not used.

Relay power +: Connect to the positive (+) lead of the power source for your relays. Can be 5 to 24V DC.

Relay power -: Connect to the negative (-) lead of the power source for your relays.

Relay 1 +: Connect to the + side of the coil of your first relay

Relay 1 -: Connect to the - side of the coil of your first relay.

Relay 2/3/4 +: As per Relay 1 +.

Relay 2/3/4 -: As per Relay 1 -.

Step 10: PCB Layout

Step 11: Ordering the PCBs

Now we have got the PCB design and it’s time to order the PCB’s. For that, you just have to go to, and click on “QUOTE NOW” button.

Step 12:

JLCPCB are also sponsor of this project. JLCPCB (ShenzhenJLC Electronics Co., Ltd.), is the largest PCB prototype enterprise in Chinaand a high-tech manufacturer specializing in quick PCB prototype and small-batch PCB production. You can order a minimum of 5 PCBs for just $2.

To get the PCB manufactured, upload the gerber file you downloaded in the last step. Upload file or you can also drag and drop the gerber files.

Step 13:

After uploading the zip file, you’ll see a success message at the bottom if the file is successfully uploaded.

Step 14:

You can review the PCB in the Gerber viewer to make sure everything is good. You can view both top and bottom of the PCB.

After making sure our PCB looks good, we can now place the order at a reasonable price. You can order 5 PCBs for just $2 but if it’s your first order then you can get 10 PCBs for $2.

To place the order, click on “SAVE TO CART” button.

My PCBs took 2 days to get manufactured and arrived within a week using DHL delivery option. PCBs were well packed and the quality was really good.