Arduino Shield Tutorial – Make Your Own Relay Shield

Arduino Relay Shield

Arduino Shield Tutorial – Make Your Own Relay Shield

Watch the Video Tutorial

Arduino shields are boards that can be plugged on top of the Arduino PCB to extend its capabilities. This makes prototyping with Arduino plug and play. Instead of soldering or wiring external devices or sensors, you can simply hook your board with a shield. This speeds up development time even for absolute beginners.

There are hundreds of shields out there. Whether you want to connect your board to the Internet, Control motors, switch high voltage devices or wireless communication like Wi-Fi or Bluetooth, there is a shield for that.

This is a practical tutorial, we’re gonna build a fully working complete Arduino Relay shield, we’re gonna go through all the steps, we’ll start from scratch explaining and simulating the circuit diagram in Proteus, then we’re gonna create a Printed circuit Board with Eagle but any PCB design software can also be used, then we’re gonna generate the manufacturing files to manufacture the PCB with PCBWay our favorite low cost PCB manufacturing company and finally were’re gonna test the operation of the shield with a simple arduino sketch.  The same procedures can be used to build any Arduino Shield of your choice.

There are many reasons why you should make your own Arduino shields instead of buying one. Here are some few reasons you may consider:

Easy to Make

Arduino Shields are easy to make, just think of what you would like to extend your Arduino board with, then follow the same form-factor as the standard Arduino: Power and ground pins on one eight (previously six) pin header, and analog pins on a six-pin header next to that. Digital pins cover the other edge on the other side, an eight-pin header separated from a 10-pin by 0.5″ spacing. Some shields also require a connection to the Arduino’s ICSP header (the 2×3 programming header on the end).

You don’t even have to worry a lot about this form factor as there are already free Arduino libraries that you can use as template in almost all PCB design software like EAGLE, Fritzing, EasyEDA etc.

Cheaper to Make

Making your own shields could be cheaper than buying one. The price of standards electronic components are relatively cheap.

There are many great professional PCB software you can use for free to make your shields like EAGLE, Fritzing and EasyEDA just to name a few. You won’t need to buy expensive licences, some of these free software will even allow you to make and commercialize your boards wit their free versions.

The other and probably most important is also the cost to manufacture your PCBs. If you are considering selling your shields or even for your own prototype, it’s always a must to use a reputable PCB manufacturing company for your PCBs. You can’t make them yourself.

The quality of a PCB can affect the overall quality of the whole electronic device. You can’t take chances with any company and you can’t spend a fortune because of the quality again even if they say you get what you paid for!

There are many PCB companies in the world that can make you good quality PCBs, but we need one that can produce cheap boards of high quality on small orders because the first batch of any project is likely be of small quantity. One of those companies we can recommend is PCBWay.

PCBWay is a china based PCB manufacturer specializing in PCB prototyping, small volume production and PCB assembly service all under one roof with more than a decade of experience. You can get 10 high quality PCBs (size: 100mm x 100mm or smaller) for just $5 USD. You can pick between these solder mask colours at no extra cost: Green, Red, Yellow, Blue, white and Black.

Figure 1 below shows the Relay PCB we received form PCBWay. We used the Blue solder mask.

Arduino Relay Shield PCB
Figure 1: Student Companion Easy Relay 1 Shield PCB made by PCBWay

If your shield uses SMT components, PCBWay provide PCB Assembly services as well at a competitive price.

Please read this article to learn more about PCBWay:

Low Cost PCB Prototype and Assembly with PCBWay.

And if you are a student or an educator, you could get PCB for free, read this article to find out how:

Free PCBs and Discounts for Students and Educators with PCBWay’s Sponsorship Program.

Alternatively you can contact them from their website, click on the logo below:

PCBWay Website

Circuit Diagram

Figure 2 below shows the circuit diagram of the relay shield.


Figure 2: Student Companion Easy Relay 1 Shield Circuit Diagram

We could have chosen almost any Digital pin of the Arduino to control the relay, or use some jumpers to allow the user to select a pin of his/her choice, to make things simpler, we’re gonna use pin D7 to control the Arduino.

Because relay coils usually require more than 40mA an arduino pin can supply, that’s why we can’t connect them directly, we can use any low power transistor to do the job. In this example we’re gonna use the BC547, a general-purpose low cost NPN bipolar junction transistor. Its rated continuous collector current is 100 mA, which is more than the required 79.4mA by the coil of the relay we are using.

Diode D2 is a free wheeling diode is used to suppress the back emf generated by the coil of the relay which could damage the transistor. A diode connected across the relay coil in reverse biased can do the job.

The LED D1 will switch when the relay is energized.

The relay ratings will depend on your intended applications, here we are using 5V DC, 10A at 250V AC relay.

Schematic design Using EAGLE

Any PCB Schematic design software can be used. In this project we used EAGLE due to its simplicity and free (the free version has some limitations but for simple 2 layer boards like this one, those limitations won’t affect us). 

PCB design in EAGLE is a two-step process. First we’re gonna design the schematic, then lay out the board based on the schematic.

Start with a new EAGLE Project. In the control panel, under the “Projects” tree, right click on the directory where you want to save your project, we prefer to use the default EAGLE directory. Select “New Project”. Give it a meaningful name.

To add a schematic to a project folder, right-click your project folder, hover over “New” and select “Schematic”. Add the parts using the the ADD Tool and design a schematic like the one on figure 3 below.

Student Companion Easy Relay 1 Shield Schematic

Figure 3: Student Companion Easy Relay 1 Shield Schematic in EAGLE

We used the Sparkfun EAGLE libraries, you can get the Arduino board under Boards – SparkFun.

Board Layout Using EAGLE

From the schematic editor click the Generate/Switch to Board command in the toolbar or Switch to Board under the File menu. This will prompt to create a new board based on the schematic when switching to board from the first time. All of the parts you added from the schematic should be there, stacked on top of each other, ready to be placed and routed.

Place all the parts using the MOVE tool on the blank board and route all the airwires. The board is small can be easily routed manually using the ROUTE tool.

Relay 1 Shield Board Layout

Figure 4: Student Companion Easy Relay 1 Shield Board Layout in EAGLE

We routed the traces on Top layer (Red colour) and Bottom layer (Blue colour). We increased the width of the high voltage/current section of the relay to 2.54 mm. We also added some Text on Top and Bottom Silk layers.

Generating The Gerber Files

Now we have reached the final stage of the PCB design, it’s time to generate the Gerber files that we can send to our manufacturing house to build our boards.
Gerber files contain the data about the PCB, where traces, pads, holes are placed, their width and so on.
Click on the CAM processor icon on the toolbar.

Eagle comes with a couple default *.cam files. We gonna use the SparkFun job template that we have already installed.
Under local CAM jobs, select the

To generate, click on Process Job, and then Specify the folder

Figure 5: EAGLE CAM Processor

There is also an easier way to generate Gerber files from PCBWay, the company we use to manufacture our Printed Circuit Boards. Just upload your Eagle board file *.brd to this link: , their online converter supports Eagle boards from 1 to 10 layers.

Manufacture the PCB

The last step in PCB design is to manufacture the actual board, even though you can do it yourself, this is a simple board after all, but for rapid prototyping or for commercial products it’s always a must to use specialized reputable PCB manufacturer instead of doing it yourself.

PCB companies usually charge cheaper per unit if you order many PCBs, for prototyping, you’d prefer to order just a few to make sure you are happy with everything. We recommend PCBWay, they produce cheap boards of high quality on small orders. You can complete your order online at this link:


Below on figure 6 is the Complete Student Companion Easy Relay 1 Shield with Components.

Student Companion Easy Relay 1 Shield

Figure 6: Student Companion Easy Relay 1 Shield

You can download the Gerber files of this project for free or you can simply order the PCB of this project from this link:

Each time a person orders this PCB, we will get 10% commission of the total PCB cost. That’s how you can also support us for more tutorials.

Testing the Relay Shield

We’re gonna connect a light bulb to the relay shield, just break one AC line (the live line) and connect it to Normally Open and Com terminals of the relay as shown on figure 7 below.

Connected a light bulb to the Relay ShieldFigure 7: Connecting a light bulb to the Relay Shield

CAUTION: RISK OF ELECTRIC SHOCK! For safety reasons, do not exceed:
48 VAC / 5A
24 VDC / 5A
For higher voltage such as 110V or 220V, please consult a professional electrician to avoid Electric Shock!

Controlling a relay from arduino is basically the same as switching on and off an led.
The relay is connected to D7, to turn it ON, just send a high to that pin and to turn if off , just send a LOW.
In this example we’re gonna turn it on for 5 seconds and off for 3 seconds.

Testing Relay ShieldFigure 8: Testing Relay Shield

You can download the Proteus Schematic design below here. The file is zipped, you will need to unzip it (Download a free version of the Winzip utility to unzip files).

Arduino sketch: Arduino Shield Sketch

Proteus Schematic: Relay1 Shield

Share this post

Select your currency
ZARSouth African rand
EUR Euro