How to decode ir signal (Raw).



Same procedure used in nec, sony ect .. just that here we use the sketch vessels which are in RawCodeDecode


With serial monitor open, point to arduino the remote control that will be decoded. Press the key that will be decoded. Example: Power
(appear the code of the key pressed on serial monitor)
  For Arduino sketch:
unsigned int raw1[68] = {9050,4350,650,450,650,500,650,450,650,500,650,450,650,500,600,500,650,450,650,1600,650,1600,600,1600,700,1550,650,1600,600,1650,650,1550,700,1600,600,1600,650,500,600,1600,650,500,600,500,650,450,650,1600,650,1600,600,500,650,1600,650,450,650,1600,650,1600,650,1600,650,450,650,500,600,};
irsend.sendRaw(raw1,68,38);


When finished decode your remote will have a list of Codes which we use in Sketch.


  • Upload Easy Send Raw sketch to arduino and edit.
On red line of picture you put your Raw code
unsigned int raw1[68] = {9050,4350,650,450,650,500,650,450,650,500,650,450,650,500,600,500,650,450,650,1600,650,1600,600,1600,700,1550,650,1600,600,1650,650,1550,700,1600,600,1600,650,500,600,1600,650,500,600,500,650,450,650,1600,650,1600,600,500,650,1600,650,450,650,1600,650,1600,650,1600,650,450,650,500,600,};

next on line blue your put  line to send 
irsend.sendRaw(raw1,68,38); 


You can add lines you want in the sketch .
Example:
if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
     irsend.sendRaw(raw1,68,38);
)
 if (Serial.read() != -2) {
    for (int i = 0; i < 3; i++) {
     irsend.sendRaw(raw2,68,38);
)
if (Serial.read() != -3) {
    for (int i = 0; i < 3; i++) {
     irsend.sendRaw(raw3,68,38);
If you add more than one line you must add the unigned int to the top of the sketch, which is equal to the send line.


 
Example of sketch finished (its only for ilustration this sketch no work) 

#include <IRremote.h>

IRsend irsend;
 //here put your raw code//
unsigned int raw1[68] = {4600,4350,700,1500,700,1500,700,1500,700,400,700,350,700,350,750,350,700,350,750,1450,700,1550,650,1500,750,350,700,350,750,350,650,400,700,350,700,400,650,1550,700,350,700,350,700,400,700,350,700,350,700,400,700,1500,650,400,700,1550,650,1500,750,1500,650,1550,750,1450,700,1550,650,};

unsigned int raw2[68] = {4600,4350,700,1500,700,1500,700,1500,700,400,700,350,700,350,750,350,700,350,750,1450,700,1550,650,1500,750,350,700,350,750,350,650,400,700,350,700,400,650,1550,700,350,700,350,700,400,700,350,700,350,700,400,700,1500,650,400,700,1550,650,1500,750,1500,650,1550,750,1450,700,1550,650,};

void setup()
{
  Serial.begin(9600);
}

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
     irsend.sendRaw(raw1,68,38);
      delay(40);
    }
if (Serial.read() != -2) {
    for (int i = 0; i < 3; i++) {
     irsend.sendRaw(raw2,68,38);
    delay(40);

  }
}

}

Now arduino with this sketch read any number ,from Easy Remote app
 procees and send
For #1 send  unsigned int raw1   ,For #2 send unsigned int raw2

 
 

No comments:

Post a Comment