• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » IoT IR Remote Control with ESP32 Arduino and IBM Watson IoT

By Abhishek Ghosh May 22, 2020 10:37 pm Updated on May 22, 2020

IoT IR Remote Control with ESP32 Arduino and IBM Watson IoT

Advertisement

In this article, we are discussing the overall hardware, code and library we will need. This article is not about building one particular project. Infrared (IR) remote control technology is widely used in day to day used devices. IR remote control signals are a reliable resource to control nearby electrical appliances. With the development of ESP32 like cheaper system on chip and Internet of things (IoT) technology, there is wider chance to control the devices remotely supporting IR remote control without any manipulation on the existing consumer-centric appliance such as air conditioner, television and so on. There is a small potential risk that IoT devices can be exploited maliciously to leak sensitive data. As we are simply controlling the devices which supports a limited range and has limited function, the risk is lower.

The ESP32 has IrDA support, but there is no documentation of how to wire it or about hardware requirements. ESP32 can directly generate the IRTX and decode the IRRX so it is just about adding minimal hardware like an IR-LED and an IR-Phototransistor. Infrared has two different modes, for remotes of television and air-conditioners, the one-way with modulation of 35 or 38 kHz is used. So for them, just switching the IR-LED on and off will build the 38 kHz Packet. Driving an IR remote transmitter using an official Arduino is easy, as there is a library named IRremote.h.

If you have an IR transmitter module, then attaching the signal pin to the appropriate Arduino pin with a current limiting resistor is all the wiring you need. KY-005 Infrared Transmitter Module (it is a transmitter module) emits infrared light at 38kHz. IR LEDs are usually made of gallium arsenide or aluminum gallium arsenide. KY-022 is the IR receiver module. This an example code for original Arduino boards :

Advertisement

---

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <IRremote.h>
IRsend irsend;
void setup()
{
Serial.begin(9600);
}
void loop()
{
   for (int i = 0; i < 50; i++) {
     irsend.sendSony(0xa90, 12); // Sony TV power code
     delay(40);
   }
}

But, that IRRemote.h Arduino library only supports receiving IR signals. To solve this issue, Andreas Spiess has a library to fully support ESP32 :

Vim
1
https://github.com/SensorsIot/Definitive-Guide-to-IR

The CIR (Commercial Infrared) Transmission Protocol cut-out the other sources of infrared radiation with a bandpass filter. The 940nm infrared transmitter is modulated by a carrier frequency in the 32-40 kHz range. This is how the receiver discriminates the IR signal and any unmodulated IR. So the IR receiver is tuned both to the wavelength and to the carrier frequency. The IR wavelength of the emitter and receiver should match.

The send-only code with infrared-LED and a resistor is this :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//HardwareSerial Serial1(1);
HardwareSerial Serial2(2); // GPIO 17: TXD U2  +  GPIO 16: RXD U2
 
void setup() {
    Serial.begin (115200); // (USB + TX/RX) to check
    Serial2.begin(115200); // GPIO 17: TXD U2  +  GPIO 16: RXD U2
 
    //UART_CONF0_REG  Configuration register 0
    //UART0: 0x3FF40020
    //UART1: 0x3FF50020
    //UART2: 0x3FF6E020
 
    WRITE_PERI_REG( 0x3FF6E020 , READ_PERI_REG(0x3FF6E020) | (1<<16 ) | (1<<10 ) );  //UART_IRDA_EN + UART_IRDA_TX_EN  "Let there be light"
    //Serial.print("Reg: "); Serial.println(READ_PERI_REG(0x3FF6E020),BIN);  //For Debug only
}//setup
 
void loop() {
    Serial.println("Hello");
    Serial2.println("Hello");
    delay(1000);
} //loop

The receive-only code with a phototransistor and a resistor is this :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//HardwareSerial Serial1(1);
HardwareSerial Serial2(2); // GPIO 17: TXD U2  +  GPIO 16: RXD U2
 
void setup() {
    Serial.begin (115200); // (USB + TX/RX) to check
    Serial2.begin(115200); // GPIO 17: TXD U2  +  GPIO 16: RXD U2
 
    //UART_CONF0_REG  Configuration register 0
    //UART0: 0x3FF40020
    //UART1: 0x3FF50020
    //UART2: 0x3FF6E020
 
    WRITE_PERI_REG( 0x3FF6E020 , READ_PERI_REG(0x3FF6E020) | (1<<16 ) | (1<<9 ) );  //UART_IRDA_EN + UART_IRDA_DPLX  "Let there be light"
    //Serial.print("Reg: "); Serial.println(READ_PERI_REG(0x3FF6E020),BIN);  //For Debug only
}//setup
 
void loop() {
    while (Serial2.available()) {
        Serial.print( (char) Serial2.read() );
        delay(2);
    } //while
} //loop

IoT IR Remote Control with ESP32 Arduino and IBM Watson IoT

We already have articles Controlling appliances with ESP32 and IBM Watson IoT and Android Apps to Control Devices Connected to IBM Watson IoT which will give a fair idea about how to send an HTTP request towards IBM’s server to get response on the connected remote ESP32. We have lot of example codes for IBM Watson Iot on our Github repository. The IoT part is just like switching a LED.

Probably you want to clone some brand’s remote. There are a lot of articles on the web on how to clone an IR remote for using with Arduino.

As for the Panasonic air-conditioners, this blog post will help.

Tagged With esp32 infrared , ir remote control esp32 , ir remote decoder using uart , ir sendor reat using esp32 relay control , ir transmitter esp32 , irremote esp32 , windows iot ir controller
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to IoT IR Remote Control with ESP32 Arduino and IBM Watson IoT

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • General Purpose Guide to Use ESP32 as Arduino

    WROOM ESP32 Dev Board is Powerful Arduino Board With Wi-Fi, Bluetooth. Here is a General Purpose Guide For Pin Identification, Required Changes in Blink Like Examples.

  • ESP32 vs Arduino : How ESP32 is Different from Arduino

    ESP32 is a low cost, low power consuming System on Chip (SoC) with integrated Wi-Fi and Bluetooth compatible with Arduino IDE.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy