Skip to main content
Version: FILS English

Fan Rotation Detection with Door Control

If a fan exceeds a certain number of RPMs, the Pico closes the door.

Author: Popazu George-Alexandru
GitHub Project Link:https://github.com/UPB-PMRust-Students/project-PopazuAlexandru

Description

This project is built using two Raspberry Pi Pico 2W and two servo-motors. The first Pico monitors temperature and pressure, controls the fan, and detects when the fan is rotating. When fan rotation is detected, the first Pico transmits a signal to a second Pico which controls a door mechanism to close it.

Motivation

The motivation behind this project is to create an affordable and automated solution for protecting homes from incoming rain. By using a simple external fan as a wind-speed sensor and Raspberry Pi Pico microcontrollers, the system detects high wind speeds—often a precursor to rain—and automatically signals to close windows. This adds a layer of convenience and protection for homeowners, especially when they are away or unable to act quickly.

Architecture

Schematic Diagram

This is the diagram that illustrates the components and their connections.

alt text

Raspberry Pi Pico 2W

  • Role: The brain of the system.Reads signals from the Hall effect sensor.Controls the LED based on fan rotation status.Processes sensor data to determine if the fan is moving.

LEDs

  • Role: Visual indicator. Lights up when the Hall sensor detects rotation (fan is ON). Turns off when no rotation is detected (fan is OFF). Resistor Purpose: Limits current to prevent LED burnout.

Hall Effect Sensor

  • Role: Detects fan rotation. Senses the magnetic field from the magnet attached to the fan blade. Outputs a digital signal (HIGH/LOW) to the Pico each time the magnet passes by. Note: Requires a magnet mounted on the fan blade.

Breadboard & Jumper Wires

  • Role: System assembly. Provides a platform for prototyping without soldering. Jumper wires connect components to the Pico.

USB Cable

  • Role: Power and programming. Powers the Pico during development. Used to upload code to the microcontroller.

Neodymium Magnet

  • Role: Triggers the Hall effect sensor. Mounted on one fan blade. Each rotation brings the magnet close to the sensor, generating a detectable pulse.

220Ω Resistor

  • Interface: SPI
  • Role: Protects the LED. Limits current flow through the LED to a safe level (typically 5–20mA). Connected in series with the LED.

Log

Week 5 - 11 May

Once the project was approved, I collected all the required components and began assembling the hardware. I also started designing a 3D model for the fan, but paused the design temporarily since I had not finalized the component layout for the final setup. After completing the hardware assembly, I moved on to researching the crates I planned to use for software development.

Week 12 - 18 May

Week 19 - 25 May

Hardware

The hardware setup consists of a Raspberry Pi Pico microcontroller as the core unit, interfacing with multiple peripherals.

A Hall effect sensor (A44E), connected to a digital GPIO pin, detects rotational movement by sensing magnetic pulses from a neodymium magnet mounted on the fan blade. The sensor's output signal is processed by the Pico to determine real-time fan operation status.

An LED indicator, driven through a current-limiting 220Ω resistor, provides immediate visual feedback by illuminating when fan rotation is detected. The LED connects to a dedicated GPIO pin configured for digital output control.

Power is supplied through the Pico's USB interface or external 5V source, with onboard voltage regulation ensuring stable 3.3V operation for all components. The compact design uses a breadboard or soldered perfboard for reliable interconnections between the Pico, sensor, and indicator circuit.

Schematics

KiCad Scheme

alt text

Bill of Materials

ComponentPurposePrice
Raspberry Pi Pico 2WMicrocontroller34.50 RON
Breadboard 175 x 67 x 9 mmMotherboard11,99 RON
Hall Effect Sensor (A44E)Detects fan rotation9,99 RON
Servo MotorMounts on fan blade13.99 RON
8 x LED (Red/Green)Rotation indicator0.39 RON
Debuger probeDebugs the program62.62 RON
15 cm 10p Male-Female WiresMale-Female Wires4.45 RON
10 cm 40p Male-Female WiresMale-Male Wires5.99 RON
8 x 220Ω ResistorsResistors0.80 RON

Software

LibraryDescriptionUsage
embassy-rpAccess to the pheripherals.Initializing and interacting with peripherals
embassy-executorAn async/await executor designed for embedded usageUsed for asynchronous programming
embassy-timeTimekeeping, delays and timeouts.Used for delays
embassy-syncSynchronization primitives and data structures with async supportUsed for providing channels, mutexes, signals, etc
defmtA highly efficient logging framework that targets resource-constrained devices, like microcontrollersUsed for log messages with very small binary size and debugging embedded systems
defmt rttA very highly efficient logging framework because of rttDiagnose crashes or panics with clear, compressed messages
cyw43It enables wireless communication, allowing your embedded Rust code to connect to Wi-Fi networksAdding Wi-Fi capability to your Pico W for remote control, cloud communication, or app integration
cyw43-pioIt's essential for connecting the Pico W to Wi-Fi in no_std Rust environmentsEnabling Wi-Fi on the Pico W using Rust also supports embedded Rust projects that need networking
embassy-netIt enables TCP/IP networking on microcontrollersCreating non-blocking, async network applications on microcontrollers and also pairs with cyw43-pio for Wi-Fi-enabled embedded apps on the Pico W
pwmPWM moduleUsed for controlling the buzzer
  1. how to make automatic door by IR sensor, servo motor and Arduino diy best futurestickArduino project