INTRODUCTION:
In this tutorial, we will learn about the KY-034 module, how it works and we will build a simple project using the KY-034 module and an Arduino.
AUTOMATIC FLASHING COLOURFUL LED MODULE KY-034:
The KY-034 Module will be our main component for this tutorial. This module has a flashing LED mounted on a breakout board with a resistor. Figure 1 shows the module as seen in fritzing.
PIN OUT:
The KY-034 module has three pins.
Pin | Description |
---|---|
(-) | GND |
Middle Pin | +5V |
S | Signal |
HOW DOES IT WORK?
The LED automatically flashes when power is applied and the light changes colour every flash.
PROJECT – ARDUINO LIGHT FLASHER:
After learning about the KY-034 module and how it works, it is now time to build a project using the module. Our project will supply power to the KY-034 module which will cause it to flash.
PROJECT COMPONENTS:
For this project, we need the following components:
- Arduino Uno board (1 pc.)
- KY-034 Automatic Flashing Colourful LED Module (1 pc.)
- Jumper wires
WIRING DIAGRAM:
Figure 2 shows the connection between the Arduino Uno and the KY-034 Automatic Flashing Colourful LED Module.
The KY-034 module pins are connected to the Arduino Uno board as follows:
Component Pin | UNO Board Pin |
---|---|
(-) | GND |
Middle Pin | 8 |
S | No Connection |
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-034.ino and upload it to your Arduino board.
// Arduino and KY-034 module void setup() { pinMode(8, OUTPUT); // module is connected to pin 8 } void loop() { digitalWrite(8, HIGH); // switch on red delay(2000); // wait 2 seconds digitalWrite(8, LOW); // switch off red delay(2000); // wait 2 seconds }
PROJECT TEST:
Apply power to your Arduino Uno board. The KY-034 module will blink repeatedly while changing colour for 2 seconds, switch-off for 2 seconds and process repeat indefinitely.