ESP32 Air Conditioner Control Module

by hausofpayne17 in Circuits > Arduino

180 Views, 0 Favorites, 0 Comments

ESP32 Air Conditioner Control Module

Front Shot small.png
IR Remote.png
Module Inside 2.png
Module Inside.png
Panel back.png
IMG_0392.PNG

We have a zone-type air conditioner/heat pump in the upstairs bedroom. it works very well and is controlled by an infrared remote.

Unfortunately, the manufacturer has designed this particular 8 year old unit as follows:

Set the desired room temperature and run the unit. When the unit COOLS the room to the desired temperature, it starts to HEAT the room to bring the room UP to the desired temperature. The unit cycles between COOL and HEAT all the time. (WHY?)

Ideally, it would be preferred to just cool the room to a desired temperature and then turn off. Then as the room heats back up by so many degrees, it could start another cool cycle.

In this case, the project's Night Mode function just turns on the AC unit for an ON number of minutes and then turns it off for an OFF number of minutes as long as the system is in Night Mode.

The display is optional but it lets the user see the room temperature. The Blynk app also shows the temperature phone/device and is how the user turns on and off the unit remotely using the Blynk IOT App/Service. The ON and OFF durations are set with sliders in the Blynk device app.

What has been designed is an ESP32 circuit/sketch that sends On/Off signals to the air conditioning unit via the Infrared Transmitter LED.

The module is then controlled either by the BLYNK app on my phone/web browser or by the infrared Transmitter that can be kept in the room. The rocker switch on top of the module lets the user

Using the Blynk app, the user can turn the air conditioner on or off as needed as well as turn on Night Mode which cycles between an app-specified Minutes ON value and a Minutes OFF value.

It is assumed that you are very familiar with ESP32 programming as well as soldering components. There will be some instruction on how to create the Blynk components in the instructable.

Let's get started!

Supplies

  1. ESP32 Dev Board as preferred.
  2. OLED I2C Display (1.3") or desired size.
  3. Infrared Remote Control with at least 2 buttons.
  4. BME280 Temperature/Humidity/Pressure Module or clone.
  5. Infrared Transmitter LED - Infrared (IR) Emitter 940nm 1.2V 50mA 25mW/sr @ 50mA 20° Radial for example
  6. Infrared Receiver - VS1838B type
  7. DTSP Rocker Switch for controlling display/AC On/Off (or 2 momentary contact switches as desired.
  8. 2 10K pull down resistors for the switches.
  9. 1 N-channel transistor (ex. 3904 or 2222N type).
  10. 1 200R (up to 470R) resistor for the transistor Base. This increases the range of the transmitter.
  11. Enclosure and breadboard for the circuit.
  12. Connectors and wiring as preferred.

Construct the Circuit

Pin Assignments.png
schematic.png

Wire the circuit as you prefer. The table provided shows the pin assignments used.

The I2C OLED display and the BME280 sensor share the same SCL and SDA pins.

The switch sides (or buttons) are wired as typical pull down/signal buttons. Use 10K pull down resistors on the signal side of the switch/button.

The IR transmitter is wired with the N-channel transistor BASE pin being connected to the ESP32 GPIO via the 470R(up to 1K) resistor. See the diagram.

The IR receiver is wired as per the diagram.

Create the Blynk IOT Connectivity

Data Streams.png
Web Template.png
IMG_0392.PNG

Blynk is an extensive IOT service with vast amounts of functionality. You will need to go to "www.Blynk.io" and create an account for yourself. You may want to use a separate email for Blynk to keep your IOT apps separate from your regular email traffic. That's up to you.

For a simple application like this with only 2 switches, 2 sliders and a Temperature label, the service is FREE.

Download the Blynk app from the App Store/Android Play Store and install it on your device(s).

Follow this tutorial to learn how to create a simple Blinking LED application that can make an LED turn off or on based on a switch value. Once you've learned how to use Blynk, continue on with the instructable to design:

  1. The Datastream specifies the "virtual pins" that will hold the AC On/Off, Night Mode On/Off, Temperature, Night Mode On Minutes and Night Mode Off Minutes values.
  2. The template is the web layout of the switch,slider and label widgets.
  3. The layout will need to be separately designed on the phone/tablet app. Its a very similar design process for the template. YOU DO NOT need to recreate the datastream as you're using the one you created on the website.

Adjust and Upload the Arduino Sketch

Sketch Customizations.png

There are several libraries you need to install on your IDE to handle the OLED display, BME280 sensor, Blynk connectivity and the infrared transmit and receive functions. Use the #include statements at the top of the sketch to help you find the correct libraries.

Looking at the photo, you see the Blynk IOT connectivity and WiFi Credential lines you must modify.

There will be infrared remote sender/receiver functions are in IRremoteESP8266.h library. You'll see that this project uses the Daikin library, ir_Daikin.h which has the appropriate codes for that brand. You'll need to find/experiment with a library appropriate to your brand of air conditioner to get the functionality you want.

Down in the Infrared section you'll see the codes for the remote. By uncommenting the section at the top, it will display the codes your remote control buttons generate. Make a note of these and put them into the code logic for the AC On/Off and the Night Mode On/Off sections.

Save the updated sketch, compile it and upload it to your ESP32/circuit.

Test/Use Your Device

Start with trying to get your Blynk app to turn the AC Unit On/Off and then test the Night Mode On/Off switch in the app.

You'll see that if the AC is ON, and you turn on Night Mode, it will turn OFF the AC mode switch.

Test your remote control for the AC On/Off and Night Mode On/Off functionality. Again, it updates the Blynk App server with the switch positions that your remote button presses generate. Same goes for the AC On/Off rocker/push switch on the module. It also updates theBlynk App server values.

This has been one of my more complex projects, especially with respect to the logic of keeping the states of the module in sync with whether or not the air conditioner is on or off at any given time.

I tried to find a way to passively detect if the air conditioner was on or off before sending commands. As of this writing, I'll just control my AC unit as originally designed.

In the future, I may choose to include a "Temperature Hold" function which will let the AC unit run until a temperature is reached and then shut off. Once a certain number of degrees warmer is met, it can come on again and bring the temperature down again.

Thank you for your interest in this project.

NOW GO MAKE SOMETHING WONDERFUL!