I assembled board + thermometer AM2320 + IR receiver VS1838B + IR emitter (D7 pin). I used 2 different sketches to read raw codes from RC of AC and took 2 different type of data.
In sketches number of pins may varys coz I did some experiments with different pins and mb uploaded here not last sctech with actual pin number.
I don't know C++ all code provided by vibe coding of gemini & qwen AIs
with this sketch
Main problem that board sends codes but AC doesn't react at all, but camera of smartphone shows that IR emitter lights shortly.
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
// IR receiver pin number (D7 = GPIO13)
const uint16_t kRecvPin = 13;
// Buffer settings
const uint16_t kCaptureBufferSize = 1024;
const uint8_t kTimeout = 50; // for air conditioners
const uint8_t kMinUnknownSize = 12;
const uint8_t kTolerancePercentage = kTolerance;
IRrecv irrecv(kRecvPin, kCaptureBufferSize, kTimeout, true);
decode_results results;
void setup() {
Serial.begin(115200);
delay(200); // Allow Serial to start
irrecv.setUnknownThreshold(kMinUnknownSize);
irrecv.setTolerance(kTolerancePercentage);
irrecv.enableIRIn();
Serial.println("IRrecvDump is ready. Press remote buttons...");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(resultToHumanReadableBasic(&results));
Serial.println(resultToSourceCode(&results));
Serial.println(); // empty line for readability
irrecv.resume(); // ready for next reception
}
}
I took power off code
Protocol : TCL112AC
Code : 0x23CB260200404000830000000028 (112 Bits)
uint16_t rawData[227] = {3086, 1616, 472, 1114, 472, 1114, 472, 326, 492, 326, 492, 326, 492, 1114, 472, 326, 494, 324, 494, 1114, 474, 1114, 472, 326, 494, 1114, 472, 326, 494, 326, 494, 1114, 472, 1114, 472, 326, 494, 1114, 474, 1114, 472, 326, 494, 326, 494, 1114, 472, 326, 494, 326, 494, 324, 494, 1114, 472, 326, 494, 324, 494, 324, 496, 324, 494, 324, 494, 326, 494, 326, 494, 324, 494, 324, 494, 324, 494, 324, 496, 324, 494, 326, 492, 328, 492, 326, 494, 324, 496, 324, 494, 324, 494, 326, 494, 324, 494, 1114, 472, 326, 494, 324, 494, 326, 494, 324, 496, 324, 494, 324, 494, 326, 494, 1114, 474, 324, 494, 326, 492, 326, 496, 324, 494, 324, 496, 324, 494, 326, 496, 324, 494, 326, 494, 1114, 474, 1114, 472, 326, 494, 324, 496, 324, 494, 324, 494, 324, 494, 1112, 474, 324, 494, 326, 494, 326, 494, 324, 494, 324, 494, 324, 496, 324, 494, 324, 494, 326, 494, 324, 496, 324, 494, 324, 494, 324, 494, 326, 494, 326, 494, 324, 494, 324, 494, 324, 496, 324, 494, 324, 494, 324, 494, 324, 494, 324, 494, 324, 494, 324, 494, 324, 494, 326, 494, 326, 494, 326, 494, 324, 494, 326, 494, 326, 494, 324, 494, 324, 496, 324, 494, 1114, 474, 324, 494, 1092, 492, 326, 494, 324, 494}; // TCL112AC
uint8_t state[14] = {0x23, 0xCB, 0x26, 0x02, 0x00, 0x40, 0x40, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x28};
power on
Protocol : TCL112AC
Code : 0x23CB260200404000830000000028 (112 Bits)
uint16_t rawData[227] = {3086, 1616, 472, 1114, 472, 1114, 472, 326, 494, 326, 494, 326, 494, 1114, 472, 326, 494, 326, 492, 1114, 472, 1114, 472, 328, 492, 1114, 470, 328, 492, 328, 492, 1116, 470, 1116, 470, 328, 492, 1116, 470, 1116, 470, 328, 492, 326, 492, 1116, 470, 328, 492, 326, 492, 326, 492, 1116, 470, 328, 492, 328, 492, 328, 492, 326, 492, 326, 492, 328, 492, 326, 492, 328, 492, 328, 492, 328, 492, 326, 492, 326, 492, 328, 490, 328, 492, 328, 492, 326, 492, 326, 492, 328, 490, 328, 492, 326, 492, 1116, 472, 326, 492, 326, 492, 328, 492, 326, 492, 326, 492, 328, 492, 328, 494, 1114, 472, 326, 492, 326, 492, 326, 494, 326, 492, 328, 492, 326, 492, 326, 492, 328, 492, 326, 492, 1116, 470, 1114, 472, 326, 492, 326, 492, 326, 492, 328, 494, 326, 492, 1114, 472, 326, 492, 328, 492, 326, 494, 326, 492, 328, 492, 324, 494, 326, 494, 326, 492, 326, 494, 324, 494, 326, 492, 328, 492, 326, 492, 328, 492, 328, 468, 350, 470, 350, 470, 350, 470, 348, 494, 326, 496, 324, 496, 324, 496, 324, 496, 324, 494, 324, 494, 326, 494, 326, 492, 326, 492, 328, 492, 328, 492, 328, 492, 326, 492, 328, 490, 328, 490, 328, 492, 1114, 472, 328, 490, 1114, 472, 328, 490, 330, 490}; // TCL112AC
uint8_t state[14] = {0x23, 0xCB, 0x26, 0x02, 0x00, 0x40, 0x40, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x28};
but with this sketch power functions look different
#include <IRremoteESP8266.h> // Main library for IR reception on ESP
#include <IRrecv.h> // Class for IR receiver
// Define the pin to which the IR receiver's output (OUT) is connected
// D4 corresponds to GPIO2 on WeMos D1 R2. (Note: The original comment said D2/GPIO4, but D4 is GPIO2 on WeMos D1 R2)
// This is a good choice for an IR receiver on ESP8266.
const uint16_t IR_RECEIVE_PIN = D4; // Using D4
// Create an IRrecv object for receiving signals
IRrecv irrecv(IR_RECEIVE_PIN);
// Buffer to store raw data needed for decoding
decode_results results;
// Manually define USECPERTICK. Typically 1 tick = 50 microseconds.
// This value is fundamental for IR protocols.
#define MY_USECPERTICK 50
void setup() {
Serial.begin(115200);
while (!Serial) {
delay(10);
}
Serial.println("--- IR Receiver (IRremoteESP8266 - Fully Manual RAW Output, with Hardcoded USECPERTICK) ---");
Serial.print("IR receiver connected to D");
Serial.print(digitalPinToInterrupt(IR_RECEIVE_PIN)); // Print D-pin number
Serial.print(" (GPIO");
Serial.print(IR_RECEIVE_PIN); // Print GPIO number
Serial.println(")");
Serial.println("\nWaiting for IR signals...");
// Enable IR signal reception
irrecv.enableIRIn();
}
void loop() {
// Check if there is a new IR signal
if (irrecv.decode(&results)) { // If signal received and decoded
Serial.print("\nReceived IR signal: ");
// Print protocol type (numeric code) and HEX value
Serial.print("Protocol (type): "); Serial.print((uint8_t)results.decode_type);
Serial.print(" - Value (HEX): 0x");
Serial.print(results.value, HEX);
Serial.print(", Length (bits): ");
Serial.println(results.bits);
// If value = 0xFFFFFFFF, this often means a repeat signal
if (results.value == 0xFFFFFFFF) {
Serial.println(" (This is a repeat signal)");
}
// Print raw data (RAW pulses)
Serial.print(" RAW data (pulses, us): [");
for (uint16_t i = 0; i < results.rawlen; i++) {
// Use our manually defined value
Serial.print(results.rawbuf[i] * MY_USECPERTICK);
if (i < results.rawlen - 1) {
Serial.print(", ");
}
}
Serial.println("]");
irrecv.resume(); // Important: Continue receiving the next signal
}
yield(); // Required for ESP8266
}
OFF
Protocol (type): 5 - Value (HEX): 0xC4D364400002, Length (bits): 48
RAW data (pulses, µs): [50, 77150, 39800, 12400, 27300, 12350, 27350, 12350, 8100, 13050, 7450, 13050, 7400, 13050, 26650, 12350, 8100, 13050, 7450, 13050, 26600, 12400, 27300, 12350, 8100, 13000, 26650, 12350, 8100, 13050, 7450, 13050, 26600, 12350, 27300, 12400, 8100, 13050, 26600, 12450, 27250, 12350, 8100, 13050, 7450, 13050, 26600, 12400, 8100, 13050, 7450, 13050, 7450, 13050, 26650, 12350, 8100, 13050, 7450, 13050, 7400, 13050, 7450, 13050, 7450, 13100, 7350, 13050, 7450, 13000, 7450, 13050, 7400, 13050, 7450, 13050, 7450, 13050, 7450, 13050, 7450, 13050, 7450, 13050, 7450, 13000, 7450, 13000, 7450, 13050, 7400, 13050, 7400, 13050, 7450, 13050, 26600, 12350, 8100, 13050]
Protocol (type): 5 - Value (HEX): 0xC4D364800004, Length (bits): 48
RAW data (pulses, µs): [50, 77200, 39800, 12400, 27300, 12400, 27250, 12400, 8100, 13000, 7450, 13050, 7450, 13000, 26600, 12400, 8100, 13050, 7400, 13050, 26600, 12400, 27250, 12350, 8100, 13050, 26600, 12400, 8100, 13000, 7450, 13050, 26600, 12350, 27300, 12350, 8100, 13050, 26650, 12350, 27300, 12400, 8100, 13000, 7450, 13000, 26650, 12350, 8100, 13050, 7450, 13000, 26650, 12400, 8100, 12450, 8000, 13050, 7450, 13050, 7450, 12450, 8000, 13050, 7400, 13050, 7450, 12450, 8000, 13050, 7450, 12450, 8050, 12450, 8000, 12450, 8000, 12450, 8050, 13000, 7450, 12450, 8050, 12400, 8050, 12500, 8000, 12450, 8000, 12450, 8000, 12450, 8050, 12400, 27200, 12350, 8100, 12450, 8050, 12450]
ON
Received IR signal: Protocol (type): 5 - Value (HEX): 0xC4D364400002, Length (bits): 48
RAW data (pulses, µs): [50, 77150, 39800, 12450, 27250, 12350, 27250, 12400, 8100, 13050, 7400, 13050, 7450, 13050, 26600, 12350, 8100, 13050, 7400, 13050, 26550, 12400, 27300, 12350, 8100, 13050, 26600, 12350, 8100, 13050, 7400, 13050, 26600, 12350, 27300, 12350, 8100, 13050, 26600, 12400, 27300, 12350, 8100, 13050, 7400, 13050, 26600, 12350, 8100, 13050, 7450, 13050, 7400, 13050, 26600, 12400, 8100, 13050, 7400, 13050, 7450, 13050, 7400, 13050, 7450, 13050, 7400, 13050, 7400, 13050, 7450, 13050, 7400, 13050, 7400, 13050, 7450, 13050, 7400, 13050, 7450, 13050, 7450, 13050, 7400, 12500, 8000, 12400, 8050, 13050, 7450, 12450, 8000, 13050, 7450, 12400, 27250, 12350, 8100, 13050]
Received IR signal: Protocol (type): 5 - Value (HEX): 0xC4D364800024, Length (bits): 48
RAW data (pulses, µs): [50, 77900, 39150, 13000, 26650, 13050, 26650, 12400, 8050, 12400, 8100, 12350, 8100, 12450, 27200, 12400, 8100, 12400, 8100, 12400, 27250, 12400, 27250, 12400, 8100, 12350, 27250, 12400, 8100, 12350, 8100, 12350, 27250, 12400, 27250, 12400, 8100, 12400, 27250, 12400, 27250, 12400, 8100, 12400, 8100, 12400, 27250, 12400, 8100, 12400, 8100, 12400, 27250, 12400, 8100, 12400, 8100, 12350, 8100, 12350, 8100, 12350, 8100, 12350, 8100, 12400, 8100, 12350, 8100, 12350, 8100, 12350, 8100, 12350, 8100, 12350, 8100, 12350, 8100, 12400, 8100, 12350, 8100, 12350, 8150, 12350, 8150, 12350, 27300, 12350, 8100, 12350, 8150, 12350, 27250, 12350, 8150, 12350, 8150, 12350]
may be I an on wrong direction and AIs suggested for me to use not right sketch pls point me where to go.
AC model Family Comfort Plus 32