###Meaning of smart temperature control fan

What is smart temperature control fan

Practical operation

Materials: corrugated board and cutter

Build as below picture:


Paste devices as below piture:

Hardware connect



Edge Connector Data Sheet


Step 1

Go to MakeCode page, click Advanced in the code block and click on Extensions.

We need to add a new codebase for programming of smart home. Finding “Add Package” in the bottom of code block and click it. Then a message box will show up, search “smart home”, and download this new codebase.

Note:If there is a hint says some codebase will be deleted because of incompatibility. Don’t worry. You could go ahead as the hint or build a new item in item menu bar.

Step 2

Drag on start block from Basic and drag initialize OLED block from OLED, change height to 64, width to 128.

Drag forever block from Basic, add temp variables in Variable, then drag set item to snap into forever, change item to temp and drag value of temperature behind it. Change value of temperature to ℃ and at pin to P1.

Step 3

Now let’s start OLED code.

Drag clear OLED display under set temp to. Then,drag show (without newline) string ‘Temperature’ under clear OLED display. Last, drag show(without newline) number temp.”Without newline” is for newline displaying string and temperature value.

Step 4

Our goal is using micro:bit driving the fan when the value of temperature is higher than 30°, so temp>30 is a judgement condition. In that way, we need drag “if else” from Logic, set temp>30.

Step 5

We add start melody repeating under if ,set melody to ba ding and repeat once,micro:bit will send signal to fan through P2. Then set fan works 5 seconds and stops 5 seconds. The temperature sensor judge whether go loop by gotting the temperature degree. Else means if above condistion were false, the fan will keep rest.


Make code:https://makecode.microbit.org/_AqMEtEbUtPTE

You also could directly download program visit website as below:


When temperature degree is higher than 30°, buzzer “ba ding” , fan driving to keep room comfortable.

When temperature degree is less than 30°,the fan will automatically stop, and the room at comfortable temperature.


How to adjust speed of fan to control cooling rate in the room.


More information