Skip to content

ESP32 Smart IR remote for National A75C219 Air Conditioner

Notifications You must be signed in to change notification settings

diysmartmatter/ir_NationalA75C219

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ir_NationalA75C219

ESP32 Smart IR remote for National A75C219 Air Conditioner
This program uses IRremoteESP8266 library. https://github.com/crankyoldgit/IRremoteESP8266

The target of this library is National (old name of Panasonic) A/C (air conditioner) that uses National A75C219 remote controller.

A75C219

Background

The IRremoteESP8266 library has excellent classes for a varaety of A/C on market, although the target National A/C is so old that it is out of support. This is a simple implementation of a class to support with minimal functions required by Apple HomeKit.

IR Signal

This is an example of the IR signal pattern when the power button on the remo is pressed with settings of cool, 27 degree, auto fanspeed.

IR pattern

By assigning { 875 micro-sec high, 875 low} to 0, and {875 high, 2625 low} to 1, and assuming the bit sequence is LSB to MSB, this pattern can be decoded as followings.

0xfc 0xfc 0x02 0x02
0xfc 0xfc 0x02 0x02

0x00 0x00 0x36 0x36
0x00 0x00 0x36 0x36

Apparently, data of 4 bytes, {0xfc, 0x02, 0x00, 0x36} are repeated 4 times for each. By changing mode, temp, fan settings, bits of the data of 4 bytes should be assigned as follows.

Byte

MSB <---> LSB

7 6 5 4 3 2 1 0
0

Fan speed (0xF:auto 0x6:high 0x4:mid 0x2:low)

Temerature - 15

1

0x00

Stay power*

2:cool, 3:dry, 4:heat, 6:auto

2

0x04:swing, 0x00:no swing

3

0x36 (something for timer settings)

Stay power*  0:toggle On/Off 1:no toggle

When the "stay power" bit is 0, the power of the A/C toggles, while the "stay power" bit is 1, the power will not toggle but temperature or fan-speed are set.

Hardware

You could buid the hardware, i.e. smart IR remote controller using ESP32:

ESP32

Diagram

that can be used by Apple HomeKit as a Heater/Cooler accessory.

HomeKit

Resolving toggle issue

The state of the A/C is unpredectable when the IR signal toggles the power of the A/C. To detect actual state of the A/C power, a magnet-contact sensor is used to attache to the flap of the A/C.

 

The sensor is a Zigbee contact sensor that works with Zigbee2MQTT server. Any contact-sensor that is suported by Zigbee2MQTT can be used. The sensor in the photo is:

https://ja.aliexpress.com/item/1005004779586263.html

I have set the Zigbee2MQTT to publish a message like this,

{"battery":100,"battery_low":false,"contact":true,"linkquality":138,"tamper":false,"voltage":3000}

to the following topic.

zigbee2mqtt/irNational/set/Flap

Prerequisite

Over view of the setup.

Following components are required.

  • Homebridge (running on Rasbperry Pi)
  • Plug-in for MQTT (MQTTThing) (running on Rasbperry Pi)
  • MQTT (Mosquitto) (running on Rasbperry Pi)
  • Zigbee contact sensor attached to the A/C flap
  • Zigbee2MQTT server (running on Rasbperry Pi)
  • Arduino IDE
  • ESP32 with IR LED(s)
  • ESP32 Arduino (Board manager)
  • Arduino libraries:
  • IRremoteESP8266
  • ArduinoOTA
  • EspMQTTClient
  • DHT20 (optional)

How to use

  • Create an Arduino sketch using IR_airconMQTT_n.ino, ir_National.h, and ir_National.cpp. (WiFi info and address should be changed to yours)
  • Set up MQTTThing so that Homebridge can communicate with ESP32 through MQTT

This is an example of Homebridge config for MQTTThing.

 {
    "type": "heaterCooler",
    "name": "NationalAC",
    "url": "mqtt://localhost:1883",
    "topics": {
        "setActive": "zigbee2mqtt/irNational/set/Active",
        "getActive": "zigbee2mqtt/irNational/get/Active",
        "setCoolingThresholdTemperature": "zigbee2mqtt/irNational/set/CoolingThresholdTemperature",
        "getCurrentTemperature": "zigbee2mqtt/your_temp_sensor$.temperature",
        "setHeatingThresholdTemperature": "zigbee2mqtt/irNational/set/HeatingThresholdTemperature",
        "setRotationSpeed": "zigbee2mqtt/irNational/set/RotationSpeed",
        "setTargetHeaterCoolerState": "zigbee2mqtt/irNational/set/TargetHeaterCoolerState",
        "setSwingMode": "zigbee2mqtt/irNational/set/SwingMode"
    },
    "accessory": "mqttthing"
},

How the program works

When HomeKit requests A/C operations, MQTT messages are published in several topics. The ESP32 progra subscribes them and send IR patterns.

When the A/C flap opens or closed, the Zigbee contact sensor detects and Zigbee2MQTT server publishes a true or false message to set/Flap topic. The ESP32 that is subscribing the topic, publishes a false or true messaget to get/Active topic. This will switches the A/C on/off status in the HomeKit system.

The ESP32 monitor the temp/humi sensor (DHT20) in every 10 second, and it publishes the temp/humi value so that HomeKit updates the current temperature. In case temp/humi value is identical to the previous measurement in 10 second ago, ESP32 will not publishes, except when the measurement remains same for more than 5 min.

About

ESP32 Smart IR remote for National A75C219 Air Conditioner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages