Project tutorial
Jar Temperature Detector and Cooling Fan

Jar Temperature Detector and Cooling Fan © CC BY

If the temperature measured by DS18B20 is above the predefined threshold, it turns the fan on automatically unless the piezodisk is pressed.

  • 250 views
  • 0 comments
  • 5 respects

Components and supplies

Necessary tools and machines

Hy gluegun
Hot glue gun (generic)
09507 01
Soldering iron (generic)

Apps and online services

About this project

While measuring temperature produced by project structures I had built, I might need to act instantly to make it cooler to avoid any harm to the components attached to the structure. And therefore, I conceived a movable cooling fan design which can detect temperature in a long distance, running the fan if the measured temperature is above the predefined threshold. Also, I wanted to halt the process if an emergency occurs while monitoring the surrounding temperature in Celsius and Fahrenheit. To manage this project, I used an L9110 Fan Motor and a DS18B20 Waterproof Temperature Sensor, attached to Arduino Nano. For turning the fan on and off intentionally, I added a piezo disk sensor. After I finished the circuit, I decided to put all parts on a dilapidated jar and am now very happy for the outcome.

To support my projects, you can visit my website here.

Preparing Components

First of all, find an old jar and get resistors - 4.75 K and 1 K - for the piezo disk sensor and the DS18B20 Waterproof Temperature Sensor along with other components as depicted below.

Now, you need to attach three jumper wires to the DS18B20 legs - 5V, Signal, GND - to be able to connect it to mini breadboards by using a soldering iron.

How to Use DS18B20 Waterproof Temperature Sensors

All DS18B20 Sensor has three legs and same connection requirements. Just connect the red wire to 5V, the black wire to GND and the yellow or blue wire to a digital pin.

And include these two libraries down below to get temperature in Celsius and Fahrenheit.

OneWire from here.

DallasTemperature from here.

Most importantly, add a 4.75 K resistor between the red wire and the signal wire(yellow or blue) to elicit accurate temperature values from DS18B20 sensors.

Connections

Arduino Nano connections and pinmapping are well-explained at the source code down below.

As depicted below, attach the analog pin 0 between 1 K resistor and the piezo disk sensor to read it.

To control the L9110 Fan Motor rotation connect INA to the digital pin 3 and INB to the digital pin 4.

Putting Together All Parts

After making connections and uploading the source code to Arduino Nano, sturdier all connections by using a hot glue gun to place all parts on the old jar like this.

Features

1) Monitor temperature values gathered by the DS18B20 Temperature Sensor in Celsius and Fahrenheit along with the piezo disk sensor reading on the serial monitor.

2) In an emergency, turn the fan motor off by pressing the piezo disk sensor.

3-) Define a threshold value to activate the fan motor in this case above 25 Celsius. Also, you can define another threshold to change the direction of the fan as an indicator in this case above 80 Celsius.

Demonstration

Code

Source CodeArduino
         /////////////////////////////////////////////  
        //  Jar Temperature Detector and Cooling   //
       //                  Fan                    //
      //    -----------------------------        //
     //             Arduino Nano                //           
    //           by Kutluhan Aktar             // 
   //                                         //
  /////////////////////////////////////////////

// While measuring temperature on a project, you may need to act instantly to make connected parts cooler to protect the components as a fan works in a computer.
// Basically, this project is about to detecting temperature in Celsius above 25 degree to run the fan to descend it under the threshold, of course you can change it.
// Also, you will be able to monitor the temperature in Celsius and Fahrenheit along with the piezo disk sensor on the serial monitor by taking following steps down below.
//
// Connections
// Arduino Nano :           
//                                 Piezo Disk Sensor
// 5V  --------------------------- 5V
// GND --------------------------- GND
//                                 DS18B20 Temperature Sensor
// 5V  --------------------------- 5V
// D2  --------------------------- OUT
// GND --------------------------- GND
//                                 L9110 Fan Motor
// 5V  --------------------------- 5V
// GND --------------------------- GND
// D3  --------------------------- INA
// D4  --------------------------- INB


// Libraries for DS18B20 Temperature Sensor
#include <OneWire.h>
#include <DallasTemperature.h>

// Attach the bus pin to the temperature sensor.
#define ONE_WIRE_BUS 2

// Initial OneWire and DallasTemperature Libraries.
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);

// Define the piezoelectric disk pin to read.
#define piezoDisk A0

// Define INA and INB pins to change fan directions.
#define INA 3
#define INB 4

// Define variables to save values.
float Celsius, Fahrenheit;
int piezo;

// This boolean runs the fan if the temperature is above 25 Celsius.
boolean HighTemperature;

void setup() {
Serial.begin(9600);

pinMode(INA, OUTPUT);
pinMode(INB, OUTPUT);

// Activate the DS18B20.
DS18B20.begin();

}

void loop() {
get_Variables_From_Sensors();

digitalWrite(INA, LOW);
digitalWrite(INB, LOW);
// Depending on the state of the piezo disk, either end task or continue.
if(Celsius > 25 && piezo < 100){
   HighTemperature = true;
    while(HighTemperature == true){
      get_Variables_From_Sensors();
      digitalWrite(INA, HIGH);
      digitalWrite(INB, LOW);
        if(Celsius > 80){
            // At this temperature, change the fan direction opposite as an indicator.
            digitalWrite(INA, LOW);
            digitalWrite(INB, HIGH);
          }else if(Celsius < 25 || piezo > 100){
            // If temperature is below 25 Celsius, halt the task.
            HighTemperature = false;
          }
    }
}


}

void get_Variables_From_Sensors(){
  // Get data from the piezo disk.
  piezo = analogRead(piezoDisk);
  // Get temperature in Celsius and Fahrenheit from the DS18B20.
  DS18B20.requestTemperatures(); 
  Celsius = DS18B20.getTempCByIndex(0);
  Fahrenheit = DS18B20.toFahrenheit(Celsius);

  // Debug variables.
  Serial.print("Celsius: ");
  Serial.print(Celsius);
  Serial.print("\t\t");
  Serial.print("Fahrenheit: ");
  Serial.print(Fahrenheit);
  Serial.print("\t\t");
  Serial.print("PiezoDisk: ");
  Serial.print(piezo);
  Serial.print("\n");
  

}

Custom parts and enclosures

Fritzing File
jar_temperature_detector_and_cooling_fan_YQfpy6HnNf.fzz

Schematics

Schematic
Jar temperature detector and cooling fan h74qnzto6j

Comments

Similar projects you might like

The Vibrating Pressure Temperature Altitude Tilt Detector

Project tutorial by Kutluhan Aktar

  • 925 views
  • 0 comments
  • 4 respects

Arduino Control AC Water Heater temperature

Project tutorial by Mohannad Rawashdeh

  • 9,380 views
  • 0 comments
  • 6 respects

RFID Desk Lamp

Project tutorial by Kutluhan Aktar

  • 1,555 views
  • 0 comments
  • 3 respects

Doggo Water Bowl Refill Monitor/Indicator - Part 1

Project tutorial by Heathen_Hacks-v2

  • 706 views
  • 2 comments
  • 3 respects

Personal Weather Station (Arduino+ ESP8266 + Thingspeak)

Project tutorial by Jayraj Desai

  • 52,100 views
  • 32 comments
  • 109 respects

Arduino-Powered Water Bottle

Project tutorial by Md. Khairul Alam

  • 7,079 views
  • 5 comments
  • 31 respects
Add projectSign up / Login