Skip to content
Wish Lists Cart
0 items

#12 Smart Temperature Controlled Fan Project

17 Nov 2023
#12 Smart Temperature Controlled Fan Project
While sitting at home in the summer, you may have wished you could "build your own temperature controlled fan. In this article, you will learn how to build your own smart automatic fan with the Raspberry Pi Pico Kit with Picobricks. Moreover, we share the necessary wiring diagram, Microphyton and Arduino C codes with you in the article. Let's get started.

Air conditioners are used to cool in the summer and warm up in the winter. Air conditioners adjust the degree of heating and cooling according to the temperature of the environment. While cooking the food, the ovens try to raise the temperature to the value set by the user and maintain it. These two electronic devices use special temperature sensors to control the temperature. In addition, temperature and humidity are measured together in greenhouses. In order to keep these two values in balance at the desired level, it is tried to provide air flow with the fan.

In PicoBricks, you can measure temperature and humidity separately and interact with the environment based on these measurements. In this project, we will prepare a cooling system that automatically adjusts the fan speed according to the temperature. You will learn the DC motor operation and motor speed adjustment.

Temperature Controlled Fan Details and Algorithm

First, our code will display the temperature values ​​measured by the DHT11 temperature and humidity sensor on PicoBricks. Then, we will define a temperature limit for the DC motor connected to PicoBricks to start running when the temperature value reaches this limit, and to stop when the temperature value falls below the limit.


    1. Picobricks
      3X Jumper Cable
  • Wiring Diagram

    You can code and run Picobricks’ modules without wiring. If you are going to use the modules by separating them from the board, you should make the module connections with grove cables.

    MicroBlocks Codes of the PicoBricks

    You can access the Microblocks codes of the project by dragging the image to the Microblocks Run tab or click the button.

    Microblocks Run Tab

    MicroPython Codes of the PicoBricks

    from machine import Pin
    from picobricks import DHT11
    import utime
    LIMIT_TEMPERATURE = 20 #define the limit temperature
    dht_sensor = DHT11(Pin(11))
    m1 = Pin(21, Pin.OUT)
    dht_read_time = utime.time()
    #define input-output pins
    while True:
        if (utime.time() - dht_read_time > 2):
            dht_read_time = utime.time()
            if temp >= LIMIT_TEMPERATURE:     
                #operate if the room temperature is higher than the limit temperature

    Arduino C Codes of the PicoBricks

    #include <DHT.h>
    #define LIMIT_TEMPERATURE     27
    #define DHTPIN 11
    #define DHTTYPE DHT11
    float temperature;
    void setup() {
      // put your setup code here, to run once:
    void loop() {
      // put your main code here, to run repeatedly:
      temperature = dht.readTemperature();
      Serial.print("Temp: ");
      if(temperature > LIMIT_TEMPERATURE){
      } else{

    GitHub Project Page
    Prev Post
    Next Post

    Thanks for subscribing!

    This email has been registered!

    Shop the look
    Choose Options

    Edit Option

    Have Questions?

    Back In Stock Notification


    Product SKURatingDescription Collection Availability Product Type Other Details
    this is just a warning
    Shopping Cart
    0 items
    Same Day Shipping No Extra Costs
    Easy Returns Guarantee Return with Ease
    Secure Checkout Secure Payment