KY-034 Automatic Flashing Color LED Module

View on Amazon
Overview
About KY-034 Automatic Flashing Color LED Module
The KY-034 Automatic Flashing Color LED Module features a 5mm LED that cycles through seven colors automatically when powered. This module is ideal for decorative lighting projects, visual displays, and effects where changing colors are desired. The automatic color sequence means no additional control is required, making it easy to integrate into various projects.
Get Your KY-034
Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
KY-034 Specifications
Complete technical specification details for KY-034 Automatic Flashing Color LED Module
📊 Technical Parameters
KY-034 Pinout
The **KY-034** is a 3-pin automatic color-cycling LED module:
Visual Pinout Diagram

Pin Types
Quick Tips
**Interface**: Simple power control (no PWM/protocol needed),💡 **LED**: 5mm automatic color-cycling LED (7 colors),🎨 **Colors**: Red → Green → Blue → Yellow → Cyan → Magenta → White (cycles automatically)
**Power**: 3.3V to 5V operation (via S pin),🔄 **Automatic**: Self-cycling - no external control required
**Control**: Drive S pin HIGH to power LED, LOW to turn off,🎯 **Applications**: Decorative lighting, visual indicators, party effects, mood lighting
Pin Descriptions
| Pin Name | Type | Description | Notes |
|---|---|---|---|
1 - | Power | Ground connection | |
2 middle | Power | Not connected | Leave unconnected |
3 S | Communication | Power/control input | Connect to HIGH or GPIO pin |
Wiring KY-034 to ESP32
To interface the **KY-034** with an **ESP32** for automatic color-cycling LED:
Visual Wiring Diagram

Connection Status
Protocol
Pin Connections
| KY-034 Pin | Connection | ESP32 Pin | Description |
|---|---|---|---|
1 - Required | GND | Ground | |
2 middle Optional | NC | Not connected | |
3 S Required | GPIO13 or 3.3V | Power control (any GPIO or direct power) |
**Simple Control**: Drive S pin HIGH to enable LED, LOW to disable
**Direct Power**: Can connect S directly to 3.3V for always-on operation
**Auto-Cycling**: LED cycles through 7 colors automatically (no code needed)
**No PWM**: This is NOT an RGB LED - colors change automatically via built-in IC
**Low Current**: ~20mA max - safe to drive directly from GPIO
**No Configuration**: Just power on and enjoy the color show
**Middle Pin**: Leave middle pin unconnected (NC)
KY-034 Troubleshooting
Common issues and solutions to help you get your sensor working
Common Issues
Issue: The LED does not turn on when powered.
Solutions:
- Verify that the module is connected to the correct voltage (3.3V to 5V).
- Ensure proper wiring connections between the module and the microcontroller.
- Check for any damage to the LED or module components.
Issue: The LED remains a single color and does not cycle through colors.
Solutions:
- Confirm that the module is receiving continuous power without interruptions.
- Ensure that the signal pin is set to HIGH to allow the LED to operate.
- Check for any firmware or code that might be interfering with the LED's operation.
Debugging Tips
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
KY-034 Programming Examples
Ready-to-use code examples for different platforms and frameworks
int led = 13; // Declaration of the LED input pin
void setup() {
pinMode(led, OUTPUT); // Initialization output pin for the LED
}
void loop() {
digitalWrite(led, HIGH); // LED is switched on
delay(4000); // Wait for 4 seconds
digitalWrite(led, LOW); // LED is switched off
delay(2000); // Wait for another two seconds
}This Arduino code initializes pin 13 as an output to control the KY-034 module. In the loop, it turns the LED on for 4 seconds and off for 2 seconds repeatedly, allowing the LED to cycle through its automatic color sequence during the on periods.
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#define LED_PIN GPIO_NUM_13
void app_main(void) {
gpio_config_t io_conf = {
.intr_type = GPIO_INTR_DISABLE,
.mode = GPIO_MODE_OUTPUT,
.pin_bit_mask = (1ULL << LED_PIN),
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.pull_up_en = GPIO_PULLUP_DISABLE
};
gpio_config(&io_conf);
printf("KY-034 Automatic Flashing Color LED Test\n");
while (1) {
gpio_set_level(LED_PIN, 1); // LED on
vTaskDelay(pdMS_TO_TICKS(4000));
gpio_set_level(LED_PIN, 0); // LED off
vTaskDelay(pdMS_TO_TICKS(2000));
}
}This ESP-IDF code configures GPIO13 as an output for the KY-034 module. It turns the LED on for 4 seconds and off for 2 seconds in a loop, allowing the LED to display its automatic color-changing sequence during the on periods.
light:
- platform: binary
name: "KY-034 Flashing Color LED"
output: ky034_output
output:
- platform: gpio
id: ky034_output
pin: GPIO13This ESPHome configuration sets up the KY-034 module as a binary light component on GPIO13. The light can be controlled via Home Assistant or other ESPHome-compatible interfaces, turning the LED on to display its automatic color sequence and off as desired.
platformio.ini
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduinomain.cpp
#include <Arduino.h>
#define LED_PIN 13
void setup() {
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
Serial.println("KY-034 Automatic Flashing Color LED Test");
}
void loop() {
digitalWrite(LED_PIN, HIGH);
Serial.println("LED ON");
delay(4000);
digitalWrite(LED_PIN, LOW);
Serial.println("LED OFF");
delay(2000);
}This PlatformIO code initializes GPIO13 as an output for the KY-034 module. It turns the LED on for 4 seconds and off for 2 seconds in a loop while printing status messages to the serial monitor.
import machine
import time
LED_PIN = machine.Pin(13, machine.Pin.OUT)
while True:
LED_PIN.on()
print("LED ON")
time.sleep(4)
LED_PIN.off()
print("LED OFF")
time.sleep(2)This MicroPython script configures GPIO13 as an output for the KY-034 module. It continuously cycles the LED on for 4 seconds and off for 2 seconds, printing status messages to the console.
Wrapping Up KY-034
The ESP32 KY-034 Automatic Flashing Color LED Module is a powerful KY-0xx module sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
Best Practices
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Safety First
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.
Ready to Start Building?
Now that you have all the information you need, it's time to integrate the KY-034 into your ESP32 project and bring your ideas to life!








