Smart House
Introduction
In this project, we will learn how to build a smart house. By combining the previous courses and structural components, we will create a comprehensive case featuring a smart clothes drying rack, temperature-controlled fan, temperature-humidity reminder, and energy-saving lights.

Teaching Objectives
- Review the previously learned courses.
- Complete the comprehensive production of the overall demonstration case.
Teaching Preparations
Before starting the teaching, please ensure you have prepared the following necessary materials:
| Image | Name | Quantity | Remark |
|---|---|---|---|
| Smart Home Explorer Kit | 1 | ||
![]() | micro:bit | 1 | Prepare separately |
![]() | PC | 1 | Prepare separately |
These materials will provide you with a complete experience to ensure you can smoothly proceed with subsequent operations and learning. If you have prepared the above, we can continue to the next step.
Course Introduction
In the previous courses, we learned about cases such as the smart clothes drying rack, temperature-controlled fan, temperature-humidity reminder, and energy-saving lights. In this lesson, we will build a comprehensive small house that integrates all these functions into a smart house.
Project Production
Hardware Connection
- Connect the water level sensor to the J1 interface of the Petal Base Expansion Board.
- Connect the fan module to the J2 interface of the Petal Base Expansion Board.
- Connect the RGB light to the J3 interface of the Petal Base Expansion Board.
- Connect the Adapter to the J4 interface of the Petal Base Expansion Board.
- Connect the 180-degree servo motor to the S1 interface of the Adapter.
- Connect the temperature-humidity sensor and OLED display to the IIC interface of the Petal Base Expansion Board.

Programming Platform
We usually use the graphical programming platform makecode to program the micro:bit.
Programming platform entry: https://makecode.microbit.org/
Create a New Project
Open https://makecode.microbit.org/.https://makecode.microbit.org/

Create a new project.

Enter the project name and click Create.

Add Software Libraries
In the makecode programming interface, click Extensions in the Toolbox.

In the pop-up page, search for petal and click to select the petal software library.

Write the Program
Example program: https://makecode.microbit.org/_1HFgEsKExWMq

You can also directly download the program through the following web page.
How to Download the Program to micro:bit?
Connect the PC to the micro:bit V2 using a USB cable.

After a successful connection, a drive named MICROBIT will be recognized on the computer.

Click the icon in the lower left corner
,and selectConnect Device。

click
。

click
。

In the pop-up window, select BBC micro:bit CMSIS-DAP, then select Connect. The micro:bit is now successfully connected.

Click to download the program.

Results
- Smart Lighting: The rainbow light is controlled by ambient light.
- Smart Clothes Drying Rack: Detected by the water level sensor, the drying rack automatically retracts when rain is detected.
- Temperature-Controlled Fan: Automatically regulates temperature.
- Living Environment Detection: The OLED display shows real-time temperature, humidity, noise, light intensity, and whether it is raining.


