ESP32 KY-004 Key Switch Module

KY-004 Key Switch Module image

KY-004

Protocol: Digital

Overview

The KY-004 is a key switch module equipped with a tactile push-button. It provides a digital output signal when pressed, making it ideal for user input applications in various electronic projects.

About KY-004 Key Switch Module

The KY-004 is a simple push-button switch module that provides digital input for microcontrollers. When pressed, it connects the signal pin to ground, sending a LOW signal to trigger an event. It operates within 3.3V to 5V, making it compatible with ESP32, Arduino, and other microcontrollers.

Key Features

  • Push-Button Activation – Sends a LOW signal when pressed.
  • Operating Voltage – Works with 3.3V to 5V, ensuring broad compatibility.
  • Simple Digital Output – Easy integration with ESP32, Arduino, and similar boards.
  • Versatile Applications – Used for reset functions, menu navigation, and input controls.

With its compact design and easy-to-use interface, the KY-004 is perfect for user input, interactive devices, and control applications. 🚀

Where to Buy

KY-004 Key Switch Module

Starting from

1$ per unit

Amazon com
Amazon.com Ships worldwide
View Price
Amazon de
Amazon.de Ships to EU
View Price
Aliexpress
AliExpress Best value
View Price

Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.

Technical Specifications

Operating Voltage 3.3V to 5V
Dimensions 15mm x 26mm x 10mm
Button Type Tactile push-button
Output Type Digital signal
Operating Temperature -25°C to 105°C
Durability 100,000 cycles

Pinout Configuration

The VCC pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND pin is the ground connection and must be connected to the ground of your ESP32.

  • Pin (-): Connects to Ground (GND).
  • Pin (+): Connects to VCC (3.3V or 5V).
  • Pin (S): Outputs a digital signal when the button is pressed.

Wiring with ESP32

  • KY-004 Pin (-): Connect to ESP32 GND.
  • KY-004 Pin (+): Connect to ESP32 3.3V or 5V.
  • KY-004 Pin (S): Connect to a GPIO pin on ESP32 (e.g., GPIO4).

Troubleshooting Guide

Common Issues

❌ No Response from KY-004 Module

⚠️ False Triggering of Button Press

Debugging Tips

🔍 Serial Monitor

⚡ Voltage Checks

Code Examples

Arduino Example

C++
🔧

ESP-IDF Example

C++
🏠

ESPHome Example

YAML
🛠️

PlatformIO Example

C++
🐍

MicroPython Example

Python

Conclusion

The ESP32 KY-004 Key Switch 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.

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.