I’m currently working in a new DIY project, where I need to send a message through RF from Raspberry Pico, and receive it in an other Raspberry Pico through RF. I have bought some common RF433 receivers and transmitters (see image below) I’m using MicroPython. I have searched Internet to find pos…pi-picomicropythontlfong016715(1) MX-05V is newbie firendly. (2) Arduino video tutorial, libraries, and demo code are easy to find. (3) Pico equivalent is not around, unfortunately. (4) Fortunately the code is not that complicated, so you can try to convert the Arcuino C++ code to Pico MicroPython (the other way around is more difficult, though). If you decided to use MX-05V, you might like to list the simple code and me or others might give a hint on how to convert it to python. PS, I once used use Arduino Decimilla 3V3 SPI RF12B and found it tricky to work with, But 5V MX-05Ｖ is much simpler. / to continue, … AntifaThanks for your comment. I will try your proposal to convert Arduino library to RpiPico. Do you have any specific library recommendation? tlfong016715Ah, I need to first look at the datasheet, to make sure if my suggestion makes any sense. 433MHz Wireless Modules MX-05 _ HobbyComponents forum.hobbycomponents.com/viewtopic.php?t=1324I randomly googled and found this library. Now I am checking it out. HCWireless Arduino Library for 433MHz Wireless Tx & Rx modules – HobbyComponents forum.hobbycomponents.com/viewtopic.php?f=58&t=2914The HobbyComponents does not provide any MX-05V datasheet. Other shops seems to link another chip: components101.com/modules/433-mhz-rf-receiver-module.This tutorial looks better: How to use 315Mhz RF Transmitter and Receiver Modules (MX-FS-03V / MX-05V) with Arduino myhowtosandprojects.blogspot.com/2014/01/….And this looks like a good library: VirtualWire Library VirtualWire, by Mike McCauley (PDF), helps you use very inexpensive wireless radio modules – PJRC pjrc.com/teensy/td_libs_VirtualWire.htmlAntifaI will check and I will get back to you tlfong016715OK. BTW, documentation is very good: airspayce.com/mikem/arduino/VirtualWire.pdfJust now I tried to download VirtualWire in my Windows 10, but no luck. I have no Arduino staff in my PC Windows, and no Arduino in hand. It would be nice if you can installed VirtualWire somewhere and pass me a copy of the source code, then I can skim through it and see if it would be easy just to translate the bare bone part and try it in Rpi Pico MicroPython. Antifayst 16:21I have found this VirtualWire library for Pi. Indeed it is not for Pico. Also this source code has a dependency to RPi.GPIO which is not for Pico also. quadmeup.com/virtualwire-support-for-raspberry-pitlfong016715Oh my goodness. piVitrualWare is many times better than original VirtualWare for Arduino, because is it already in python, therefore saves a lot of C++ to python conversion time. However, there are two small problems: (1) As you said, it is using Rpi built in Rpi Gpio module, which is not the same as the Pico GPIO module. I think it easy to do the almost trival one to one conversion. (2) The PiPGIO thing a bigger problem:(a) it is sort of a daemon thing, meaning that you can only run it in the background, (b) I heard that PiGPIO might not run smoothly on Rpi4B, because of system timing problem. And Pico is no multitasking OS like Rpi OS, so the timing problem might be more tricky to handle. But I think we can do these: (i) study the PiGPIO source code, and see how it interface with the daemon, and the main idea of the MX05V control, (ii) then rewrite the VirtualWire thing starting from afresh, …With PC Windows Thonny Rpi Pico MicroPython. I think it is not a complicated job at all. PiVirtualWire can be downloaded to Rpi or Windows, but I have not played with linux CLI commands for over a year, and don’t have a working Rpi4B in hand (I have 5 working Pico’s in hand! :)) So it would be nice if you can do the following for me:(A) Down load the PiVirtualWare in any platform you like, (A) Pass me the complete python code listing. I guess the complete listing should be shorter than 500 lines. I will study the code and guesstimate how long it would take me to do a quick and dirty conversion, perhaps only the transmit part, to prove the concept.Nothing urgent, please take your time. BTW I already ordered a couple of the real thing, they should arrive in 2 working days: item.taobao.com/…. Cheers. 2 hours later… Antifa339yst 19:09You mean this?github.com/DzikuVx/…I have found also this, but it lacks some functions.
forums.raspberrypi.com/…tlfong016715yst 19:31Ha, your two links are very helpful, and the first link is almost what I want, actually better than what I want. I am sorry I don’t express myself clearly and caused the confusion.Let me try again. (1) the piVirtualWaire library is what I want to explore further. But I don’t have any Rpi4B or other linux thing in hand, and I don’t want to setup Rpi4B just to install the piVirtualWire. So I thought you might help to install the piVirtaulWire in your Rpi (I assumed you have Rpi3/4, and you have experience using Rpi OS and linux CLI commands like Make etc),get the python listing and send me a copy. But this is NO longer necessary, because you first link is what almost what I want, or even better. Anyway, I will now look at your first link and see how useful it is.Now your second link about a “shim” useful to those who want to run Rpi python programs (using Rpi built in GPIO or GPIOZero modules) on Pico. This shim would convert the original Rpi porgram to run in Pico and run it there. This clever thing is of course useful in general, but not for our situation, because using the piGPIO, a daemon thing, which I think the above shim cannot handle.This might be a bit complicated, but not too important, because if the first link’s source code is complete and not too long (as I have guessed, less than 500 lines), it might be easy to rewrite part of the code initializing Rpi GPIO pins to Pico GP pins.Anyway, you have already helped a lot in this research part. Perhaps you can now take a break, sit down and let me skim your first link’s piVirtualWire code and see how useful is it. tlfong016715yst 20:01github.com/DzikuVx/…I am back. I went to your first link on VirtualWire: github.com/DzikuVx/…I found the guy written this piVirtualWire uses joan’s piGPIO which is a GPIO module similar to Rpi’s GPIO or GPIOzero, but in the form of a daemon, running on the background, and have special functions, like timing interrupts, callback functions, PWM etc. I have never used this piGPIO before, because I don’t need those special functions based on a daemon.I have skimmed the VirtualWire library and found it a simple library with two basic functions, (1) sending a message, (2) receiving a message, both using one pin. There are also CRC functions, but not important in our application.Of course I am only guessing. I tend to think that piVirtualWire (or VirtualWire) is just a software utility based on serial communication stuff, ie RxTx, UART etc.So there is a big chance if we use Pico python SDK’s UART functions, we can write something similar of piVirtualWire.As I said earlier, my MX05V toys might arrive the day after tomorrow. I will then do the first basic experiments: (1) Just power up the transmitter module, and input some rubbish data, say a square wave pulse to the output pin, and (2) at the same time, set up the receiver module, and use my scope to display the waveform at input pin.I am assuming that the xmit and recv module start to operate automatically when powered up, it is only we need hardware or software (VirtualWire) to encode and decode the messages send/receive.You might like to google more tutorials or videos to see if my guesses make sense, or wait until my MX05V toys arrive when I will verify my guesses. Antifayst 20:23thank you very much for the support tlfong016715Ah one more thing. I forgot to mention that components 101 mention a complicated encoder and decoder, which is not used in our cheap cheap moduels. components101.com/ics/…You are welcome. I once played with similar RF modules RFM12B and nRL2401+. I have never played with MX05V before, so it is a good chance to update myself. How nice we can learn together. Cheers. tlfong016715yst 21:00Just now I watch this tutorial a second time: Arduino RF Tutorial [Using VirtualWire] (MX-05V / MX-FS-03V) 18,712 viewsJan 19, 2014
youtube.com/…, and I found I made a wrong guess: The receiver module will NOT start when powering up, we need to use a VirtualWire function to start it up. So ignore my wrong guess I made earlier. 13 hours later… tlfong01671510:21My 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 快件在【香港青衣中转场】完成分拣,准备发往 【深水埗青山道順豐站】(see full text)tlfong01671510:45Now 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 https://github.com/DzikuVx/piVirtualWire/blob/master/piVirtualWire.py
(see full text) 5 hours later… tlfong01671515:24Now 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.penzu.com/p/f1e301a4The 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. tlfong01671516:23My 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.
Now I am going to put up the antennas. 🙂 tlfong01671518:07I 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.