ESP32 IRremote - need help to understand the Raw data

Hi,

I have an old Microlab sound box with an old IR remote. I want to create a copy of that remote using esp32. (also want to put those data in an android app-"IR Remote Creator" to use mobile IR to control the sound box).

Initially I installed IRremote library & tried to receive the raw data of each button. Which I received as below, but I have no idea how i can use this data.

Protocol=UNKNOWN Hash=0xE917A076 12 bits (incl. gap and start) received
Received noise or an unknown (or not yet enabled) protocol
rawData[24]:
-34900
+1350,- 350
+1350,- 350 +1300,- 350 + 500,-1200 +1350,- 350
+ 450,-1250 + 450,-1200 +1350,- 350 + 500,-1200
+ 450,-1250 + 450,-1200 + 500
Sum: 19050

From this data, I need to know the protocol(if possible), frequency(Must) & Start-end time(if possible). How can I get these.

I need to put frequency & raw data inside the app as attached in below image.

Please also help me if it is possible to make a IR remote using ESP32 with this data.

The code I used to get these data given below.

/*
 * SimpleReceiver.cpp
 *
 * Demonstrates receiving NEC IR codes with IRrecv
 *
 *  This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
 *
 ************************************************************************************
 * MIT License
 *
 * Copyright (c) 2020-2022 Armin Joachimsmeyer
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is furnished
 * to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 ************************************************************************************
 */

/*
 * Specify which protocol(s) should be used for decoding.
 * If no protocol is defined, all protocols are active.
 */
#define DECODE_DENON        // Includes Sharp
#define DECODE_JVC
#define DECODE_KASEIKYO
#define DECODE_PANASONIC    // the same as DECODE_KASEIKYO
#define DECODE_LG
#define DECODE_NEC          // Includes Apple and Onkyo
#define DECODE_SAMSUNG
#define DECODE_SONY
#define DECODE_RC5
#define DECODE_RC6

#define DECODE_BOSEWAVE
#define DECODE_LEGO_PF
#define DECODE_MAGIQUEST
#define DECODE_WHYNTER

#define DECODE_DISTANCE     // universal decoder for pulse distance protocols
#define DECODE_HASH         // special decoder for all protocols

//#define DEBUG               // Activate this for lots of lovely debug output from the decoders.

#include <Arduino.h>

#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>

void setup() {
    Serial.begin(115200);
    // Just to know which program is running on my Arduino
    Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));

    // Start the receiver and if not 3. parameter specified, take LED_BUILTIN pin from the internal boards definition as default feedback LED
    IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);

    Serial.print(F("Ready to receive IR signals of protocols: "));
    printActiveIRProtocols(&Serial);
    Serial.println(F("at pin " STR(IR_RECEIVE_PIN)));
}

void loop() {
    /*
     * Check if received data is available and if yes, try to decode it.
     * Decoded result is in the IrReceiver.decodedIRData structure.
     *
     * E.g. command is in IrReceiver.decodedIRData.command
     * address is in command is in IrReceiver.decodedIRData.address
     * and up to 32 bit raw data in IrReceiver.decodedIRData.decodedRawData
     */
    if (IrReceiver.decode()) {

        // Print a short summary of received data
        IrReceiver.printIRResultShort(&Serial);
        IrReceiver.printIRSendUsage(&Serial);
        if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
            Serial.println(F("Received noise or an unknown (or not yet enabled) protocol"));
            // We have an unknown protocol here, print more info
            IrReceiver.printIRResultRawFormatted(&Serial, true);
        }
        Serial.println();

        /*
         * !!!Important!!! Enable receiving of the next value,
         * since receiving has stopped after the end of the current received data packet.
         */
        IrReceiver.resume(); // Enable receiving of the next value

        /*
         * Finally, check the received data and perform actions according to the received command
         */
        if (IrReceiver.decodedIRData.command == 0x10) {
            // do something
        } else if (IrReceiver.decodedIRData.command == 0x11) {
            // do something else
        }
    }
}
-34900
+1350,- 350
+1350,- 350 
+1300,- 350 
+ 500,-1200 
+1350,- 350
+ 450,-1250 
+ 450,-1200 
+1350,- 350 
+ 500,-1200
+ 450,-1250 
+ 450,-1200 
+ 500
Sum: 19050

Looks like each pulse is about 1700 microseconds. One state is 'long-short' (about 1350+350) and the other is 'short-long' (about 450+1250).

IRremote can't say anything about the carrier frequency because the data from the IR receiver has that carrier stripped out. Generlly 38 kHz will work for 99% of remote controls. If you need the carrier frequency you will have to find another way to measure it, like with an oscilloscope.

Thanks for the response.

Should i input these data inside below image with +/- sign or without those signs. The demo data in the image doesn't have any sign with it.

Then I would guess that the signs are not needed.

1 Like

Thanks for the reply. It didn't work with or without the sign at 38Khz.

Will try a different approach next time. Thanks

Hard to say.
The first thing you must know is the frequency, without it you can't either correctly decode the signal or reproduce it. I can assume you are using a standard 38kHz IR sensor, and hope it is the right carrier frequency. Normally, if the carrier frequency is not the right one, you should read some kind of irregular values (e.g. for the same remote key, the values shown slightly change).

Given the right frequency and assuming you see always the same values, if IRreceive says UNKNOWN it means that remote has no standard (or known/implemented by the library) protocol, so if the carrier frequency is the right one you can just take the whole raw data and use it on your program. Usually this means you mist get all the shown values and pack them in an array, used by IRsend sendRaw() function, like that one suggested by the dump ("rawData[24]").

The library say, about sending raw data:

The library provides support for sending and receiving raw durations. This is intended mainly for debugging, but can also be used for protocols the library doesn’t implement, or to provide universal remote functionality.
The raw data for sending IR holds the duration of successive marks and spaces in microseconds. The first value is the first mark, and the last value is the last mark.

I have never used an ESP32 with IR, but I think it must be something like this (strip the +/- signs from the dumped values, they're not needed because values are just delays in microseconds, the signs just distinguish between "signal", "+", and "pause", "-"):

// Power button raw data
unsigned int rawPower[24] = { 34900, 1350, 350, 350, 350,1300, 350, 500, 1200, 1350, 350, 450, 1250, 450, 1200, 1350, 350, 500, 1200, 450, 1250, 450, 1200, 500 };
...
  // Send "Power" key
  irsend.sendRaw(rawPower, 24, 38);
...
1 Like

Thanks for the detailed instruction. Will try it today and share the result here.

Ever tried the ReceiveAndSend example???

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.