October 8, 2019

SDR and water meters

My idea here is to be able to read the telemetry from the new digital water meter in front of my house. My main purpose in doing that is to monitor flow and set up something that will warn me of leaks (or if I leave the hose running).

SDR resources

SDR (software defined radio) goes much deeper than water meters. All kinds of things are possible. My advisor (Dallan) tells me he has invested many tens of hours fooling with SDR and has a collection of SDR dongles. I purchased a package on Amazon (for $30 in 9/2019) that is described as:

RTL-SDR Blog V3 R820T2 RTL2832U 1PPM TCXO HF Bias Tee SMA Software Defined Radio with Dipole Antenna Kit

My advisor also tells me that "sdr radio" is the best software to use (but it is Windows only apparently). Also the SDR reference site is a database of who is using what frequency. Apparently you can browse the web interface freely, but if you pay a fee you can do database lookups, which can be useful if you are developing your own software. The "RTL" in RTL-SDR seems to stand for the Realtek RTL2832U chipset that is used in these devices.

Linux and SDR

Gnu-radio seems to be a low level interface. Doing "dnf install gqrx" on my Fedora 30 system pulls in 45 packages, including gnuradio, a package called "rtl-sdr" and a bunch of Python and Qt packages.

I plug in my dongle, and see:

Oct  8 18:37:48 trona kernel: usb 2-1.8: new high-speed USB device number 5 using ehci-pci
Oct  8 18:37:49 trona kernel: usb 2-1.8: New USB device found, idVendor=0bda, idProduct=2838, bcdDevice= 1.00
Oct  8 18:37:49 trona kernel: usb 2-1.8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct  8 18:37:49 trona kernel: usb 2-1.8: Product: RTL2838UHIDIR
Oct  8 18:37:49 trona kernel: usb 2-1.8: Manufacturer: Realtek
Oct  8 18:37:49 trona kernel: usb 2-1.8: SerialNumber: 00000001
Oct  8 18:37:49 trona kernel: usb 2-1.8: dvb_usb_v2: found a 'Realtek RTL2832U reference design' in warm state
Oct  8 18:37:49 trona kernel: usb 2-1.8: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
Oct  8 18:37:49 trona kernel: dvbdev: DVB: registering new adapter (Realtek RTL2832U reference design)
Oct  8 18:37:49 trona kernel: usb 2-1.8: media controller created
Oct  8 18:37:49 trona kernel: dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
Oct  8 18:37:49 trona kernel: i2c i2c-10: Added multiplexed i2c bus 11
Oct  8 18:37:49 trona kernel: rtl2832 10-0010: Realtek RTL2832 successfully attached
Oct  8 18:37:49 trona kernel: usb 2-1.8: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
Oct  8 18:37:49 trona kernel: dvbdev: dvb_create_media_entity: media entity 'Realtek RTL2832 (DVB-T)' registered.
Oct  8 18:37:49 trona kernel: r820t 11-001a: creating new instance
Oct  8 18:37:49 trona kernel: r820t 11-001a: Rafael Micro r820t successfully identified
Oct  8 18:37:49 trona kernel: Registered IR keymap rc-empty
Oct  8 18:37:49 trona kernel: rc rc0: Realtek RTL2832U reference design as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.8/rc/rc0
Oct  8 18:37:49 trona kernel: input: Realtek RTL2832U reference design as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.8/rc/rc0/input11
Oct  8 18:37:49 trona kernel: rc rc0: lirc_dev: driver dvb_usb_rtl28xxu registered at minor = 0, raw IR receiver, no transmitter
Oct  8 18:37:49 trona kernel: usb 2-1.8: dvb_usb_v2: schedule remote query interval to 200 msecs
Oct  8 18:37:49 trona kernel: usb 2-1.8: dvb_usb_v2: 'Realtek RTL2832U reference design' successfully initialized and connected
Oct  8 18:37:49 trona kernel: usbcore: registered new interface driver dvb_usb_rtl28xxu
Without having a clue what I am doing, but following some instructions online, I type this as user "tom"
rtl_sdr capture.bin -s 1.8e6 -f 392e6
This yields the output:
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Detached kernel driver
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Sampling at 1800000 S/s.
Tuned to 392000000 Hz.
Tuner gain set to automatic.
Reading samples in async mode...
It sits there doing something until I type control-C The "instructions" say to just give it a second or so, so I delete the huge file and repeat the above, but type control-C after a second or two. I get:
[joe@trona ~]$ ls -l capture.bin
-rw-rw-r-- 1 tom tom 8912896 Oct  8 18:44 capture.bin

Have any comments? Questions? Drop me a line!

Tom's Electronics pages / tom@mmto.org