« first day    last day (20 days later) » 

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 快件在【香港青衣中转场】完成分拣,准备发往 【深水埗青山道順豐站】
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.
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
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.
The simplified code is list below. The titles of the main functions are highlighted in red.
The Tx Class is summarized below:
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.set_mode(txgpio, pigpio.OUTPUT)
The most important statement to pay attention is the last one:
pi.set_mode(txgpio, pigpio.OUTPUT)
I think the most important statement to pay attention is the last one:
pi.set_mode(txgpio, pigpio.OUTPUT)
which means to set the GPIO pin for transmit to output mode.
8:23 AM
My RF toys arrived 10am this morning. :)
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.
Now the schematic.
9:34 AM
Now I am going to put up the antennas. :)
10:07 AM
I read the MX05V and FS1000A and found that the receiver MX05V accepts power 3V to 12V, but the transmitter must use 5V. So I need to use a level converter to upshift the Pico 3V3 GP pin output to 5V logic.
2 hours later…
11:57 AM
And I am going to use HCT125 to do the level shifting job.
74AHCT125 - Quad Level-Shifter (3V to 5V) - A -US$1.50


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

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
I will now goto Windows Thonny Pico MicroPython to write a little UART demo program, a UART serial loop back program, I will be using GP0 for Tx, GP1 for Rx
I will try to write 3 characters 'abc' and read back the bytes object.
I am new this pico uart. I guess it might take me two working days to debug this pico uart serial loopback program.
1:45 PM
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)
Now my test plan for the RF 433MHz MX05V Receiver and FS1000S Transmitter is summarized below:
1. Only one pico is used for this preliminary testing.
2. Pico GP0 is connected to FS1000S data pin.
3. Pico GP1 is connected to MX05V data pin.
4. Run the above demo program.
5. If bytes read from Receiver is the same as bytes written to Transmitter, then everything is OK.
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    last day (20 days later) »