Hello friends, I hope you all are doing great. In today’s tutorial, I am gonna show you Relay Interfacing with Microcontroller using ULN2003A. In my previous post, I have posted the first part of this tutorial in which I have shown you the Introduction to Relay also its working. Now we are gonna have a look at How to Interface this relay with microcontroller and then use it in your project.

The microcontroller I am gonna use here is PIC18F4552 but you can use any other Microcontroller. You just need to change the syntax of coding but the logic will remain the same. Here, I am using ULN2003A to control relay and from this relay we can control anything. Relay is a key component in almost every electronic circuit. It can be used as a switch and can also be used as voltage regulator.

Relay Interfacing With Microcontroller

  • Relay I am using here is of 12V, I am using this one because its mostly used in projects.
  • Actually, we just control the coil portion of relay, so we send the signal to the relay coil. In simple words, we attach any pin of the PIC with one pin of relay coil and make the other pin to ground.
  • So now when we send the high signal from PIC it will make the relay pin to high and thus the coil actuated and when we make it LOW, the coil deenergized.
The Question is ???
  • But the real question is PIC gives 5V at its high signal but the relay is of 12V so how to convert this 5V signal into 12V.
What’s the Solution ???
  • The solution to this problem is ULN2003A.
  • ULN2003A is used in between PIC and the relay, so when the PIC sends the HIGH signal i.e 5V , ULN converts it to 12V and send it to relay and relay got actuated.

Circuit Diagram

  • Here’s the circuit diagram for this complete project.
  • Resistance R1 is just a pullup resistance.
  • LED is using for the indication,when relay is actuated LED goes ON otherwise OFF.
  • The programming portion is not much, just send high and low signals from PIC to ON and OFF the relay.


  • If you want to buy this project for learning then use our Order Form to place the order.
  • Fully working project with programming will be provided.
That’s all for today guys. If you guys have any problem in any part of this tutorial ask in comments, I will reply your queries. Till next tutorial ALLAH HAFIZ …. :))


Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment