Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worked on Samsung TV Remote. Troubles with A/C #1

Closed
peros550 opened this issue Apr 21, 2019 · 8 comments
Closed

Worked on Samsung TV Remote. Troubles with A/C #1

peros550 opened this issue Apr 21, 2019 · 8 comments

Comments

@peros550
Copy link

Hi Maxim,

today I found some time to test your library. The IR Dumper example worked out of the box.

The IR Send code found in the repo's start page needed a small modification:

static int16_t[] command1 =.... >> static int16_t command1[] =....

As mentioned, I was successful testing Samsung TV IR commands, but I wasn't successful testing A/C IR commands.
If you have any advice on how to troubleshoot or tinker it, it would be greatly appreciated.

Many Thanks!!!

@maximkulkin
Copy link
Owner

Without any details I can only suggest to test harder... and try to localize the problem.

@peros550
Copy link
Author

Hi Maxim,

I'm trying to reproduce an IR command of a Toyotomi A/C.
I used the raw_dumper example and here is what a turn ON command at 30C heating gave:

Decoded packet (size = 139):
9021 ,-4457 ,  677 , -556 ,  652 , -554 ,  654 ,-1627 ,  683 ,-1625 ,  674 ,-1634 ,  676 ,-1630 ,  680 , -554 ,
654 , -552 ,  656 , -551 ,  656 ,-1625 ,  675 ,-1633 ,  677 ,-1630 ,  680 , -553 ,  655 , -551 ,  656 , -551 ,
657 , -549 ,  648 , -559 ,  649 , -558 ,  649 , -557 ,  651 , -555 ,  652 , -555 ,  653 ,-1628 ,  682 ,-1626 ,
674 , -558 ,  649 , -558 ,  650 , -556 ,  651 , -555 ,  653 , -553 ,  654 ,-1627 ,  684 , -549 ,  648 ,-1633 ,
677 , -556 ,  651 , -555 ,  653 ,-1627 ,  683 , -550 ,  647 ,-19965 ,  678 , -555 ,  653 ,-1629 ,  681 , -552 ,
656 , -551 ,  656 , -551 ,  657 , -550 ,  647 , -559 ,  648 , -558 ,  650 , -557 ,  651 , -555 ,  652 , -554 ,
654 , -552 ,  656 , -550 ,  647 ,-1634 ,  676 , -556 ,  652 , -555 ,  652 , -554 ,  654 , -552 ,  656 , -550 ,
657 , -550 ,  647 , -559 ,  649 , -557 ,  650 , -556 ,  652 , -554 ,  654 , -552 ,  655 , -552 ,  656 , -550 ,
647 , -559 ,  648 , -558 ,  650 ,-1631 ,  679 ,-1628 ,  682 , -551 ,  657 ,

Then I used the following code to transmit the IR code using a Wemos D1 mini:

#include <stdio.h>
#include <stdlib.h>
#include <esp/uart.h>
#include <FreeRTOS.h>
#include <task.h>

#include <ir/ir.h>
#include <ir/raw.h>



static int16_t command1[] = {9021 ,-4457 ,  677 , -556 ,  652 , -554 ,  654 ,-1627 ,  683 ,-1625 ,  674 ,-1634 ,  676 ,-1630 ,  680 , -554 ,
654 , -552 ,  656 , -551 ,  656 ,-1625 ,  675 ,-1633 ,  677 ,-1630 ,  680 , -553 ,  655 , -551 ,  656 , -551 ,
657 , -549 ,  648 , -559 ,  649 , -558 ,  649 , -557 ,  651 , -555 ,  652 , -555 ,  653 ,-1628 ,  682 ,-1626 ,
674 , -558 ,  649 , -558 ,  650 , -556 ,  651 , -555 ,  653 , -553 ,  654 ,-1627 ,  684 , -549 ,  648 ,-1633 ,
677 , -556 ,  651 , -555 ,  653 ,-1627 ,  683 , -550 ,  647 ,-19965 ,  678 , -555 ,  653 ,-1629 ,  681 , -552 ,
656 , -551 ,  656 , -551 ,  657 , -550 ,  647 , -559 ,  648 , -558 ,  650 , -557 ,  651 , -555 ,  652 , -554 ,
654 , -552 ,  656 , -550 ,  647 ,-1634 ,  676 , -556 ,  652 , -555 ,  652 , -554 ,  654 , -552 ,  656 , -550 ,
657 , -550 ,  647 , -559 ,  649 , -557 ,  650 , -556 ,  652 , -554 ,  654 , -552 ,  655 , -552 ,  656 , -550 ,
647 , -559 ,  648 , -558 ,  650 ,-1631 ,  679 ,-1628 ,  682 , -551 ,  657};

void user_init(void) {
    uart_set_baud(0, 115200);
	
	 printf("Starting \n");
	ir_tx_init();
	
	while(1)
	{
	 printf("Sending \n");
	ir_raw_send(command1, sizeof(command1) / sizeof(*command1));
	
	vTaskDelay( 1500 / portTICK_PERIOD_MS );
	}


}

Having two Wemos D1 mini, I has able to send IR commands on one board and capture the command using the second board at the same time. Here is a picture of the setup in action.

IMG_2253

The raw dumper captured the following:

Decoded packet (size = 137):
9082 ,-4436 ,  722 , -512 ,  706 , -526 ,  703 ,-1603 ,  729 ,-1599 ,  722 ,-1591 ,  730 ,-1603 ,  729 , -528 ,
701 , -529 ,  700 , -504 ,  704 ,-1600 ,  732 ,-1604 ,  728 ,-1658 ,  674 , -587 ,  621 , -525 ,  704 , -525 ,
704 , -523 ,  706 , -507 ,  700 , -577 ,  663 , -598 ,  610 , -531 ,  708 , -525 ,  704 ,-1603 ,  729 ,-1600 ,
700 , -536 ,  704 , -532 ,  697 , -512 ,  707 , -526 ,  702 , -530 ,  699 ,-1581 ,  754 , -498 ,  707 ,-1605 ,
727 , -608 ,  621 , -511 ,  707 ,-1598 ,  734 , -519 ,  699 ,-20506 ,  700 ,-1607 ,  725 , -505 ,  724 , -556 ,
652 , -566 ,  663 , -526 ,  703 , -534 ,  684 , -527 ,  702 , -533 ,  696 , -512 ,  706 , -526 ,  703 , -527 ,
702 , -526 ,  682 ,-1606 ,  726 , -533 ,  706 , -502 ,  706 , -526 ,  703 , -527 ,  702 , -526 ,  703 , -525 ,
672 , -540 ,  700 , -536 ,  703 , -506 ,  702 , -530 ,  700 , -530 ,  709 , -521 ,  708 , -524 ,  673 , -535 ,
705 , -507 ,  701 ,-1608 ,  734 ,-1597 ,  724 , -530 ,  699 ,
Decoded packet (size = 1):
148 ,
Decoded packet (size = 137):
9065 ,-4428 ,  729 , -608 ,  620 , -509 ,  699 ,-1659 ,  673 ,-1603 ,  728 ,-1609 ,  754 ,-1555 ,  724 , -532 ,
708 , -523 ,  705 , -524 ,  705 ,-1598 ,  702 ,-1610 ,  732 ,-1601 ,  731 , -587 ,  642 , -500 ,  728 , -501 ,
749 , -478 ,  699 , -619 ,  620 , -509 ,  709 , -527 ,  702 , -532 ,  676 , -532 ,  707 ,-1599 ,  733 ,-1597 ,
724 , -512 ,  707 , -529 ,  700 , -576 ,  631 , -535 ,  705 , -608 ,  621 ,-1648 ,  684 , -523 ,  674 ,-1612 ,
730 , -529 ,  700 , -533 ,  706 ,-1575 ,  725 , -528 ,  701 ,-20504 ,  701 ,-1606 ,  726 , -529 ,  700 , -529 ,
699 , -588 ,  641 , -577 ,  631 , -587 ,  652 , -505 ,  703 , -577 ,  663 , -526 ,  702 , -505 ,  703 , -527 ,
702 , -526 ,  703 ,-1585 ,  725 , -533 ,  707 , -527 ,  701 , -506 ,  703 , -527 ,  701 , -546 ,  683 , -526 ,
703 , -509 ,  699 , -536 ,  704 , -597 ,  631 , -510 ,  698 , -598 ,  642 , -577 ,  656 , -517 ,  676 , -536 ,
703 , -533 ,  707 ,-1578 ,  774 ,-1557 ,  733 , -521 ,  708 ,
Decoded packet (size = 137):
9064 ,-4429 ,  728 , -531 ,  709 , -576 ,  652 ,-1659 ,  662 ,-1583 ,  728 ,-1647 ,  695 ,-1601 ,  730 , -502 ,
706 , -524 ,  705 , -524 ,  705 ,-1598 ,  733 ,-1578 ,  732 ,-1602 ,  730 , -526 ,  703 , -566 ,  663 , -526 ,
703 , -524 ,  683 , -530 ,  699 , -537 ,  681 , -529 ,  700 , -533 ,  707 , -526 ,  681 ,-1601 ,  731 ,-1598 ,
733 , -528 ,  680 , -577 ,  662 , -526 ,  703 , -530 ,  678 , -529 ,  700 ,-1605 ,  726 , -526 ,  703 ,-1608 ,
703 , -532 ,  707 , -526 ,  703 ,-1602 ,  729 , -524 ,  684 ,-20496 ,  749 ,-1559 ,  731 , -587 ,  642 , -577 ,
652 , -523 ,  705 , -523 ,  675 , -619 ,  620 , -535 ,  704 , -577 ,  631 , -587 ,  652 , -524 ,  705 , -500 ,
698 , -530 ,  709 ,-1604 ,  727 , -507 ,  701 , -532 ,  707 , -525 ,  704 , -598 ,  631 , -545 ,  652 , -531 ,
708 , -530 ,  699 , -511 ,  707 , -527 ,  702 , -530 ,  699 , -506 ,  754 , -476 ,  701 , -527 ,  701 , -536 ,
683 , -529 ,  700 ,-1609 ,  733 ,-1573 ,  748 , -506 ,  701 ,
Decoded packet (size = 137):
9012 ,-4473 ,  715 , -483 ,  703 , -577 ,  652 ,-1658 ,  673 ,-1603 ,  697 ,-1616 ,  726 ,-1607 ,  724 , -533 ,
707 , -498 ,  699 , -530 ,  699 ,-1605 ,  726 ,-1610 ,  732 ,-1577 ,  723 , -532 ,  707 , -556 ,  673 , -587 ,
641 , -522 ,  697 , -577 ,  641 , -533 ,  706 , -504 ,  704 , -529 ,  700 , -533 ,  706 ,-1601 ,  730 ,-1574 ,
726 , -535 ,  704 , -532 ,  676 , -597 ,  642 , -528 ,  700 , -531 ,  698 ,-1582 ,  750 , -576 ,  631 ,-1607 ,
725 , -534 ,  673 , -535 ,  705 ,-1601 ,  730 , -522 ,  696 ,-20509 ,  703 ,-1669 ,  663 , -503 ,  704 , -566 ,
663 , -525 ,  703 , -525 ,  705 , -507 ,  700 , -536 ,  703 , -532 ,  676 , -532 ,  707 , -525 ,  704 , -527 ,
702 , -526 ,  682 ,-1605 ,  726 , -533 ,  706 , -502 ,  706 , -526 ,  703 , -545 ,  684 , -576 ,  652 , -527 ,
681 , -534 ,  705 , -556 ,  651 , -609 ,  620 , -532 ,  707 , -577 ,  652 , -524 ,  705 , -499 ,  709 , -528 ,
700 , -511 ,  708 ,-1601 ,  730 ,-1602 ,  729 , -598 ,  631 ,
Decoded packet (size = 1):
206 ,
Decoded packet (size = 137):
8990 ,-4431 ,  724 , -598 ,  610 , -534 ,  705 ,-1600 ,  731 ,-1659 ,  662 ,-1589 ,  732 ,-1601 ,  730 , -527 ,
701 , -529 ,  700 , -529 ,  700 ,-1579 ,  731 ,-1669 ,  662 ,-1698 ,  633 , -532 ,  697 , -508 ,  752 , -477 ,
699 , -528 ,  701 , -597 ,  621 , -529 ,  699 , -536 ,  703 , -506 ,  702 , -531 ,  708 ,-1598 ,  733 ,-1596 ,
725 , -566 ,  652 , -529 ,  699 , -511 ,  697 , -536 ,  703 , -587 ,  642 ,-1604 ,  727 , -525 ,  672 ,-1615 ,
726 , -533 ,  706 , -502 ,  759 ,-1547 ,  721 , -532 ,  707 ,-20497 ,  703 ,-1606 ,  725 , -535 ,  694 , -529 ,
700 , -513 ,  694 , -566 ,  663 , -533 ,  675 , -608 ,  631 , -545 ,  694 , -526 ,  681 , -527 ,  702 , -528 ,
701 , -527 ,  701 ,-1586 ,  725 , -534 ,  705 , -528 ,  700 , -556 ,  652 , -529 ,  700 , -597 ,  631 , -588 ,
641 , -512 ,  706 , -529 ,  700 , -608 ,  599 , -534 ,  705 , -525 ,  704 , -526 ,  703 , -526 ,  681 , -531 ,
708 , -528 ,  680 ,-1604 ,  727 ,-1605 ,  726 , -528 ,  701 ,
Decoded packet (size = 1):
228 ,

One quick observation has to do with the size. While the IR code sent by the original remote gave a size of 139 , the IR code reproduced by your library was captured as 137.

Then I tried to compare the IR Codes using a program called AnalysIR.

Here is the result:

Original vs ESP8266

The yellow pulses come from the original remote while the green comes from the WemosD1 mini.

@maximkulkin
Copy link
Owner

Oh, thank you for detailed description.

I've seen internal timer that is used to time pulses having issues with delays >= 10000, it will somehow consume the next pulse. When I first found it, I decided not to deal with it assuming protocols should not have such long pulses/silences. But it might be worth investigating in depth.

Can you try this: replace -20000 you have with two values of -9999 (absolute value should be less than 10000) and see if it helps.

@peros550
Copy link
Author

Thanks Maxim! I'll try and let you know!

@peros550
Copy link
Author

Maxim! Problem solved! Many Thanks!!!!!!

@maximkulkin
Copy link
Owner

I will probably implement a workaround for that to internally split long pulses into multiple timer calls until I figure out what is the root cause. Feels like there is a bug in esp-open-rtos using FRC1 timer with 256 divider.

@peros550
Copy link
Author

I will probably implement a workaround for that to internally split long pulses into multiple timer calls until I figure out what is the root cause. Feels like there is a bug in esp-open-rtos using FRC1 timer with 256 divider.

Hi Maxim,

did you have time to check the issue with values greater than 9999 ?

@peros550
Copy link
Author

@maximkulkin hi Maxim, I hope you are doing well . Do you plan a fix for the above issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants