This module is a 5V relay for switching higher currents. The relay switches the higher voltage through when 5V are applied to the voltage input of the switch.

The output header of the relay has two output terminals:

  • The one marked "NC" for "normally closed" in the image below simply means that this passage is shorted by default without electrical switching at the relay.

  • That which is marked "NO" for "normally open" in the image below simply means that this passage is open or disconnected by default without electrical switching at the relay.

Technical data

Voltage range (AC) 0V to 240V AC at 10A
Voltage range (DC) 0V to 28V DC at 10A

Pin assignment

Warning

**Working with voltages higher than 30V and especially at line voltage (230V) can cause physical harm and even be fatal.

**We advise that working with or on higher voltages should only be done with appropriate professional competence.

Code example Arduino

Pin assignment Arduino

Arduino Sensor
pin 10 signal
5V +V
ground GND

The program simulates a blinker - it switches the relay in predefined time (delayTime) between the two states (or output terminals).

int relay = 10; // Declares the pin to which the relay is connected
 
int delayTime = 1; // Value in seconds how long to wait between the switchovers
 
void setup ()
{
  pinMode (relay, OUTPUT); // The pin is declared as output
}
 
// The program simulates a blinker - it switches the relay in predefined 
// time (delayTime) between the two states (or output terminals).
void loop ()
{
  digitalWrite (relay, HIGH); // "NO" is now shorted;
  delay (delayTime * 1000);
  digitalWrite (relay, LOW); // "NC" is now shorted;
  delay (delayTime * 1000);
}

Example program download

KY019-Arduino.zip

Code example Raspberry Pi

Pin assignment Raspberry Pi

Raspberry Pi Sensor
GPIO 24 [Pin 18] Signal
5V [Pin 2] +V
Ground [Pin 6] GND

The program simulates a blinker - it switches the relay in predefined time (delayTime) between the two states (or output terminals).

# Required modules are imported and set up
import RPi.GPIO as GPIO
import time
 
GPIO.setmode(GPIO.BCM)
# here the pause (in seconds) between switching is declared
delayTime = 1
 
# Here the input pin is declared to which the sensor is connected. Additionally the PullUP resistor at the input is activated
RELAY_PIN = 24
GPIO.setup(RELAIS_PIN, GPIO.OUT)
GPIO.output(RELAIS_PIN, False)
 
print ("Sensor test [press CTRL+C to exit test]")
 
 
# main program loop
try:
        While True:
            GPIO.output(RELAIS_PIN, True) # NO is shorted now
            time.sleep(delayTime)
            GPIO.output(RELAIS_PIN, False) # NC is shorted now
            time.sleep(delayTime)
 
# clean up after the program is finished
except KeyboardInterrupt:
        GPIO.cleanup()

Sample program download

KY019-RPi.zip

To start with the command:

sudo python3 KY019.py

Code example Micro:Bit

Pinout Micro:Bit:

Micro:Bit Sensor
Pin 1 Signal
3V +V
Ground GND

This is a MakeCode example for Micro:Bit which essentially does the same as the examples of the other two variants. However, this example is closer to the Raspberry Pi example than the Arduino example.

Sample program download

microbit-KY-019.zip