1 # Device drivers for IR (infra red) remote controls
3 This repo provides a driver to receive from IR (infra red) remote controls and
4 a driver for IR "blaster" apps. The device drivers are nonblocking. They do not
5 require `uasyncio` but are compatible with it, and are designed for standard
8 The receiver is cross platform and has been tested on Pyboard, ESP8266 and
9 ESP32. The transmitter driver is compatible with Pyboard (1.x and D series) and
10 also (subject to limitations) with ESP32. For the transmitter a Pyboard is
13 The transmitter is documented [here](./TRANSMITTER.md) and the receiver is
14 [here](./RECEIVER.md).
18 IR communication uses a carrier frequency to pulse the IR source. Modulation
19 takes the form of OOK (on-off keying). There are multiple protocols and at
20 least three options for carrier frequency: 36, 38 and 40KHz.
22 The drivers support NEC and Sony protocols plus two Philips protocols, namely
23 RC-5 and RC-6 mode 0. In the case of the transmitter the carrier frequency is a
24 runtime parameter: any value may be specified. The receiver uses a hardware
25 demodulator which should be purchased for the correct frequency. The receiver
26 device driver sees the demodulated signal and is hence carrier frequency
29 Examining waveforms from various remote controls it is evident that numerous
30 protocols exist. Some are doubtless proprietary and undocumented. The supported
31 protocols are those for which I managed to locate documentation. My preference
32 is for the NEC version. It has conservative timing and good provision for error
33 detection. RC-5 has limited error detection, and RC-6 mode 0 has rather fast
36 A remote using the NEC protocol is [this one](https://www.adafruit.com/products/389).
38 Remotes transmit an address and a data byte, plus in some cases an extra value.
39 The address denotes the physical device being controlled. The data defines the
40 button on the remote. Provision usually exists for differentiating between a
41 button repeatedly pressed and one which is held down; the mechanism is protocol
44 # 2. Hardware Requirements
46 These are discussed in detail in the relevant docs; the following provides an
49 The receiver is cross-platform. It requires an IR receiver chip to demodulate
50 the carrier. The chip must be selected for the frequency in use by the remote.
51 For 38KHz devices a receiver chip such as the Vishay TSOP4838 or the
52 [adafruit one](https://www.adafruit.com/products/157) is required. This
53 demodulates the 38KHz IR pulses and passes the demodulated pulse train to the
56 In my testing a 38KHz demodulator worked with 36KHz and 40KHz remotes, but this
57 is obviously neither guaranteed nor optimal.
59 The transmitter requires a Pyboard 1.x (not Lite), a Pyboard D or an ESP32.
60 Output is via an IR LED which will need a transistor to provide sufficient
61 current. The ESP32 has significant limitations as a transmitter discussed
62 [here](./TRANSMITTER.md#52-esp32).