Skip to content

e-tinkers/esp32_ir_remote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 IR Remote

ESP32 Web Server and IR remote

This repo is the implementaiton of an ESP32 IR remote (and a ESP32 web server) that I described on my blog Build an ESP32 Web Server and IR Remote. The ESP32 is programmed to provide the following key features and functionalities:

  • Web server supporting GET and POST requests
  • Serving static content such as html and css from on-board SPIFFS
  • Connect to home router over WiFi Station mode with a Static IP, Gateway
  • Sending command and reading temperature/humidity information via web Interface
  • Control remote home appliances such as TV/Set-top box via Infra red (IR) transmission

System Diagram

ESP32 IR Remote System Diagram

Pre-requisitions

The code requires Arduino core for the ESP32 to be installed.

The file structure of this repo is based on PlatformIO development environment. Arduino IDE can be used as well but the file structure may not make sense for the Arduino IDE environemnt.

Dependencies

The ESP32 back-end rely on a few libraries to be installed:

  • ESP32-IRremote is a modified version of IRremote - Send and receive infra-red signals.
  • ESPAsyncWebServer - Async HTTP and WebSocket Server for ESP8266.
  • SPIFFS - Provides the functionalities for supporting SPIFFS file system on embedded targets.
  • ArduinoJson - A C++ JSON library for Arduino and IoT (Internet Of Things).
  • SHT21 - A library for Sensirion SHT21 temperature and humidity sensor.

Most of these libraries can be installed either via PlatformIO Library Manager or Arduino Library Manager from respective IDE. However: In the ESP32-IRremote, the irSend.cpp is modified from original irSend.cpp of IRremote to support ESP32 send functionality as the original library only support receive function for ESP32. This modified library is not officially registered with PlatformIO library manager, and need to download it manually and put into your PlatformIO project /lib directory. If you clone this repo, it is included in the /lib directory.

The SHT21 is another library that is not officially supported by PlatformIO library manager, so you have to download it manually and put it into your PlatformIO project /lib directory. Again, this repo included it if you clone this repo.

Static web content

In order to save the memory and bandwidth, fontawesome web font and DSEG font css files are specially trimmed and incorporated into the main style.css file, only .woff are included to cut down nearly 850kB+ of file size.

SPIFFS Filesystem

To upload the files to SPIFFS, it requires an Arduino IDE plugin to be installed and create a data directory. Follow the plugin README instruction for uploading data to ESP32 SPIFFS. Uploading data to SPIFFS does not work on PlatformIO (at least I couldn't figure out how), so you will have to use Arduino IDE for doing it.

Static IP for WiFi connection

The program starts as a WiFi station with a pre-defined static IP and gateway IP. Be sure to change the static IP and gateway information prior compilation. The default Static IP is 192.168.0.200 and the gateway is 192.168.0.1 with a netmask of 255.255.255.0. Be sure you also make the change of WiFi SSID and Password as well:

// replace the ssid and password
const char* ssid     = "your_WiFi_SSID";
const char* password = "your_WiFi_password";

ESP32 IR Remote Schematic

ESP32 IR remote schematic

Demo Video

ESP32 Web Server and IR remote

There is also a video of my 10-min talk about this project on Singapore Hackware meetup event on 3 Dec, 2019.

About

An IR remote with a web interface and an ESP32 web server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published