5V relay module

The module Keyes_SR1y is the KY-019 5V relay module for Arduino (or most anything else really, it’s not as if it plugs straight into the board – you’ve got to connect the pins off to disparate parts of the Arduino board). Relays mostly are used to switch larger loads than opto-isolated switches; they’re generally used in cars or for switching household devices on and off. Large currents are dangerous; you have been warned. This module can switch 250V at 10 amp – at least, that’s what the printing on the box says. The 5 volt part is about the voltage needed to switch the relay. I haven’t measured the current used to switch, but it runs happily off the current supplied by a laptop USB port.

The circuit board marks the 5 volt (+) and ground (-) lines (because of the current draw, these are fed from the power circuitry of the Arduino, rather than the GPIO pins); the remaining line is a digital input; the program code or “sketch” to control it looks something like

const int relayPin=5;
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);

assuming you’ve hooked the relay up to pin 5. Split the code into the body, setup(), loop() and elsewhere as appropriate.

HIGH energizes the relay (switches it from its normal state), LOW does the opposite (and switches it into its normal state). When it changes state it makes an audible click. On board the module is a red LED that lights up when the relay is energized. The relay has Normally Open (NO) and Normally Closed (NC) circuits, so save some power and use the appropriate one for the normal state, or design for a useful fail-safe state.

This module is one that you’ll find in the various Arduino Module Packs around the place.  One guy has made an attempt to identify and document the lot: http://space.makehackvoid.com/wiki/DxArduinoModulePack

One thought on “5V relay module

  1. Rafael Caraballo

    Really useful the article, the guy that sold me the arduino pack didnt sent me a list or any description of what was each component he sold me. So i had to figure it out by looking for the codes printed in the component. this article helped me

Comments are closed.