2:21 AM
My RF toys departed China DongGuan yesterday morning, and arrived HongKong TsingYi this morning, and to be collected at the branch in Castle Peak Road, where I am living. So I could start playing this toy this weekend.
SF Express Delivery Tracking 顺丰速运有限公司 SF1134814948188
2021-10-22 09:33:20 Delivery order placed 商品已经下单
2021-10-22 11:28:38 Waiting for collection 等待揽收中
2021-10-22 21:55:00 SF collected item顺丰速运 已收取快件
2021-10-22 23:59:00 DungGuan Hung Kwong Hotel to ship to DaiLong 快件在【东莞凤岗鸿光酒店营业点】完成分拣,准备发往 【东莞大朗中转场】
2021-10-23 01:07:00 Arrived Dung Guan Transit 快件到达 【东莞大朗中转场】
2021-10-23 01:43:00 To ship to HongKong TsingYi 快件在【东莞大朗中转场】完成分拣,准备发往 【香港青衣中转场】
2021-10-23 06:17:00 Arrived TsingYi 快件到达 【香港青衣中转场】
2021-10-23 08:00:00 To deliver to ShamShuiPo Castle Peak Road SF Branch 快件在【香港青衣中转场】完成分拣,准备发往 【深水埗青山道順豐站】
2021-10-22 09:33:20 Delivery order placed 商品已经下单
2021-10-22 11:28:38 Waiting for collection 等待揽收中
2021-10-22 21:55:00 SF collected item顺丰速运 已收取快件
2021-10-22 23:59:00 DungGuan Hung Kwong Hotel to ship to DaiLong 快件在【东莞凤岗鸿光酒店营业点】完成分拣,准备发往 【东莞大朗中转场】
2021-10-23 01:07:00 Arrived Dung Guan Transit 快件到达 【东莞大朗中转场】
2021-10-23 01:43:00 To ship to HongKong TsingYi 快件在【东莞大朗中转场】完成分拣,准备发往 【香港青衣中转场】
2021-10-23 06:17:00 Arrived TsingYi 快件到达 【香港青衣中转场】
2021-10-23 08:00:00 To deliver to ShamShuiPo Castle Peak Road SF Branch 快件在【香港青衣中转场】完成分拣,准备发往 【深水埗青山道順豐站】
2:45 AM
Now I am studying the piVirtualWire.py at the link you last referenced. It is an old program written in 2015 using piPGIO. But it is only approx 350 line long. So I hope to write a preliminary. simple Pico MicroPython version this weekend. The complete listing follows.
''' MicroPython v1.16 on 2021-06-18; Raspberry Pi Pico with RP2040 Type "help()" for more information. >>> %Run -c $EDITOR_CONTENT Traceback (most recent call last): File "<stdin>", line 25, in <module> ImportError: no module named 'pigpio' >>> ''' ''' piVirtualWire.py - DzikuVx piVirtualWirepiVirtualWire 2015feb24 piVirtualWire/piVirtualWire.py / @pawelspychalski pawelspychalski init Latest commit 42b5703 on Feb 24, 2015 github.com/DzikuVx/piVirtualWire/blob/master/piVirtualWire.py
5 hours later…
7:24 AM
Now I am taking a closer look at the piVirtualWire library/code. There are indeed just a couple of functions, mainly for (1) Setting up transceiver and receiver, (2) sending and receiving text messages, (3) and doing CRC checking.
"""
Instantiate a transmitter with the Pi, the transmit gpio,
and the bits per second (bps). The bps defaults to 2000.
The bps is constrained to be within MIN_BPS to MAX_BPS.
"""
self.pi = pi
self.txbit = (1<<txgpio)
if bps < MIN_BPS:
bps = MIN_BPS
elif bps > MAX_BPS:
bps = MAX_BPS
self.mics = int(1000000 / bps)
self.wave_id = None
pi.wave_add_new()
pi.set_mode(txgpio, pigpio.OUTPUT)
Instantiate a transmitter with the Pi, the transmit gpio,
and the bits per second (bps). The bps defaults to 2000.
The bps is constrained to be within MIN_BPS to MAX_BPS.
"""
self.pi = pi
self.txbit = (1<<txgpio)
if bps < MIN_BPS:
bps = MIN_BPS
elif bps > MAX_BPS:
bps = MAX_BPS
self.mics = int(1000000 / bps)
self.wave_id = None
pi.wave_add_new()
pi.set_mode(txgpio, pigpio.OUTPUT)
8:23 AM
And I googled the schematics of the Xmit and Recv modules. I found them simple electronic circuits, without any intelligence, just blindly sends/receives high low signals. So I guess the encoding and decoding are done externally. I guess we can use complicated hardware chips. But we can also use big banging Rx/Tx UART like software stuff as in the VirtualWire. I suspect we can also use MCU built in UART things, the on board Rpi4B or Pico UART features.
I also found that the VirtualWire also does not do anything to "setup" the modules, because they are stupid hardware just doing one job, transmit or receive. The MCU or Pico just set up one GP pin as output for the transmit module, another GP pin as input for the receive module, can can start business, that is what I am going to gamble now.
10:07 AM
2 hours later…
11:57 AM
74AHCT125 - Quad Level-Shifter (3V to 5V) - A -US$1.50
https://www.adafruit.com/product/1787
DESCRIPTION
Level shifting chips let you connect 3V and 5V devices together safely.
This chip is similar to others in the shop (such as the 74LVC125) except ***this one is particularly good at converting 3V logic up to 5V***.
(1) ***Just power the 74AHCT125 with 5V, it will detect 3V logic properly***.
(2) ***You can also use it to connect 5V logic out to 3V logic in***, that's ***when you want to power the 74AHCT125 with 3V, it can safely read 5V logic on the input pins***.
https://www.adafruit.com/product/1787
DESCRIPTION
Level shifting chips let you connect 3V and 5V devices together safely.
This chip is similar to others in the shop (such as the 74LVC125) except ***this one is particularly good at converting 3V logic up to 5V***.
(1) ***Just power the 74AHCT125 with 5V, it will detect 3V logic properly***.
(2) ***You can also use it to connect 5V logic out to 3V logic in***, that's ***when you want to power the 74AHCT125 with 3V, it can safely read 5V logic on the input pins***.
1 hour later…
1:16 PM
Now I am reading docs for Pico UART, which I found very different from Rpi UART. I am summarizing the methods I will be using for controllong MX05 and FS1000A.
Quick reference for the RP2 docs.micropython.org/en/latest/rp2/quickref.html UART (serial bus) There are two UARTs, UART0 and UART1. UART0 can be mapped to GPIO 0/1, 12/13 and 16/17, and UART1 to GPIO 4/5 and 8/9. from machine import UART, Pin uart1 = UART(1, baudrate=9600, tx=Pin(4), rx=Pin(5)) uart1.write('hello') # write 5 bytes uart1.read(5) # read up to 5 bytes ---- class UART – duplex serial communication bus docs.micropython.org/en/latest/library/…
2:10 PM
Writing the pico serial loopback program is much easier than I expected. It only took me 10 minutes. The program listing with sample output is shown below:
# mx05v04.py MX05V, FS1000S 433MHz Demo Program v0.4 tlfong01 2021oct23hkt2202
# Pico GP Pin Assignment
# GP0 = UART0 TxD = MX05 433MHz Revciver Module Data Pin
# GP1 = UART0 RxD = FS1000D 433MHz Transmit Module Data Pin
# Setup
# To loop back, short TxD pin to RxD pin
from machine import UART, Pin
import utime
uart0 = UART(0, baudrate = 9600, tx=Pin(0), rx=Pin(1))
def testUartLoopBackV01():
print('Begin testUartLoopBackV01(), ...')
testMsg = 'Hello World'
print(' writeTestMsg =', testMsg)
# Pico GP Pin Assignment
# GP0 = UART0 TxD = MX05 433MHz Revciver Module Data Pin
# GP1 = UART0 RxD = FS1000D 433MHz Transmit Module Data Pin
# Setup
# To loop back, short TxD pin to RxD pin
from machine import UART, Pin
import utime
uart0 = UART(0, baudrate = 9600, tx=Pin(0), rx=Pin(1))
def testUartLoopBackV01():
print('Begin testUartLoopBackV01(), ...')
testMsg = 'Hello World'
print(' writeTestMsg =', testMsg)
6. I forgot the level shifter for the Transmitter FS1000S. I need to find the HCT125 chip to make the level shifter.
7. Day is done: youtube.com/watch?v=5UrunpqtcIE. Will carry on tomorrow: youtube.com/watch?v=K2gMdOHmC94.
« first day next day → last day (20 days later) »
Transcript for
Oct22
Oct '2123
Oct24
Discussion between tlfong01 and Antifa
Imported from a comment discussion on raspberrypi.stackexchang...