Smart fan
A smart fan with a built-in display.
Author: Herghelegiu Rares-Andrei
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-RaresAndrei0
Description
A smart fan that features an integrated digital display for real-time temperature monitoring. It automatically activates when ambient temperature exceeds a user-defined threshold.
Motivation
I chose this project because it presented a manageable challenge for someone with my current level of programming experience. Additionally, given the ongoing concerns around global warming and the need for more energy-conscious solutions, developing a fan that operates autonomously based on temperature thresholds seemed both practical and timely. It aligns well with sustainability goals while allowing me to grow my technical skills through a meaningful application.
Architecture
Raspberry Pi Pico 2W
Acts as the main controller of the project — reads temperature from the sensor, controls the fan via the L293D motor driver, and updates the LCD display with temperature data and fan status.
DHT22 Temperature Sensor
Single-wire digital interface. Measures temperature and humidity, used to determine whether the fan should turn on or off.
LCD 16x2 Display (I2C module)
Displays real-time temperature readings and fan status (“ON” / “OFF”).
L293D Motor Driver
Using the GPIO, controls the 5V fan by switching it on/off based on temperature thresholds received from the Pico.
5V Fan
Controlled via L293D outputs, activates automatically when temperature exceeds a certain threshold.
Log
Week 28 April - 4 May
After submitting the project proposal and refining it to add complexity, as advised by the lab professor, I proceeded to purchase the necessary components and began assembling the system. I encountered my first major issue when attempting to interface the DHT-22 temperature sensor with the Raspberry Pi Pico. Although I identified an embassy-rs crate that supports the sensor, it turned out to be non-functional. Unfortunately, the DHT-22 lacks broader support outside of this crate, leaving me with two options: either switch from Embassy to another framework, such as Tock, or attempt to fix the existing crate by rewriting or adapting a significant portion of its rather complicated codebase.
Week 5 - 11 May
I came across a new crate called embedded-dht-rs, but unfortunately, it did not function as expected on my Raspberry Pi Pico. After spending a considerable amount of time attempting to implement the code for the DHT sensor without success, I ultimately decided to switch to a different temperature sensor.
Week 12 - 18 May
I purchased a new Raspberry Pi Pico to facilitate hardware debugging and accelerate the development process. However, after several attempts to get my LCD 16x2 to display even basic output, I’m considering replacing it, as it appears to be either malfunctioning or particularly difficult to work with.The hardware appears to be nearly complete, with the LCD being the only component that may still require replacement.
Week 19 - 25 May
I recently bought a new temperature sensor, the BMP280—the same model we use in the lab. I tried to use it with a 16x2 LCD display, but unfortunately, there wasn’t an existing crate for the display since it’s a clone of an Adafruit model designed for the full-sized Raspberry Pi. Thankfully, during one of the project help sessions, the professor assisted me by creating a custom library for it. The final issue has now come up: it seems that my current circuit configuration doesn’t provide enough power for both the DC motor driver and the display. Hopefully, I’ll be able to resolve it soon.
Hardware
DC Motor: Powered through a motor driver and controlled using PWM signals. BMP280 Temperature Sensor: Communicates via the I2C protocol. MCP23017-Based LCD Display (Clone): Also operates over I2C. Raspberry Pi Pico Marble: Used as a debugging tool.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico Marble | Debugger | 24 RON |
Raspberry Pi Pico 2W | The microcontroller | 28 RON |
BMP280 Sensor | Temperature sensor | 8,5 RON |
LCD 16x2 | Display | 58 RON |
Software
Library | Description | Usage |
---|---|---|
BMP280 | BMP280 crate | Used to transform raw data to temperature |
Ryu | RYU | Used to convert floats to strings |
Embassy-rs | Embassy-rs | The framework for embedded application |