crankyoldgit / IRremoteESP8266

Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on: https://github.com/shirriff/Arduino-IRremote/
GNU Lesser General Public License v2.1
2.98k stars 832 forks source link

How to process UNKNOWN encoding #25

Closed casper-gh closed 7 years ago

casper-gh commented 8 years ago

First I'd like to thank you for your awesome work.

I have a question, how do I use the UNKNOWN encoding to trigger IR transmitter?

Encoding  : UNKNOWN
Code      : 6D23589D (32 bits)
Timing[93]: 
     +1300, - 450     +1300, - 450     + 500, -1250     +1300, - 450
     +1300, - 450     + 450, -1300     + 500, -1250     + 450, -1300
     + 500, -1250     + 450, -1300     + 450, -1300     +1350, -7200
     +1350, - 400     +1350, - 400     + 500, -1250     +1300, - 450
     +1300, - 450     + 450, -1300     + 500, -1250     + 450, -1300
     + 450, -1300     + 500, -1250     + 450, -1300     +1300, -7200
     +1300, - 450     +1300, - 450     + 450, -1300     +1350, - 400
     +1300, - 450     + 450, -1300     + 500, -1250     + 450, -1300
     + 450, -1300     + 450, -1300     + 450, -1300     +1300, -7200
     +1300, - 450     +1300, - 450     + 450, -1300     +1350, - 400
     +1300, - 400     + 450, -1300     + 450, -1300     + 500, -1250
     + 450, -1300     + 450, -1300     + 500
unsigned int  rawData[93] = {1300,450, 1300,450, 500,1250, 1300,450, 1300,450, 450,1300, 500,1250, 450,1300, 500,1250, 450,1300, 450,1300, 1350,7200, 1350,400, 1350,400, 500,1250, 1300,450, 1300,450, 450,1300, 500,1250, 450,1300, 450,1300, 500,1250, 450,1300, 1300,7200, 1300,450, 1300,450, 450,1300, 1350,400, 1300,450, 450,1300, 500,1250, 450,1300, 450,1300, 450,1300, 450,1300, 1300,7200, 1300,450, 1300,450, 450,1300, 1350,400, 1300,400, 450,1300, 450,1300, 500,1250, 450,1300, 450,1300, 500};  // UNKNOWN 6D23589D

Encoding  : UNKNOWN
Code      : F6D1C6CE (32 bits)
Timing[99]: 
     +1300, - 450     +1300, - 450     + 450, -1300     +1300, - 450
     +1300, - 450     + 450, -1300     + 450, -1300     + 450, -1300
     + 450, -1300     + 450, -1300     + 450, -1300     +1300, -7200
     +1300, - 450     +1300, - 450     + 450, -1300     +1300, - 450
     +1300, - 450     + 450, -1300     + 450, -1300     + 450, -1300
     + 450, -1300     + 450, -1300     + 450, -1300     +1300, -7200
     +1300, - 450     +1300, - 450     + 500, -1250     +1300, - 450
     +1300, - 450     + 450, -1300     + 450, -1300     + 450, -1300
     + 450, -1300     + 450, -1300     + 500, -1250     +1300, -7200
     +1300, - 450     +1300, - 450     + 450, -1300     +1300, - 450
     +1300, - 450     + 450, -1300     + 450, -1300     + 450, -1300
     + 450, -1300     + 450, -1300     + 500, -1250     +1300, -7200
     +1300, - 450     +1300
unsigned int  rawData[99] = {1300,450, 1300,450, 450,1300, 1300,450, 1300,450, 450,1300, 450,1300, 450,1300, 450,1300, 450,1300, 450,1300, 1300,7200, 1300,450, 1300,450, 450,1300, 1300,450, 1300,450, 450,1300, 450,1300, 450,1300, 450,1300, 450,1300, 450,1300, 1300,7200, 1300,450, 1300,450, 500,1250, 1300,450, 1300,450, 450,1300, 450,1300, 450,1300, 450,1300, 450,1300, 500,1250, 1300,7200, 1300,450, 1300,450, 450,1300, 1300,450, 1300,450, 450,1300, 450,1300, 450,1300, 450,1300, 450,1300, 500,1250, 1300,7200, 1300,450, 1300};  // UNKNOWN F6D1C6CE

Any input much appreciated!

markszabo commented 8 years ago

There is a sendRaw() function which can be used to send the rawData array, but that doesn't always work.

casper-gh commented 8 years ago

Thanks @markszabo, but what value should I use for Hz parameter?

markszabo commented 8 years ago

It's usually 38 by other encodings (simply check how they call enableIROut()), so that would be my guess

casper-gh commented 8 years ago

Much appreciated, it works perfect with value 38.

However I have a last question, kind of out of scope of this app, but I'm new to Arduino:

How do I set up the ESP8266 Arduino so the sketch starts automatically when the system reboots? When I disconnect the power from system, the sketch is gone, and I have to redeploy it.

markszabo commented 8 years ago

Okay, just to make sure we are on the same page: you have an ESP8266 microcontroller (hardware), and you are using the Arduino IDE (software) to program it, right? In this case if you restart your ESP8266 (or just simply disconnect the power) the sketch should automatically restart. However when ESP8266 starts it checks the GPIO0 pin. If that pin is LOW, then it will go to bootloader mode and wait for a new sketch to be uploaded. If it receives the new sketch, it stores it and then starts it (regardless of the state of the GPIO0 pin). But if your GPIO0 pin is still LOW, then when you restart it, it will go to bootloader mode again and wait for a new sketch. So check if your GPIO0 pin is LOW at startup :)

casper-gh commented 8 years ago

@markszabo Yes we're on the same page, and I'm using the IRServer so the pin is set to 0 by its default. However after I disconnect and reconnect the power, I couldn't access the web server anymore.

Sorry for being dumb, but what does is mean when you say "pin is LOW", and how can I set it to HIGH or whatever it is for the autostart to work?

Thanks a lot

casper-gh commented 8 years ago

Okay I figured it out, I need to use GPIO4 for the IR emitter data instead if GPIO0 (changed IRsend irsend(0); to IRsend irsend(4); in IRServer) based on this blog post https://zoetrope.io/tech-blog/esp8266-bootloader-modes-and-gpio-state-startup.

skyforcetw commented 7 years ago

I'm processing UNKOWN IR encoding recently. I found there are a bit difference in IRremote between avr & ESP8266 version:

avr version: A long space will create a STOP state in IR receive. ESP8266 version: Continued receive until read timeout.

This difference may cause avr receive one IR packet and STOP, ESP8266 receive more packets and signal length is non stable.

Is any chance to improve this?

Joypacharya commented 7 years ago

I thought you are decoding AC remote. You should increase your Buffer size.If you do this thing then you will get definitely result. In such case this is happyend. So,try it and reply me back.

crankyoldgit commented 7 years ago

Closing this issue due to inactivity and it appears the original request has been addressed.