Microbit | Sensor Series 14 – Magic Light Cup Sensor

01

Introduction

The Magic Light Cup module consists of two identical sensors, each equipped with an LED and a mercury tilt switch.

The mercury switch provides a digital signal indicating whether the sensor is tilted, and PWM can be used to adjust the brightness of the LED.

Thus, tilting one light cup can illuminate the other light cup, creating the illusion of light being transferred from one cup to another.

Microbit | Sensor Series 14 - Magic Light Cup Sensor

02

Principle

The Magic Light Cup is essentially the same as the mercury switch but includes an additional LED light. For the principle, please refer to the previous article.

Before use, gently adjust the mercury switch to ensure it stands vertically.

Microbit | Sensor Series 14 - Magic Light Cup SensorMicrobit | Sensor Series 14 - Magic Light Cup Sensor

03

Wiring

  • – : Power negative, connect to GND
  • + : Power positive, connect to 3.3V
  • S: Switch signal output
  • L: LED signal input

04

Program

Microbit | Sensor Series 14 - Magic Light Cup SensorNote:

Mercury is toxic to both humans and the environment, so when using a mercury switch, be very careful to avoid breaking the glass tube and causing mercury leakage.

If broken, immediately open windows and doors for ventilation to prevent inhalation of mercury vapor. Do not use cloth or mop to clean up spilled mercury to avoid contaminating more areas. Use paper or plastic instead.

Microbit | Sensor Series 14 - Magic Light Cup Sensor Program Explanation:

Light Cup 1: L pin connected to P0, S pin connected to P1.

Light Cup 2: L pin connected to P2, S pin connected to P8.

When powered on, both lights are set to off.

When Light Cup 1 is tilted, the mercury switch opens, meaning P1 is high, which turns on the LED light of Light Cup 2.

When Light Cup 1 is upright again, the mercury switch closes, meaning P1 is low, which turns off the LED light of Light Cup 2.

Microbit | Sensor Series 14 - Magic Light Cup Sensor

05

Demonstration

Leave a Comment