KY-027 Magic Light Cup Module – LED Tilt Sensor Kit for Arduino & ESP32
The KY-027 Magic Light Cup Module is an interactive electronic module designed to demonstrate the relationship between tilt detection and LED lighting effects.
Commonly supplied as a set of two modules, each board features a tilt-sensitive switch and an LED. When connected to a microcontroller, the modules can be programmed to create an animated light-transfer effect, making it appear as though light is being poured from one cup into another.
The KY-027 is ideal for Arduino, ESP32, interactive electronics, STEM education, robotics, and DIY projects.
Key Features
-
Model: KY-027
-
Module Type: Magic Light Cup / LED Tilt Switch Module
-
Sensor Technology: Mechanical Tilt Switch
-
Light Source: LED
-
Tilt Detection: Digital ON/OFF Signal
-
LED Control: Digital Output or PWM
-
Operating Voltage: Typically 3.3V–5V DC, depending on the module version
-
Interface: Commonly 4 Pins
- Interactive Lighting Effects
- Compact PCB Design
- Suitable for Arduino and Microcontroller Projects
Technical Specifications
| Parameter |
Specification |
| Model |
KY-027 |
| Product Type |
Magic Light Cup Module |
| Sensor Type |
Mechanical Tilt Switch |
| Light Source |
LED |
| Number of Modules |
Commonly 2 per Set |
| Operating Voltage |
Typically 3.3V–5V DC |
| Tilt Sensor Output |
Digital |
| LED Control |
Digital / PWM |
| Typical Pin Labels |
G, +, S, L |
| Detection Method |
Tilt / Orientation |
| LED Color |
Depends on Supplied Version |
| Board Dimensions |
Approximately 20 × 15mm (Variant Dependent) |
| Communication Interface |
GPIO |
Pin Configuration
Common KY-027 versions use the following connections:
| Pin |
Function |
| G |
Ground |
| + |
Power Supply |
| S |
Tilt Switch Signal |
| L |
LED Control |
Note: Pin labels and internal connections may vary between manufacturers. Verify the supplied module before wiring.
How It Works
The KY-027 combines two basic electronic functions:
1. Tilt Detection
A mechanical tilt switch changes its electrical contact state when the module is tilted. The connected microcontroller reads this change through a digital input.
2. LED Control
The onboard LED can be controlled by the microcontroller. Using PWM, the LED brightness can be increased or decreased gradually.
3. Magic Light Cup Effect
When two modules are used together, the microcontroller can detect their orientation and adjust the LEDs to create the illusion of light moving from one module to another.
For example, when one module is tilted, its LED gradually dims while the second module's LED becomes brighter.
Arduino Connection Example
For a typical KY-027 module:
| KY-027 |
Arduino Uno |
| G |
GND |
| + |
5V |
| S |
D2 |
| L |
D9 (PWM) |
For a two-module setup, connect the second module's tilt signal and LED control to additional Arduino pins.
The exact signal polarity and LED drive arrangement should be checked before uploading the program.
Applications
- Magic Light Cup Demonstrations
- Interactive LED Lighting Projects
- Arduino and ESP32 Projects
- Tilt-Activated Lighting
- Educational STEM Experiments
- Robotics and Automation
- Orientation-Based LED Control
- Electronic Art Installations
- DIY Interactive Displays
- Microcontroller Programming Practice
Important Notes
-
The KY-027 is an interactive LED and tilt switch module, not a precision angle sensor.
- It detects changes in orientation but does not measure exact tilt angles.
- The module typically uses a mechanical ball tilt switch.
- Two modules are commonly used to demonstrate the complete Magic Light Cup effect.
- The lighting animation requires programming on a connected microcontroller.
- PWM-capable outputs are recommended for smooth LED brightness transitions.
- Mechanical switch contact bounce may require software debouncing.
-
For ESP32 and Raspberry Pi, ensure all GPIO signals remain within 3.3V limits.
- Some versions may require external current-limiting or LED drive circuitry.
- Verify the pinout and operating voltage of the supplied board before connecting it.
Package Includes
1x KY-027 Magic Light Cup Module