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.
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
Bill of Materials
Component | Purpose | Price |
---|---|---|
Raspberry Pi Pico 2W | Microcontroller | 34.50 RON |
Breadboard 175 x 67 x 9 mm | Motherboard | 11,99 RON |
Hall Effect Sensor (A44E) | Detects fan rotation | 9,99 RON |
Servo Motor | Mounts on fan blade | 13.99 RON |
8 x LED (Red/Green) | Rotation indicator | 0.39 RON |
Debuger probe | Debugs the program | 62.62 RON |
15 cm 10p Male-Female Wires | Male-Female Wires | 4.45 RON |
10 cm 40p Male-Female Wires | Male-Male Wires | 5.99 RON |
8 x 220Ω Resistors | Resistors | 0.80 RON |
Software
Library | Description | Usage |
---|---|---|
embassy-rp | Access to the pheripherals. | Initializing and interacting with peripherals |
embassy-executor | An async/await executor designed for embedded usage | Used for asynchronous programming |
embassy-time | Timekeeping, delays and timeouts. | Used for delays |
embassy-sync | Synchronization primitives and data structures with async support | Used for providing channels, mutexes, signals, etc |
defmt | A highly efficient logging framework that targets resource-constrained devices, like microcontrollers | Used for log messages with very small binary size and debugging embedded systems |
defmt rtt | A very highly efficient logging framework because of rtt | Diagnose crashes or panics with clear, compressed messages |
cyw43 | It enables wireless communication, allowing your embedded Rust code to connect to Wi-Fi networks | Adding Wi-Fi capability to your Pico W for remote control, cloud communication, or app integration |
cyw43-pio | It's essential for connecting the Pico W to Wi-Fi in no_std Rust environments | Enabling Wi-Fi on the Pico W using Rust also supports embedded Rust projects that need networking |
embassy-net | It enables TCP/IP networking on microcontrollers | Creating non-blocking, async network applications on microcontrollers and also pairs with cyw43-pio for Wi-Fi-enabled embedded apps on the Pico W |
pwm | PWM module | Used for controlling the buzzer |