I want to run weewx on a raspi zero 2 w. I want an RTL-SDR radio dongle and an arduino uno to communicate with the raspi02w over two usb connections. If I replaced the raspi zero 2 w with a raspi 4 I think I could do this simply by using the raspi 4 host usb ports (not the usb-c). On a computer for the arduino connection I use ttyUSB0. Before I resort to using a raspi4, to keep the heat in the case lower, is it feasible with the zero 2 w?
- The micro usb connector on the zero 2 w is a host for devices like keyboards and mice. I found out I can attach the arduino to it and use it as ttyUSB0. Will try to see if it works for RTL-SDR also.
- The console cable is supposed to be attached to 5V,GND,TX,RX so can I attach the arduino to it (use it like ttyUSB0)?
- How do I set up the console cable as a serial port (use it like ttyUSB0)?
- what device is it? ttyGS0, ttyGS1?
- Can the console cable provide power downstream?
So far I think how you set up the serial ports is: in /boot/config.txt include at end
enable_uart=1
dtoverlay=dwc2,dr_mode=host
dtoverlay=disable-bt
note the dr_mode=host
. In cmdline.txt it looks like I need something like: after rootwait
, add space, then modules-load=dwc2,g_serial
.
I planned to have the other physical usb power plug (the one on the corner of the zero2w for power ONLY not the two usb data connections) connected at the same time to power the arduino, the RTL-SDR AND the zero2w. Before I try this, adafruit said in their writeup for the "usb gadget" (usb serial console) raspi setup, you should never hook up the 5V to the console cable at the same time as using the dedicated usb power plug in the corner of the board. If you tell me this is safe I will try it then I can report back. I expect that since the two data usb ports supply power downstream (instead of receiving power from upstream as in the adafruit console example), I should be okay. Is this correct?
UPDATE: amazing information goldilocks, THANKS :-). So far: I plugged the built-in usb port on the raspi02w (the data plug as opposed to the power plug) into the arduino without an OTG cable or anything and it was immediately recognized as ttyUSB0. Just to be clear the raspi02w is the usb host and the arduino is the peripheral. To test my raspi code I type "stty -F /dev/ttyUSB0 raw; cat /dev/ttyUSB0" and the serial output from the arduino appears ... that's what my weewx driver on the raspi requires so THE FIRST USB CONNNECTION WORKS with ZERO configuration.
As for the RTL-SDR what I need is to plug it in to a second raspi USB port. The RTL-SDR driver is called rtl_433. In the meantime I will try to figure out what this driver needs other than just a "USB port". What I have is an adafruit "CONSOLE CABLE" with TX/RX/GND/5V jumpers on one end and USB-A-male on the other like the one pictured below. I am not sure what this exactly is but you can connect from a computer to the raspi when the console cable is connected to TX/RX/GND. The 5V connection would provide power downstream from computer to raspi and is meant to be used if the usb power plug on the raspi is disconnected. I am certainly confused.
What it looks like is that I stupidly assumed that since the "CONSOLE CABLE" has a USB-A-MALE plug it is the same thing as a usb port. I expect that it is not.
The raspi USB data plug (not the power plug) REALLY IS a usb port with a usb controller, so I should try putting the RTL-SDR on that instead and put the arduino on the console cable connected to (TX/RX/5V/GND). At this point, will this console cable enable me to do this and how?