Boris Shabanov
Published

ESP8266 AC Controller

Simple PCB that controls air conditioner over the internet.

BeginnerShowcase (no instructions)2 hours10,881
ESP8266 AC Controller

Things used in this project

Hardware components

IR transmitter (generic)
×1
ESP8266 ESP-01
Espressif ESP8266 ESP-01
This is used for the first version
×1
ESP-WROOM-02
Espressif ESP-WROOM-02
This is used for the second version
×1

Story

Read more

Schematics

AC WiFi controller v1

This is the schematic of the first version of the controller

AC WiFi controller v2

Code

Example for testing AC controller

Arduino
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Fujitsu.h>
 
ESP8266WebServer server(80);
 
const char* ssid = "";
const char* password =  "";

// ESP8266 GPIO pin to use. Recommended: 4 (D2).
const uint16_t kIrLed = 4;

// Set the GPIO to be used for sending messages.
IRFujitsuAC ac(kIrLed); 
 
void setup() {
 
    // Use for debuging
    Serial.begin(115200);
    
    WiFi.mode(WIFI_STA);
    //Connect to the WiFi network
    WiFi.begin(ssid, password);
 
    //Wait for connection
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.println("Waiting to connect...");
    }
 
    //Print the local IP
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());
 
    //Associate the handler function to the path
    server.on("/on", turnOn); 
    server.on("/off", turnOff);
 
    //Start the server
    server.begin();
    Serial.println("Server listening");

    // Init Fujitsu AC
    ac.begin(); 
    ac.setModel(ARREB1E);
}
 
void loop() {
    //Handling of incoming requests
    server.handleClient();
}

void turnOff() {
    ac.setCmd(kFujitsuAcCmdTurnOff);
    ac.send();

    server.send(200, "text/plain", "AC OFF");
    Serial.println("AC OFF");
}
 
void turnOn() {
      ac.setSwing(kFujitsuAcSwingVert);
      
      // Set Mode
      if (server.hasArg("mode")== false) {
        ac.setMode(kFujitsuAcModeCool);
      } else {
        ac.setMode( server.arg("mode") == "cool" ? kFujitsuAcModeCool : kFujitsuAcModeHeat);
      }
      
      // Set fan speed
      ac.setFanSpeed(kFujitsuAcFanAuto);
      
      // Set temp
      if (server.hasArg("temp")== false) {
        ac.setTemp(23);
      } else {
        ac.setTemp(server.arg("temp").toInt());
      }
      ac.setCmd(kFujitsuAcCmdTurnOn);
      ac.send();
 
      server.send(200, "text/plain", "AC ON");
      Serial.println("AC ON");
}

Credits

Boris Shabanov

Boris Shabanov

7 projects • 5 followers

Comments