Skip to content
International Shipping
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.

Components

    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)
    m1.low()
    dht_read_time = utime.time()
    #define input-output pins
    
    while True:
        if (utime.time() - dht_read_time > 2):
            dht_read_time = utime.time()
            dht_sensor.measure()
            temp=dht_sensor.temperature
            print(temp)
            if temp >= LIMIT_TEMPERATURE:     
                m1.high()
                #operate if the room temperature is higher than the limit temperature
            else:
                m1.low()

    Arduino C Codes of the PicoBricks

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

    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

    Compare

    Product SKURatingDescription Collection Availability Product Type Other Details
    this is just a warning
    Login
    Shopping Cart
    0 items