Light Cup Sensor
STM32-Experiments Free Updated Sep 26, 2026

Light Cup Sensor

Light Cup Sensor

1. Introduction

Vending machines and automated dispensers both need a simple, reliable way to confirm whether a container is actually sitting in place before releasing anything into it. In this experiment, a tilt-based presence module, sometimes sold as a Magic Cup Light module, is wired to the STM32F070RB as a digital input, and the microcontroller reports presence or absence over UART alongside an indicator LED.

2. Scope

This experiment covers reading a simple digital presence and absence sensor, and reporting clear, human-readable state changes over UART alongside a visual LED indicator. This reinforces the simple digital-sensor-reading pattern, applied to a placement-confirmation style sensor.

3. Prerequisite

3.1 Hardware

  • STM32 Nucleo-F070RB development board

  • Magic Cup Light module, or an equivalent tilt or proximity presence sensor

  • LED and a 220 ohm resistor

  • Breadboard and jumper wires

  • Micro-USB cable

  • PC with PuTTY

3.2 Software

  • STM32CubeMX (standalone)

  • STM32CubeIDE

  • ST-LINK USB driver

  • PuTTY, or an equivalent serial terminal application

Community Q&A

0 questions

Ask questions and get answers from our community and staff moderators.

No questions yet — be the first to start the conversation!

Ask a Question

Please log in to ask a question or post a reply.

Login to Participate