IR Remote library for esp-idf

Szymon_Kubica
Posts: 3
Joined: Sat Aug 19, 2023 9:07 pm

IR Remote library for esp-idf

Postby Szymon_Kubica » Sat Aug 19, 2023 9:38 pm

Hello,

I'm building a simple project using the ESP32 WeMos LOLIN32 board.
I was looking for a good library to be able to interface with an IR remote (the one which you can see here: https://www.circuitbasics.com/wp-conte ... trol-3.jpg)
The receiver that I'm using is this one:
Image
I tried using this example library: https://github.com/husarnet/esp-idf/blo ... nec_main.c, however the issue is that it seems like
it is failing to perform the initial NEC handshake (see nec specification here: https://www.sbprojects.net/knowledge/ir ... 201.125ms.. It seems like the duration of when my remote is sending signal is different from the one specified:

Code: Select all

Data item num fine
Item: level0: 0, level1: 1, duration0: 7508, duration1: 3529
Nec item duration: 9385
Target duration duration: 9350 +- 400
Nec item duration: 4411
Target duration duration: 4500 +- 400
Nec header fine
Nec item duration: 683
Target duration duration: 560 +- 400
Nec item duration: 492
Target duration duration: 1690 +- 400
Nec item duration: 683
Target duration duration: 560 +- 400
Nec item duration: 492
One thing to note is that I needed to override the tolerance for the initial 9000 / 4500 header signal (Target duration duration: 9350 +- 400[/color]). The default target duration specified by the library is 9000 +- 20 which wouldn't work in my case. Similarly in the following logs you can see that sometimes the duration of the item is close to the 562 us, however the specification would expect the 1690 us in that moment (expecting a logical 1 signal).
Three questions:
-> Do you know if there is some preferred library for using IR remotes with esp-idf?
-> Could it be the case that my remote isn't using the NEC protocol but something else (e.g. Sony)?
-> Is it possible that the different durations are because of the 3.3V voltage of the microcontroller and it somehow messes up the calculation of the duration of the signal?

Thank you,
Szymon

Szymon_Kubica
Posts: 3
Joined: Sat Aug 19, 2023 9:07 pm

Re: IR Remote library for esp-idf

Postby Szymon_Kubica » Sun Aug 20, 2023 8:31 am

Quick follow up:
Today I tried reading the inputs from the remote again and it seems to have fixed itself.

Code: Select all

I (58464) NEC: RMT RCV --- addr: 0xff00 cmd: 0xad52
^ it correctly registered the button press.
The problem is that I still need to have those overrides for the expected durations of the initial transmission header.
Would you say that the discrepancy in those durations could be because the remote is of low quality / or the battery is running low?
Thanks

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: IR Remote library for esp-idf

Postby MicroController » Sun Aug 20, 2023 10:54 pm

You can try the corresponding IDF example: https://github.com/espressif/esp-idf/tr ... ransceiver

Szymon_Kubica
Posts: 3
Joined: Sat Aug 19, 2023 9:07 pm

Re: IR Remote library for esp-idf

Postby Szymon_Kubica » Mon Aug 21, 2023 8:41 pm

Thanks for suggesting this.
In the end I managed to get the initial library to work.
It seems like offsetting the expected durations of the header signal has fixed all issues and now it is able to receive both the address and the data successfully.

Who is online

Users browsing this forum: No registered users and 106 guests