@@ -8,12 +8,15 @@ electrical equipment.
88They are cheap, reliable and consume negligible power. However they lack
99flexibility: they can only be controlled by the matching remote. This library
1010provides a means of incorporating them into an IOT (internet of things)
11- solution, or simply enabling the construction of a remote with a better antenna
12- and longer range than the stock item.
11+ solution, or building a remote capable of controlling more devices with a
12+ better antenna and longer range than the stock item.
13+
14+ For the constructor a key benefit is that no high voltage wiring is required.
1315
1416The approach relies on the fact that most units use a common frequency of
1517433.92MHz. Transmitter and receiver modules are available for this frequency at
1618low cost, e.g. [ from Seeed] ( https://www.seeedstudio.com/433Mhz-RF-link-kit-p-127.html ) .
19+ The Seeed units:
1720
1821![ Image] ( images/seeed.png )
1922
@@ -25,15 +28,15 @@ requiring the remote to be held very close to it to achieve results.
2528The signal from the supplied remote is captured by a simple utility and stored
2629in a file. Multiple signals - optionally from multiple remotes - may be stored
2730in a file. The utility is used interactively at the REPL. Supported targets are
28- Pyboard D, Pyboard 1.x, Pyboard Lite and ESP32 .
31+ Pyboard D, Pyboard 1.x, Pyboard Lite, ESP32 and Raspberry Pi Pico .
2932
3033#### Transmitter
3134
3235This module is intended to be used by applications. The application loads the
3336file created by the receiver and transmits captured codes on demand.
34- Transmission is nonblocking. Supported targets are Pyboard D, Pyboard 1.x and
35- ESP32. Pyboard Lite works in my testing, but only in blocking mode. The module
36- does not use ` uasyncio ` but is compatible with it.
37+ Transmission is nonblocking. Supported targets are Pyboard D, Pyboard 1.x,
38+ ESP32 and Raspberry Pi Pico . Pyboard Lite works in my testing, but only in
39+ blocking mode. The module does not use ` uasyncio ` but is compatible with it.
3740
3841#### Warning
3942
@@ -45,6 +48,14 @@ to improve accuracy.
4548
4649See [ section 6] ( ./README.md#6-background ) for the reasons for this approach.
4750
51+ #### Raspberry Pi Pico note
52+
53+ Early firmware has [ this issue] ( https://github.com/micropython/micropython/issues/6866 )
54+ affecting USB communication with some PC's. It particularly affects code which
55+ issues ` print() ` only occasionally: the application appears to have failed. The
56+ missing messages appear when you press a key. Hopefully this will be fixed soon
57+ (note dated 8th March 2021).
58+
4859# 1. Installation
4960
5061## 1.1 Code
@@ -53,8 +64,8 @@ Receiver: copy the `rx` directory and contents to the target's filesystem.
5364Transmitter: copy the ` tx ` directory and contents to the target's filesystem.
5465
5566In each directory there is a file ` get_pin.py ` . This provides a convenient way
56- to instantiate a ` Pin ` on Pyboard or ESP32 . This may be modified for your own
57- needs or ignored and replaced with your own code.
67+ to instantiate a ` Pin ` on Pyboard, ESP32 or Raspberry Pi Pico . This may be
68+ modified for your own needs or ignored and replaced with your own code.
5869
5970There are no dependencies.
6071
@@ -64,26 +75,33 @@ It is difficult to generalise as there are multiple sources for 433MHz
6475transceivers. Check the data for your modules.
6576
6677My transmitter and receiver need a 5V supply. The receiver produces a 0-5V
67- signal: this is compatible with Pyboards but the ESP32 requires a circuit to
68- ensure 0-3.3V levels. The receiver code is polarity agnostic so an inverting
69- buffer as shown below will suffice.
78+ signal: this is compatible with Pyboards but the ESP32 and Raspberry Pi Pico
79+ require a circuit to ensure 0-3.3V levels. The receiver code is polarity
80+ agnostic so an inverting buffer as shown below will suffice.
7081
71- By default pin X3 is used on the Pyboard and pin 27 on ESP32, but any pins may
72- be used.
82+ Receiver defaults are pin X3 on Pyboard, pin 27 on ESP32 and pin 17 on Pico,
83+ but any pins may be used.
7384
7485![ Image] ( images/buffer.png )
7586
7687The transmitter can be directly connected as 5V devices are normally compatible
77- with 3.3V logic levels. Default pins are X3 on Pyboard, 23 on ESP32. Any pins
78- may be substituted. The
88+ with 3.3V logic levels. Transmitter defaults are X3 on Pyboard, 23 on ESP32 and
89+ 16 on the Pico. Any pins may be substituted. The
7990[ data for the Seeed transmitter] ( https://www.seeedstudio.com/433Mhz-RF-link-kit-p-127.html )
8091states that a supply of up to 12V may be used to increase power. Whether this
8192applies to other versions is moot: try at your own risk. I haven't.
8293
8394## 1.3 Hardware usage
8495
8596Pyboards: Timer 5.
86- ESP32: RMT channel 0.
97+ ESP32: RMT channel 0.
98+ Pico: PIO state machine 0, IRQ 0, PIO 0.
99+
100+ The Pico uses ` tx/rp2_rmt.py ` which uses the PIO for nonblocking modulation in
101+ a similar way to the ESP32 RMT device. To use this library there is no need to
102+ study the code, but documentation is available
103+ [ here] ( https://github.com/peterhinch/micropython_ir/blob/master/RP2_RMT.md ) for
104+ those interested.
87105
88106# 2. Acquiring data
89107
@@ -165,9 +183,10 @@ from tx.get_pin import pin
165183transmit = TX(pin(), ' remotes' )
166184transmit(' TV on' ) # Immediate return
167185```
168- The transmit method is nonblocking, both on Pyboard and on ESP32. There is an
169- alternative blocking method for use on Pyboard only. This offers more precise
170- timing, and I found it necessary on the Pyboard Lite only. This is accessed as:
186+ The transmit method is nonblocking, on Pyboard, ESP32 and Raspberry Pi Pico.
187+ There is an alternative blocking method for use on Pyboard only. This offers
188+ more precise timing, and I found it necessary on the Pyboard Lite only. This is
189+ accessed as:
171190``` python
172191transmit.send(' TV on' ) # Blocks
173192```
@@ -230,6 +249,8 @@ async def send_queued():
230249 transmit(to_send)
231250 await asyncio.sleep_ms(delay)
232251```
252+ In the absence of an official ` Queue ` class, an unofficial version is available
253+ documented [ here] ( https://github.com/peterhinch/micropython-async/blob/master/v3/docs/TUTORIAL.md#35-queue ) .
233254
234255# 4. File maintenance
235256
0 commit comments