Phipps Electronics

Order within the next 

FREE SHIPPING OVER $199

50,000+ ORDERS

WORLDWIDE SHIPPING

SSL SECURED

Using the 5V Single Relay Module KY-019 with Arduino

Contents

Introduction:

In this tutorial, we will learn about the KY-019 module, what is a relay and we will build a simple project to control a light bulb by using KY-019 module and an Arduino.

5V Single Relay Module KY-019:

The KY-019 Module will be our main component for this tutorial. This module has a 5V relay mounted on a breakout board with additional circuitry. Figure 1 shows the module as seen in fritzing.

Figure 1: KY-019 5V Single Relay Module

Pin Out:

The KY-019 module has three pins.

Component PinDescriptionRelay OutputDescription
(-)GNDN.C.Normall-Closed Contact
middle+5VCOMCommon
SSignalN.O.Normally-Open Contact

What is a Relay?

A Relay is an electro-mechanical component that provides electrical isolation between 2 circuits. It makes it possible for the control circuit voltage to be much lower than the power circuit.

Project:

Arduino Light Flicker:

After learning about the KY-019 module and the relay, it is now time to build a project using the module. Our project will flicker the light bulb every 5 seconds.

Components:

For this project, we need the following components:

  • Arduino Uno board (1 pc.)
  • KY-019 5V Single Relay Module (1 pc.)
  • Jumper wires

Wiring Diagram:

Figure 2 shows the connection between the Arduino Uno and the KY-019 5V Single Relay Module.

Figure 2: Connection Diagram

The KY-019 module pins are connected to the Arduino Uno board as follows:

ModuleArduinoRelay OutputConnected To
(-)GNDN.C.No Connection
middle+5VCOMAC Source (L)
SPin 8N.O.To light bulb (L)

Note: Light bulb (N) to AC source (N)

Code:

Below is the Arduino sketch for our project. I have added comments to explain important parts of the code. Save the code as KY-019.ino and upload it to your Arduino board.

				
					// Arduino and KY-019 module
void setup() {
  pinMode(8, OUTPUT);
  digitalWrite(8, LOW);    // switch off relay:
                           //  - relay COMMON connected to NC
                           //  - relay COMMON disconnected to NO
}
void loop() {
  delay(5000);              // wait 5 sec
  digitalWrite(8, HIGH);    // switch on relay:
                            //  - relay COMMON connected to NO
                            //  - relay COMMON disconnected to NC
  delay(5000);
  digitalWrite(8, LOW);     // switch off relay
}
				
			

Project Test:

Apply power to your Arduino Uno board and AC supply for the relay and bulb. The light bulb should switch on and off every 5 seconds.

SUBSCRIBE FOR NEW POST ALERTS

Subscribe to be the first to know when we publish a new article!
List Subscriptions(Required)

POPULAR POSTS

Scroll to Top