Go Down

Topic: Problems with irsend.sendRaw / Sending RAW IR Code (Read 5 times) previous topic - next topic

ekman

So I have a problem that I don't seam to get working no matter how I attack it.
I have been using Ken Shirriff's wonderfull IR-Library for Arduino, but I don't seam to be able to get the "irsend.sendRaw" command working. My problem is that I have a generated RAW IR code from the IRdump sketch included in the library. It looks like this:

A0F22FDA
Unknown encoding: A0F22FDA (32 bits)
Raw (16): -7350 200 -4800 200 -4800 250 -4800 200 -4800 200 -4800 250 -4800 200 -4800 200

I have been trying something like this to no avail….
irsend.sendRaw([7350 200 4800 200 4800 250 4800 200 4800 200 4800 250 4800 200 4800 200], 16, 38)

So how do I write the "irsend.sendRaw" command to send this specific code?


https://github.com/shirriff/Arduino-IRremote

PaulS

Quote
I have been trying something like this to no avail….
irsend.sendRaw([7350 200 4800 200 4800 250 4800 200 4800 200 4800 250 4800 200 4800 200], 16, 38)

You can't create an array on the fly. You need to create and populate a fixed size array, and send that.

johnwasser

That looks like a very odd code.  Do you get the same pattern of pulses every time?

It's unusual for the HIGH and LOW pulses to be so different in length: 200 vs 4800?  Usually the pulses are closer to a 1:2 or 1:3 ratio, not 1:24! 

Also, it shows no sign of data, just the same pattern over an over: 200 4800.  Usually the code will represent 1's and 0's by swapping the two widths like  200 -600 = 1 and  600 -200 = 0.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

ekman

Hmm that sounds wired, this is the data that I can capture time and time again.


A0F22FDA
Unknown encoding: A0F22FDA (32 bits)
Raw (16): -7350 200 -4800 200 -4800 250 -4800 200 -4800 200 -4800 250 -4800 200 -4800 200

2AD785FC
Unknown encoding: 2AD785FC (32 bits)
Raw (18): -7300 200 -4800 200 -4850 200 -4800 200 -4800 200 -4850 200 -4800 200 -4800 200 -4850 200

RB

#4
Jun 06, 2013, 08:45 pm Last Edit: Jun 06, 2013, 08:51 pm by RB Reason: 1

I have been trying something like this to no avail….
irsend.sendRaw([7350 200 4800 200 4800 250 4800 200 4800 200 4800 250 4800 200 4800 200], 16, 38)


Hey ekman,

Two things:
1) The array needs to have the values separated by commas
2) The array should be declared outside of that command.

Here's a program i got from THIS BLOG : http://dduino.blogspot.in/2011/11/use-sonar-to-control-tv.html

Code: [Select]
#include <IRremote.h>

IRsend irsend;

// just added my own array for the raw signal
unsigned int powerOn[148] = {4400,4250,550,1600,600,1550,600,1550,550,1600,550,500,550,550,550,1550,600,500,550,500,600,500,550,500,600,450,600,1550,600,1550,550,500,600,1550,550,550,550,500,600,500,550,500,550,500,600,500,550,1600,550,1550,600,1550,600,1550,600,1550,600,1550,550,1600,550,1550,600,500,550,500,600,500,550,500,550,550,550,500,600,450,600,500,550,500,550,1600,550,1600,550,500,600,500,550,1600,550,500,550,500,550,550,550,500,600,500,550,500,600,450,600,500,550,500,550,550,550,500,600,1550,600,450,600,500,550,500,550,550,550,500,600,450,600,500,550,500,600,1550,550,500,600,500,600,1550,550,500,600,500,550,500,550,500,600};

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

void loop() {

     // altered the code just to send/test my raw code
       irsend.sendRaw(powerOn,148,38);
       delay(2000);
}


NOTE that you'll have to change "148" to "16" in TWO places in the code...
Also, i hope you removed the first received raw value from the array (more info)

ekman



Hey ekman,

Two things:
1) The array needs to have the values separated by commas
2) The array should be declared outside of that command.

Here's a program i got from THIS BLOG : http://dduino.blogspot.in/2011/11/use-sonar-to-control-tv.html
[/quote]

Unfortunately I didn't get that working either, I can get the IR-led sending (flashing verified by phone camera) but the device is not reacting properly. I managed to decode the remote using LIRC and got the following results, but for the life of me I can really get any good information on how to convert it.

Code: [Select]
begin remote

  name  /home/pi/lircd.conf
  bits            3
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps          100

  one           204  7403
  zero          204  4867
  ptrail        204
  pre_data_bits   8
  pre_data       0x80
  gap          121717
  toggle_bit_mask 0x200

      begin codes
          KEY_UP                   0x1
          KEY_STOP                 0x3
          KEY_DOWN                 0x2
      end codes

end remote



ekman

So I just did a raw read with LIRC and it gave me the following.
Code: [Select]
begin remote

  name  /home/pi/lircd.conf
  flags RAW_CODES|CONST_LENGTH
  eps            30
  aeps          100

  gap          121716

      begin raw_codes

          name KEY_UP
              204    7399     205    7408     200    4869
              204    4874     195    4863     209    4872
              203    4864     203    4868     207    4868
              201    4870     203    7403     204

          name KEY_STOP
              192    7400     209    4865     208    4860
              208    4865     209    4865     204    4871
              203    4868     201    4869     203    4864
              209    7400     209    7399     209

          name KEY_DOWN
              205    7408     201    7405     202    4864
              209    4860     209    4864     210    4859
              210    4864     209    4871     199    4877
              199    7400     202    4864     209

      end raw_codes


The problem is that when I put in the numbers under irsend.sendRaw I still dot get the right signals sent from the Arduino platform.

Code: [Select]
#include <IRremote.h>

IRsend irsend;

// just added my own array for the raw signal
unsigned int powerOn[32] = {204,7399,205,7408,200,4869,204,4874,195,4863,209,4872,203,4864,203,4868,207,4868,201,4870,203,7403,204};
unsigned int powerOff[32] = {205,7408,201,7405,202,4864,209,4860,209,4864,210,4859,210,4864,209,4871,199,4877,199,7400,202,4864,209};

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

void loop() {

      // altered the code just to send/test my raw code
        irsend.sendRaw(powerOn,32,38);
        delay(2000);
        irsend.sendRaw(powerOff,32,38);
        delay(2000);
}

RB

Let me first say that i am an absolute beginner, but i have a similar problem and hence stumbled upon this thread.

In the code snippit directly above, the array is "32", but there are only 23 values in it??

cya
R

ekman

Yeah that is my mistake, the code is 23 not 32. I wrote it quickly by hand and slipped. ^^

johnwasser

Are you sure your device is 38 kHz?

Has the IR output worked on other devices?

What IR sender are you using and how is it wired?  Note that you can't run a 100 mA IR LED directly from an Arduino pin and expect it to work.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

RB

Ha! Ekman, i fixed my problem, and i think it might fix yours too.

Basically the device i was sending the IR code to was too far away. I moved a lot closer, and it worked.

Now I'm looking into some way to increase the LED output using a transistor, as johnwasser as hinted at above.

cya
R

nickosinski

Hi all - I literally signed-up just to thank everyone because my problem, too, was distance to/from transmitter. I just couldn't believe how close I had to be for it to work (10~20 cm!). Thanks again!

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview