Mini Smart Home
A tiny Rust-powered smart house that senses, blinks, and moves β just like a real one, but way cooler.π
Author: Iordache Ioana-Diana
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-ioanaior
Descriptionβ
This project simulates a miniature smart home environment focused on energy-efficiency, automation, and comfort. Features include humidity monitoring for rain detection, an automatic window system, secure keypad-controlled door access, and visual feedback via an LCD and a high-power LED.
Motivationβ
I find it fascinating how sensors can interact with the environment and create real-life automation scenarios. I wanted to work on a project thatβs both educational and fun, while also touching on concepts related to green homes, security, and interactivity. The idea of a miniature smart home felt like a great fit for demonstrating embedded programming in Rust. That is why I decided to create a small-scale model that could be both a learning experience and a nice gadget.π
On a more personal note, I have a younger brother whoβs been really into robots and home automation ever since we started tinkering with Arduino kits together. Heβs always curious about how things work, and this project got him genuinely excited when he found out I was doing something like this in university. Itβs been a great way to share the experience with him too; and honestly, seeing that kind of enthusiasm around something I build is extra motivation to make it work.
Architectureβ
The final system will include modules for:
- Environment sensing:
- Analog humidity sensor (KS0203)
- Rain detection based on humidity threshold
- Output feedback: LCD 1602 with I2C, for showing system status ("RAIN", "SUN", "UNLOCKED")
- Actuators: Two servo motors: one for window control, one for door access
- Input system: 4x4 button matrix keypad for entering an unlock code
- Indicators: One high-power LED (on/off status display)
- Optional modules: motion or gas sensors for enhanced interactivity and safety
Logβ
-
Week 21 β 27 April
Reviewed previously owned components (sensors, display, servo motors) to assess reusability for the project. Placed an order for a Raspberry Pi Pico 2 W as the main controller board. Researched compatibility and pin availability for each part to ensure smooth integration. -
Week 28 April β 4 May
Drafted the initial project documentation. Defined the scope, motivation, and key goals. Outlined the planned system architecture and reviewed optional extensions. Started organizing the hardware list and validating available Rust crates for each module. -
Week 5 β 11 May
Placed an order for a second Raspberry Pi Pico 2 W to use it for debugging.Initially tested the DHT sensor but discovered that no compatible crate worked properly with the lab-provided Cargo.toml. As a workaround, I replaced it with a Keyestudio KS0203 Steam Sensor, an analog humidity sensor that turned out to be easier to interface with. I later converted its raw analog output into percentage values for better readability and user-friendliness on the display.
I also connected a 1602 I2C LCD, which dynamically displays either "RAINY" or "DRY", depending on the humidity threshold. This condition will eventually control the window via a servo motor.
In parallel, I integrated a 4x4 button matrix which now works as a basic security system: a 4-digit code must be entered correctly. If valid, the LCD shows "UNLOCKED", and this will be used later to activate the doorβs servo motor.
-
Week 12 β 18 May
Finalized the control logic for both servos (door and window), linking them to sensor inputs and keypad status.Initially, I attempted to use a WS2812 RGB LED module for visual feedback, but due to limitations in Rust crate support and stability issues, I opted for a simpler and more robust solution: a 3W High Power LED module. To manage it, I implemented a lightweight
RgbLed
abstraction that mimics PWM behavior using basic GPIO toggling. While it doesnβt support full-spectrum control, it serves well for status indication and general on/off signaling.Additionally, I started researching on how to integrate a solar panel for charging an external battery. I finally managed to power the module using the Battery Power Module with Solar Port, connected to a 4.2V Li-ion battery and a small solar panel. If the battery and panel provide enough power, Iβll also be able to connect other parts of the system to the same power source in the future. Itβs a nice step towards making the whole setup more independent and possibly usable outdoors without needing a wired power supply.
I also started building a frame to integrate the hardware - basically a small βhouse.β I thought about how it could look and began working on the door and window mechanism. However, I consider these more related to the physical design than to the hardware itself, since the functionalities and connections are already in place. Iβll keep improving the appearance and details until the PM fair.ππ
-
Week 19 β 25 May
Completed the final version of the smart home system with several significant improvements.Added a PIR motion sensor to detect movement near the house, with customizable responses. This proved to be challenging at first, as the sensor required proper calibration and debounce logic to avoid false triggers. After some experimentation, I implemented a reliable detection system that works consistently.
Integrated an audio alert system using a passive buzzer with PWM control. Rather than simple on/off functionality, I created distinct audio patterns for different events. The buzzer presented some challenges initially, requiring PWM frequency tuning to produce clear, audible tones.
To solve the persistent LCD display corruption issues that occurred when servos activated, I added 470ΞΌF decoupling capacitors across the power rails and implemented a display recovery sequence. This significantly improved system stability by preventing voltage drops from affecting the LCD controller.
Implemented a comprehensive security mode system (Away/Home/Silent) that can be toggled with the keypad's * key. Each mode has different alert behaviors for both the buzzer and LED indicators, allowing users to customize the system based on their needs.
Finalized the physical housing design, adding proper mounting points for all components and creating a functional door and window mechanism.
Hardwareβ
Component | Function |
---|---|
Raspberry Pi Pico W | Main microcontroller with WiFi |
KS0203 Humidity Sensor | Measures humidity to detect rain |
1602 I2C LCD | Displays environment info & unlock status |
Servo Motor #1 | Controls automatic door |
Servo Motor #2 | Controls automatic window |
4x4 Keypad Matrix | Secure unlock input |
3W LED Module | Basic visual status feedback |
Optional: PIR Sensor | Motion detection |
Optional: Gas Sensor | Safety detection |
Optional: Solar Panel | Battery charging via sunlight |
Note: Solar power is planned as an optional future extension, not core requirements.
Schematicsβ
Bill of Materialsβ
Device | Usage | Price (approx.) | Link |
---|---|---|---|
2Γ Raspberry Pi Pico 2 W | Controller with WiFi | 39.66 RON each | Optimus Digital |
KS0203 Humidity Sensor | Rain detection | 20 RON | Keyestudio |
LCD 1602 with I2C interface | Display | 16.34 RON | Optimus Digital |
2Γ SG90 servomotor | Door and window control | 13.99 RON each | Optimus Digital |
4x4 Matrix Keypad | Input interface | 3.99 RON | Optimus Digital |
High power 3W LED module | Visual system indicator | 10 RON | FunduinoShop |
PIR Motion Sensor (optional) | Motion detection | 20 RON | Keyestudio |
Mini Solar Panel (optional) | Solar charging (future) | 15 RON | Keyestudio |
Battery Power Module with Solar Port (optional) | Battery power supply with solar charging | 20 RON | Sigmanortec |
Breadboard HQ | Circuit prototyping | 4.56 RON | Optimus Digital |
Note: Not all the links point to Romanian websites. Some parts I already had, so I included links where I could find them easily.
Softwareβ
Crate | Version | Purpose | Link |
---|---|---|---|
embassy-rp | 0.3.0 | Core functionality for Pico | π¦ |
embassy-executor | 0.7.0 | Async/await execution for embedded | π¦ |
embassy-time | 0.4.0 | Timekeeping and delays | π¦ |
lcd1602-diver | 0.1.1 | LCD 16x2 display driver | π¦ |
pio | 0.2.1 | PIO support for SK6812 LED | π¦ |
embedded-hal | 0.2.5 | Hardware abstraction layer | π¦ |
defmt | 0.3 | Debugging framework | π¦ |
heapless | 0.8 | Stack-based collections | π¦ |
embassy-sync | 0.6.2 | Synchronization primitives | π¦ |
embassy-futures | 0.1.0 | Future utilities for no_std | π¦ |
Linksβ
-
Core Electronics Pico Tutorial β super helpful 4h video that explains microcontrollers really well; even if itβs not in Rust, it made a lot of embedded concepts much clearer
-
Raspberry Pi Pico + Servo Motor Tutorial β helped me understand how to wire and control a servo from the Pico, even though itβs in MicroPython
-
Servo Door Mechanism β quick video that gave me the idea for how to physically move the door using a servo
-
Servo vs Stepper β a short but clear explanation of the difference between servo and stepper motors, from the same guy in the long tutorial