This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Decoding IR-signals, what is the best approach?

Hello, I have to implement infrared sending and receiving of a modulated signal in pre-existing code.

I have managed to implement infrared sending thanks to the ble_app_uart_IR.zip-example that Torbjørn Øvrebekk made available in this post.

The IR-example uses the App Timer and PPI.

Now when it comes to decoding the signals I am a bit stumped on where to begin. I found this question here on devzone, about how to use "timer1" to capture signals.

Stefan Birnir Sverrisson explains that it can be possible using timers and PPI, and includes a "Frequency_counter.zip"-example that can be modified to measure timing between signal edges. I have tried to build this example in Keil v5, but I get error messages I am hard pressed to remedy. It might be due to the example being made for nRF51 SDK 7.2.0, and I am using nRF52 with SDK 11.

Does anyone have a suggestion to how I might make this work? I have a feeling that I can use the App Timer and PPI already included in the project (when sending IR), but I am not familiar enough with either to create code from scratch with them.

Note: I am not very well versed in C-programming, and my knowledge is very superficial at this point.

Parents
  • Hi,

    In general your receiver circuit will filter out the 38 kHz (or so) pulse, so what is left is detecting the digital signal.

    On the nRF52 you have access to two timers, one based on the HFCLK called TIMER and one based on the LFCLK called RTC or App timer. The LFCLK is the more energy efficient of the two.

    For the applciation timer we have a tutorial available here.

    In this post you can find some simple code on using PPI and TIMER to generate constant 4 MHz output.

    Essentially you need to:

    • Trigger/start a timer on positive edge
    • Read the timer on negative edge
    • Decode the information in accordance with the IR protocol

    The most energy efficient way of doing this is using the RTC (possibly through app timer) along with PPI. Consult the infocenter on PPI and RTC.

    Best regards,

    Øyvind

Reply
  • Hi,

    In general your receiver circuit will filter out the 38 kHz (or so) pulse, so what is left is detecting the digital signal.

    On the nRF52 you have access to two timers, one based on the HFCLK called TIMER and one based on the LFCLK called RTC or App timer. The LFCLK is the more energy efficient of the two.

    For the applciation timer we have a tutorial available here.

    In this post you can find some simple code on using PPI and TIMER to generate constant 4 MHz output.

    Essentially you need to:

    • Trigger/start a timer on positive edge
    • Read the timer on negative edge
    • Decode the information in accordance with the IR protocol

    The most energy efficient way of doing this is using the RTC (possibly through app timer) along with PPI. Consult the infocenter on PPI and RTC.

    Best regards,

    Øyvind

Children
Related