blafois / Daikin-IR-Reverse

Daikin AC Infrared remote control protocol reverse
136 stars 12 forks source link

Example implementation #1

Closed danielkucera closed 7 years ago

danielkucera commented 7 years ago

Hi Ben,

do you have some example implementation? Or could you please provide the capture so I can see how the whole frame is transmitted?

Thanks.

blafois commented 7 years ago

Hi Daniel,

I have not finished integrating this in my system, but I made a basic Java Library for parsing / writing messages.

Its not full / complete - but can give you an idea. I just committed it to DaikinLibrary subfolder

2017-07-08 22:59 GMT+02:00 Daniel Kucera notifications@github.com:

Hi Ben,

do you have some example implementation? Or could you please provide the capture so I can see how the whole frame is transmitted?

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blafois/Daikin-IR-Reverse/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AM0_Og4EtK6xvQP0fT6G4IocWb_XPf7Dks5sL-2_gaJpZM4OR3bt .

danielkucera commented 7 years ago

Thank you but exactly the part I'm looking for is missing in transmit() function. :) I'm trying to figure out the right timing and frame sending procedure.

blafois commented 7 years ago

Ah, I have an arduino sketch with IR transmission - give me some time to get it and publish it

2017-07-09 19:39 GMT+02:00 Daniel Kucera notifications@github.com:

Thank you but exactly the part I'm looking for is missing in transmit() function. :) I'm trying to figure out the right timing and frame sending procedure.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/blafois/Daikin-IR-Reverse/issues/1#issuecomment-313934187, or mute the thread https://github.com/notifications/unsubscribe-auth/AM0_OpS8jsRuTj32A5BG3xXqIACeA0oJks5sMRBpgaJpZM4OR3bt .

danielkucera commented 7 years ago

Hi Ben,

do you have any update on this?

Thanks.

blafois commented 7 years ago

Hi Daniel,

Sorry for delay!

Here is a hardcoded sample that works with an arduino uno and an IR LED using the "tone" function to have 38Khz pulse:

define HIGH_DURATION 190

define DURATION_0 400

define DURATION_1 1200

define INTER_FRAME_DURATION 35

void modulate() { tone(IR_LED, 38000); }

void stopModulate() { noTone(IR_LED); }

void send(byte bit) { modulate(); delayMicroseconds(HIGH_DURATION); stopModulate(); if(bit == 0) { delayMicroseconds(DURATION_0); } if(bit == 1) { delayMicroseconds(DURATION_1); } }

void frameStart() { modulate(); delayMicroseconds(1650); stopModulate(); delayMicroseconds(1650); }

void frameEnd() { // Final HIGH state modulate(); delayMicroseconds(HIGH_DURATION); stopModulate();

delay(INTER_FRAME_DURATION); }

void wakeUp() { modulate(); delayMicroseconds(136); stopModulate(); delayMicroseconds(390);

for(int i = 0; i < 5; i++) { modulate(); delayMicroseconds(180); stopModulate(); delayMicroseconds(390); }

delay(25); }

void frame1() { // 11 da 27 00 c5 00 00 d7 byte dataToTransmit[] = { 0x11, 0xda, 0x27, 0x00, 0xc5, 0x00, 0x00, 0xd7 };

frameStart();

for(byte i = 0; i < (sizeof(dataToTransmit)/sizeof(byte)); i++) { for(byte j = 0; j < 8; j++) { send((dataToTransmit[i] >> j) & 0x01); } }

frameEnd(); }

void frame2() { //11 da 27 00 42 00 00 54 byte dataToTransmit[] = { 0x11, 0xda, 0x27, 0x00, 0x42, 0x00, 0x00, 0x54 };

frameStart();

for(byte i = 0; i < (sizeof(dataToTransmit)/sizeof(byte)); i++) { for(byte j = 0; j < 8; j++) { send((dataToTransmit[i] >> j) & 0x01); } }

frameEnd(); }

void frame3() { //11 da 27 00 00 69 32 00 50 00 00 06 60 00 00 c1 80 00 a4 byte dataToTransmit[] = { 0x11, 0xda, 0x27, 0x00, 0x00, 0x69, 0x32, 0x00, 0x50, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0xc1, 0x80, 0x00, 0xa4 };

frameStart();

for(byte i = 0; i < (sizeof(dataToTransmit)/sizeof(byte)); i++) { for(byte j = 0; j < 8; j++) { send((dataToTransmit[i] >> j) & 0x01); } }

frameEnd(); }

void sendDaikin() { // Wake up receiver wakeUp();

// Frame 1 frame1();

// Frame 2 frame2();

// Frame 3 frame3(); }

2017-07-16 19:59 GMT+02:00 Daniel Kucera notifications@github.com:

Hi Ben,

do you have any update on this?

Thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/blafois/Daikin-IR-Reverse/issues/1#issuecomment-315625745, or mute the thread https://github.com/notifications/unsubscribe-auth/AM0_OoU-e8ehZzvC2xwu1GQg_PWUkJXEks5sOk94gaJpZM4OR3bt .

danielkucera commented 7 years ago

Thank you, now it works! The only problem I still have is range - it works only 10cm from AC. I need to build some serious IR LED driver. Btw, I can provide audio waveform for someone who would be implementing it on different HW. I am using OrangePI and lirc-gpio.

JorgeFrias commented 1 year ago

@danielkucera I'm 5 years late to this conversation, but I found myself having the same problem with the IR range, most probably you are using the wrong wavelength, most remotes (seems like the Daikin ones also) use a 940nm LEDs, when using the right LED the range grows to several meters comfortably.