Description
A driver circuit and single 5V relay that can control greater voltages/currents.
Also called: relay, one channel relay, KY019.
Found in kits: 20 sensors, 37 sensors, 45 sensors.
Specification/Notes:
Voltage: 3.3V to 5.0V
LED: Power
Size: 20mm X 60mm
Relay ratings are shown on the relay. Often 30VDC or 120VAC at greater the 5A.
Typically SPST, NC/C/NO.
Some boards have a 1N4007 flyback diode for the relay’s coil.
May have activation LED. Transistor-driven with pulldown.
There are a number of different sources for these modules. Not every module that looks similar to the ones here behaves exactly the same. Check the specific module that you have for differences in function, voltage levels, pinout, and inactive/active states. Some modules have been found to have incorrectly labeled pins and even poorly soldered components.
Module Pin-out:
Typical/common pinout. Always check the pinout for the module that you have.
Alternate Modules:
There are relay modules that are alternates to the one included in the 37 sensor kits. Some are mechanical relays, some are solid-state relays.







Test setup with CGMICROKIT1
To demonstrate how this works, a test setup that uses the CircuitGizmos CGMICROKIT1 (credit to Robert Severson) will be used. The CGMICROKIT1 has a microcontroller that connects to a PC via a USB/serial interface and runs an easy-to-understand yet powerful interpreted BASIC language (credit to Geoff Graham).

But this isn’t your 1980’s BASIC. This is a fantastic implementation of BASIC. No line numbers, made for easy understanding, and advanced microcontroller features.
This setup combines a CGMICROKIT1 with a single solderless breadboard, a USB/serial interface to the PC, and a suitable power supply for a convenient test bed for proving out small circuitry and experimenting with these 37+ sensors.
On the PC a program called MMEDIT (credit to Jim Hiley) helps to make development easier by providing a platform for editing and downloading the code used for these examples. This development environment is simple, powerful, and flexible. Alternate interfaces on the PC are any serial terminal application, including GFXterm. GFXterm (credit to Robert Rozee)
For more information about this test setup please see the information about the setup here: http://circuitgizmos.com/documentation/hardware-datasheets/cgmicrokit1-technical-information/cgmicrokit1-test-setup/
The hardware for the test setup is mounted on a small wooden base. The tested devices are added to this test setup with jumper wires.
Relay Test 11

This is a very simple test that uses code to turn a relay on and off once each second repeatedly with a CGMICROKIT1. This test uses a digital output.
Relay Test 11 Wiring
- Black wire – Common ground
CGMICRIKIT GND ⇔ Module Ground - Red wire – Supply voltage
CGMICRIKIT 5V ⇔ Module +Voltage - Blue wire – Relay input
CGMICRIKIT uM4 (digital output) ⇔ Module relay control input
Relay Test 11 Code
1 2 3 4 5 6 7 8 |
SETPIN 4, DOUT DO PIN(4) = 1 PAUSE 500 PIN(4) = 0 PAUSE 500 LOOP |
Relay Test 11 Operation
Line 1: Set pin 4 to digital output.
Line 3 and 8: Loop forever.
Line 4: Set pin 4 high to turn the relay on.
Line 5: Pause for 500 milliseconds.
Line 6: Set pin 4 low to turn the relay off.
Line 7: Pause for 500 milliseconds.
Relay Test 11 Output/Results

Relay Test setup with Sensor.Engine: MICRO (S.E:MICRO)
Relay Test 12
Test 11 was performed with a CGMICROKIT1. The same tests can be performed with a Sensor.Engine: MICRO.
Relay Test 13
This test uses a relay board that has 8 relays. The software displays the relay status and allows for on/off control of any relay. The three buttons on the Sensor.Engine:MICRO will be used to select the relay (yellow), turn the relay off (red), and turn the relay on (green).
Relay Test 13 Wiring

- Black wire – Common ground
- Sensor.Engine:MICRO GND ⇔ Module Ground
- Red wire – Supply voltage
- Sensor.Engine:MICRO 5V ⇔ Module +Voltage
- Blue/green/yellow wired – Relay input
Sensor.Engine:MICRO P4. P5, P6, P9, P10, P16, P21, P22 (digital outputs) ⇔ Module relay control inputs
Relay Test 13 Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
SETPIN 4, DOUT SETPIN 5, DOUT SETPIN 6, DOUT SETPIN 9, DOUT SETPIN 10, DOUT SETPIN 16, DOUT SETPIN 21, DOUT SETPIN 22, DOUT SETPIN 7, INTL, RelayOff, PULLUP SETPIN 24, INTL, IncRelay, PULLUP SETPIN 26, INTL, RelayOn, PULLUP R1 = 1 R2 = 1 R3 = 1 R4 = 1 R5 = 1 R6 = 1 R7 = 1 R8 = 1 Relay = 1 Text 0,00," 1) off 5) off ",,3,1 Text 0,10," 2) off 6) off ",,3,1 Text 0,20," 3) off 7) off ",,3,1 Text 0,30," 4) off 8) off ",,3,1 Text 0,57,"off SelectRelay ON",,3,1 DO IF R1 = 0 THEN TEXT 36,00,"ON ",,3,1 ELSE TEXT 36,00,"off",,3,1 IF R2 = 0 THEN TEXT 36,10,"ON ",,3,1 ELSE TEXT 36,10,"off",,3,1 IF R3 = 0 THEN TEXT 36,20,"ON ",,3,1 ELSE TEXT 36,20,"off",,3,1 IF R4 = 0 THEN TEXT 36,30,"ON ",,3,1 ELSE TEXT 36,30,"off",,3,1 IF R5 = 0 THEN TEXT 96,00,"ON ",,3,1 ELSE TEXT 96,00,"off",,3,1 IF R6 = 0 THEN TEXT 96,10,"ON ",,3,1 ELSE TEXT 96,10,"off",,3,1 IF R7 = 0 THEN TEXT 96,20,"ON ",,3,1 ELSE TEXT 96,20,"off",,3,1 IF R8 = 0 THEN TEXT 96,30,"ON ",,3,1 ELSE TEXT 96,30,"off",,3,1 Text 36,42,"Relay: "+STR$(Relay),,3,1 PIN(4) = R1 PIN(5) = R2 PIN(6) = R3 PIN(9) = R4 PIN(10) = R5 PIN(16) = R6 PIN(21) = R7 PIN(22) = R8 LOOP SUB IncRelay Relay = Relay + 1 IF Relay = 9 THEN Relay = 1 END SUB SUB RelayOff IF Relay = 1 THEN R1 = 1 IF Relay = 2 THEN R2 = 1 IF Relay = 3 THEN R3 = 1 IF Relay = 4 THEN R4 = 1 IF Relay = 5 THEN R5 = 1 IF Relay = 6 THEN R6 = 1 IF Relay = 7 THEN R7 = 1 IF Relay = 8 THEN R8 = 1 END SUB SUB RelayOn IF Relay = 1 THEN R1 = 0 IF Relay = 2 THEN R2 = 0 IF Relay = 3 THEN R3 = 0 IF Relay = 4 THEN R4 = 0 IF Relay = 5 THEN R5 = 0 IF Relay = 6 THEN R6 = 0 IF Relay = 7 THEN R7 = 0 IF Relay = 8 THEN R8 = 0 END SUB |
Relay Test 13 Operation
Line 1-8: Set pins that will operate the relays to digital output.
Line 10-12: Setup these pins with pull-up resistance and to call an interrupt subroutine when they go low. These are the Sensor.Engine:MICRO buttons.
Line 14-21: Rx is the relay state. The initial value is 1/high as the 8 relay module is active low.
Line 23: This is the selection index to the relays. The initial value is relay #1.
Line 25-29: Show default static text on the LCD.
Line 31 and 51: Loop forever.
Line 32-39: Test the relay state and display “off” or “ON” on the LCD.
Line 41: Display the selected relay number.
Line 43-50: Set the appropriate output pins for the relays.
Line 53-56: The IncRelay (increment relay value when yellow button pushed) subroutine.
Line 54: Increment the relay index. Valid range 1-8.
Line 55: Test for relay index at 9. If so, set back to 1.
Line 58-67: The RelayOff (turn selected relay off when red button pushed) subroutine.
Line 59-66: Set off state for the indexed relay.
Line 69-78: The RelayOn (turn selected relay on when red button pushed) subroutine.
Line 70-77: Set on state for the indexed relay.
Relay Test 13 Output/Results
If you have any additional information on this sensor/device or have comments, please leave a reply below.
Leave a Reply