Smart Remote using ESP32

Author: Cristina Iordache

Master Program: ACES

Source code on GitLab: https://gitlab.com/iordache.cristinaa98/iot-project

Description

The goal for this project is to create a smart remote controller for non-smart air conditioners. The system will be interfaced with Google Home and it will receive commands from Google and change the state of air conditioner depending on what is received. Also the mode of the air conditioner can also be changed depending on the data received by a temperature and humidity sensor.

I chose this project because I have a non-smart air conditioner and I want to control its state remotely.

Functional Specification

The project has the following functionalities:

  1. when a command is issued through any google device (like “Hey Google, turn on the air conditioning”), the system will execute the command on the AC device.
  2. the system will also intercept commands from the regular IR remote control and update the status in the Cloud.
  3. the mode of the AC device will be set automatically depending on the target temperature and the current temperature and humidity in the room.

System architecture description

The data flow can be seen in the picture below:

Hardware description

For the hardware were used the following components:

  • ESP32 - low power SOC, integrated with Wi-Fi and dual-mode Bluetooth
  • TSOP 31240 - IR receiver that will receive the IR signals from the existing remote controller and the commands that will be give to the AC
  • Resistor - 40 ohm resistor that limits the current through the IR led to 25-30 mA.
  • n channel MOSFET - is used as a switch to drive current through the IR led. The same effect could have been achieved using a resistor with a lower resistance and powering the led directly from the digital pin. However there is a 40 mA limit for a digital pin and right now there are 45 mA of current through the diode when it is in conduction. It is preferred to use a n channel transistor because is more efficient than p channel.
  • DHT11 - temperature and humidity sensor, used to acquire data in order to control the AC mode
  • IR led - IR transmitter, used to send the commands to the AC

Software description

For software development, I used Arduino IDE.

Libraries used

Execution Flow

The execution flow is presented in the diagram below.

SinricPro utilization

Sinric Pro is a web platform that enables developers to integrate IoT development boards with devices like Google Home. The API can be used to retrieve device logs, find devices, and update devices. For this project, SinricPro was used in order to receive commands from Google devices and send them to the ESP32 Microcontroller.

First, an account on this platform must be made. After the account is created, log in and create an device on the platform, from Devices tab in the left page.

Here you must complete the Device Name, Description and to choose the device that is going to be controlled. There are many options, including an AC.

After completing all the tabs, the device will be created and visible in the platform and a key will be generated. A key that will be used from the program to update the data in the cloud. Also after the account was create an APP_KEY and APP_SECRET are created in order to connect to the platform from the program.

#define APP_KEY "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" 
#define APP_SECRET "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" 
#define DEVICE_ID "63bafbf161ff9a367127b578" ''

Google Home app

In order to connect a Google device with SinricPro platform, download the Google Home application. After that, select the ”+” button from the left corner and choose Set up a device.

Next choose Works with Google and there search for the platform SinricPro, in this case.

After this the connection is established.

ISSUES

  • Working with tasks: In initial implementation, I tried to make use of both cores available on the ESP32 Microcontroller. The flow was designed to have one core that is always listening for commands sent by Google via SInricPro and the other core was designed to receive the IR signal from the remote controller and to send the commands to the AC. Searching for a solution, implementing tasks seemed to be a good approach. For this, two task were created, each one running on different a core. Each task had a specific function, in my case ListenToGoogle and RemoteController. The core that was running ListenToGoogle was working correctly, but the other task had an issue. Every time a command was sent to AC, the command was not received correctly and I could not identify why. But in my opinion the problem could be because the timers that were shared by the two cores. The solution was to move all the functionality to a single core.
  • Google Home does not recognize some commands: When I was trying to tell Google to change operation mode to HEAT it was not working. Apparently only a thermostat supports the heating mode.

Demo

Conclusions

The development of this project was interesting. Because my air conditioner is not smart, now I can control it using Google Home app and for the hot summer days this will be useful.

There are a lot of useful libraries developed that can be used in projects like these. The library that deals with the signal received and sent to the AC is up to date and has a wide coverage when it comes to air conditioner manufacturers. This project works for only one type of air conditioner but can be easily changed depending of the air conditioner type.

Resources

iothings/proiecte/2022/smart-remote.txt · Last modified: 2023/01/20 02:47 by cristina.iordache98
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0