2

According to this datasheet this sensor puts out signals < 10ms.

When using RPi.GPIO and the add_event_detect callbacks, is there a chance that I will miss information because of the processing speed of the Raspberry Pi and my Python program?

In other words, what is the maximum rate at which signals can be detected / logged accurately in Python using RPi.GPIO?

Startec
  • 297
  • 1
  • 3
  • 8
  • Ah let me see. If your sensor reads 38kHz NEC IR signal, then Python GPIO should be fast enough to do the job. Furthermore, it is the stupid human finger pressing the TV remote generating the ridiculously slow signal, 1.5GHz Rpi won't miss it. Reference: https://raspberrypi.stackexchange.com/questions/103452/rpi3-lirc-library-and-uart-ir-transceiver-setup-problem. – tlfong01 Apr 22 '20 at 05:14
  • 10mS is a lifetime to a computer! Don't expect people to download a datasheet to understand your question; extract the relevant detail and include in your question. – Milliways Apr 22 '20 at 05:47
  • 1
    That's why I included the timing in the first sentence. – Startec Apr 22 '20 at 06:28
  • @Startec < 10ms is not a helpful statement. Less can mean nanoseconds or less. – joan Apr 22 '20 at 08:37
  • The Pi will miss pulses shorter than about 100ns in interrupt trigger mode. But 10ms should not be a problem. – PMF Apr 22 '20 at 11:20
  • @PMF where can I see this specs? – Startec Apr 22 '20 at 19:32
  • @Startec: Probably nowhere (at least I couldn't find any such information). I figured this out myself using a scope and a waveform generator. – PMF Apr 23 '20 at 19:21

1 Answers1

3

I doubt you will reliably be able to read NEC IR signals with RPi.GPIO.

The combination of Linux scheduling and GPIO interrupt handling and Python will likely conspire to miss transitions.

I suppose that is something you will have to find out for yourself by trying.

My pigpio Python module will capture the data.

See the following examples.

http://abyz.me.uk/rpi/pigpio/examples.html#Python_monitor_py http://abyz.me.uk/rpi/pigpio/examples.html#Python_ir_hasher_py http://abyz.me.uk/rpi/pigpio/examples.html#Python_irrp_py

joan
  • 71,024
  • 5
  • 73
  • 106
  • pigpio does seem to have better performance. What is different about it?

    And where can I get details on the "Linux scheduling and GPIO interrupt handling" specifically its limits?

    – Startec Apr 22 '20 at 20:30
  • 1
    pigpio is unique in sampling the GPIO rather than relying on the Linux interrupt system. This turns out to be a more efficient way of reliably capturing GPIO state and as a by product level changes are accurately timed. You need to google to see why Linux is not thought of as a "real-time" OS and the limitations of interrupts. – joan Apr 22 '20 at 21:12