Reed Switch
STM32-Experiments Free Updated Sep 21, 2026

Reed Switch

Reed Switch

1. Introduction

Many car doors use a small sensor exactly like this one to detect whether the door is open or closed, without any physical contact between the door and the sensing element. In this experiment, a reed switch is used to detect the presence of a nearby magnet, and the STM32F070RB simply lights an LED whenever that magnet is close enough to close the switch.

2. Scope

This experiment covers reading a reed switch as a simple digital input with an internal pull-up enabled, and directly driving an LED output to match its current state. This is one of the more straightforward digital sensor readings in this entire series, useful as a quick, confidence-building exercise in GPIO input handling.

3. Prerequisite

3.1 Hardware

  • STM32 Nucleo-F070RB development board

  • Reed switch module

  • A small magnet, to trigger the switch

  • LED and a 220 ohm resistor

  • Breadboard and jumper wires

  • Micro-USB cable

3.2 Software

  • STM32CubeMX (standalone)

  • STM32CubeIDE

  • ST-LINK USB driver

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