Smart Cooling System for Manufacturing Machines Using Favoriot

1. Introduction

In the manufacturing industry, machines operate for extended periods, causing their temperature to rise significantly. Overheating can reduce efficiency, increase energy consumption, and lead to machine damage. Therefore, an intelligent cooling system that can automatically control machine temperature is highly necessary.

In this project, we will develop a Smart Cooling System that will automatically regulate machine temperature based on data from temperature sensors and machine workload. This data will be sent to the Favoriot IoT Platform for real-time monitoring, and the system will turn the cooling fan on or off automatically depending on the recorded temperature.


2. List of Components

  • Microcontroller: ESP32 or Arduino Uno + ESP8266
  • Temperature Sensor: DHT22 or DS18B20
  • Current Sensor (Optional): ACS712 (for measuring machine workload)
  • Relay Module: To control the fan
  • Cooling Fan: 12V
  • Power Supply: 5V for ESP32 and 12V for the fan
  • WiFi Connection for sending data to Favoriot

3. Hardware Connections

3.1 ESP32 Connections

Component ESP32 Pin
DHT22 (VCC) 3.3V
DHT22 (GND) GND
DHT22 (Data) GPIO4
Relay (IN) GPIO5
Relay (VCC) 5V
Relay (GND) GND
Fan (+) Connect to NO Relay
Fan (-) Connect to COM Relay

4. ESP32 Code for Sending Data to Favoriot Using REST API

#include <WiFi.h>
#include <HTTPClient.h>
#include <DHT.h>

#define DHTPIN 4     // DHT22 Pin
#define DHTTYPE DHT22
#define RELAY_PIN 5  // Relay Pin for fan

const char* ssid = "WIFI_SSID";
const char* password = "WIFI_PASSWORD";

String favoriotAPIKey = "YOUR_FAVORIOT_API_KEY";
String deviceID = "YOUR_DEVICE_ID";

DHT dht(DHTPIN, DHTTYPE);

void setup() {
    Serial.begin(115200);
    WiFi.begin(ssid, password);
    dht.begin();
    pinMode(RELAY_PIN, OUTPUT);
    
    while (WiFi.status() != WL_CONNECTED) {
        delay(1000);
        Serial.println("Connecting to WiFi...");
    }
    Serial.println("WiFi Connected!");
}

void loop() {
    float temperature = dht.readTemperature();
    if (isnan(temperature)) {
        Serial.println("Failed to read temperature!");
        return;
    }
    
    Serial.print("Temperature: ");
    Serial.print(temperature);
    Serial.println(" °C");

    // Send data to Favoriot
    sendDataToFavoriot(temperature);

    // Control fan based on temperature
    if (temperature > 50) {
        digitalWrite(RELAY_PIN, HIGH);
        Serial.println("Fan Turned On");
    } else {
        digitalWrite(RELAY_PIN, LOW);
        Serial.println("Fan Turned Off");
    }

    delay(5000);
}

void sendDataToFavoriot(float temperature) {
    if (WiFi.status() == WL_CONNECTED) {
        HTTPClient http;
        http.begin("https://apiv2.favoriot.com/v2/streams");
        http.addHeader("Content-Type", "application/json");
        http.addHeader("Apikey", favoriotAPIKey);

        String jsonData = "{\"device_developer_id\": \"" + deviceID + "\", \"data\": {\"temperature\": " + String(temperature) + "}}";

        int httpResponseCode = http.POST(jsonData);
        if (httpResponseCode > 0) {
            Serial.println("Data successfully sent to Favoriot!");
        } else {
            Serial.print("Failed to send data: ");
            Serial.println(httpResponseCode);
        }
        http.end();
    } else {
        Serial.println("WiFi not connected!");
    }
}


5. Favoriot Configuration

5.1 Register & Create Device

  1. Sign up for an account at Favoriot
  2. Go to “Devices” → Click “Add Device”
  3. Enter Device Developer ID (e.g., SmartCoolingSystem)
  4. Copy the API Key for use in the ESP32 code

5.2 Viewing Data in Favoriot

  1. Go to “Streams” → Temperature data will be displayed
  2. Create temperature graphs for real-time monitoring
  3. Set Rules to send notifications if the temperature exceeds the limit


6. Enhancements & Improvements

Using MQTT or CoAP

  • MQTT or CoAP can be used as an alternative to REST API for more efficient data transmission.

Telegram Notifications

  • Use Favoriot Webhook to send high-temperature alerts to Telegram.

AI Data Analysis

  • Use Python with Favoriot API to detect overheating patterns.

Remote Control

  • Add a control button in the Favoriot Dashboard to manually turn the fan on/off.

7. Conclusion

This project enables real-time machine temperature monitoring, reducing energy costs, and preventing damage due to overheating. With Favoriot Cloud, all data can be analyzed and accessed from anywhere.

This project can be further developed with additional sensors, AI for machine failure prediction, or smart notifications for factory operators.

If you have any questions or want to add new features, let me know!

Reference

Favoriot Documentation

Disclaimer

This article provides a step-by-step guide. The source code may need adjustments to fit the final project design.

Podcast also available on PocketCasts, SoundCloud, Spotify, Google Podcasts, Apple Podcasts, and RSS.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share This

Share this post with your friends!

Discover more from IoT World

Subscribe now to keep reading and get access to the full archive.

Continue reading