JTK – Notes and Ramblings Things we have found …


Weather Radio Part 2

Filed under: General,Home Automation,RTL-SDR — taing @ 8:40 am

Continuing from http://jtkdev.com/wp/2019/01/03/pi-weather-radio-w-same/.

Using the code from http://jtkdev.com/wp/2019/01/03/pi-weather-radio-w-same/ to decode the SAME alerts in the broadcast. The current current script:

rtl_fm -f 162298000 -s 22050 -p 14 | tee >(multimon-ng -t raw -a EAS /dev/stdin | python ~/dsame/dsame.py --text >> alerts.txt) | lame --bitwidth 16 --signed -s 22050 --lowpass 3500 --abr 64 --scale 8 -r -m m - - |ezstream -c ezstream.xml

Notice the sample rate has been reduced to match what is expected by multimon-ng.

It was necessary to download and install multimon-ng. We also installed sox (sudo apt-get install sox) to test the dsame code with the included sample.


Pi Weather Radio w/SAME

Filed under: General,Home Automation,RTL-SDR — taing @ 11:35 pm

So I have been planning to use the SDR dongle as a weather radio for some time. The goal was to stream the audio AND capture the digital SAME messages to signal weather alerts.

I found several useful references online: https://github.com/tim273/weather_radio_scripts, https://github.com/cuppa-joe/dsame, https://www.dynode.nl/streaming-radio-receivers-with-the-raspberry-pi/ and https://www.wxforum.net/index.php?topic=31396.msg314826#msg314826.

I installed rtl-sdr, lame, icecast2 and ezstream.

sudo apt-get install rtl-sdr lame icecast2 ezstream

I created 20.rtlsdr.rules in /etc/udev/rules.d/

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", GROUP="adm", MODE="0666", SYMLINK+="rtl_sdr"

I created /etc/modprobe.d/rtlsdr-blacklist.conf

blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830

After rebooting I was able to use rtl_test successfully. Using the NOAA website I was able to look up the require frequency for my location. It took a bit of fiddling to get the proper frequency setting for the dongle to actually tune the desired channel. The desired frequency for me is 162.55Mhz. I ended up using 162.298M to truly tune 162.55M.

rtl_fm -f 162298000 -s 48000 -p 14

Piping this to lame results in an MP3 stream.

rtl_fm -f 162298000 -s 48000 -p 14 | lame --bitwidth 16 --signed -s 48000 --lowpass 3500 --abr 64 --scale 8 -r -m m - - > test.mp3

The next step was to create a config XML file to ezstream and test the stream. A little touch-up is required for the sample below.

For streaming from standard input, the default for continuous streaming
is bad. Set <stream_once /> to 1 here to prevent ezstream from spinning
endlessly when the input stream stops:
The following settings are used to describe your stream to the server.
It's up to you to make sure that the bitrate/quality/samplerate/channels
information matches up with your input stream files.
<svrinfoname>Weather test stream</svrinfoname>
<svrinfodescription>Weather test stream</svrinfodescription>
<!-- Turn off YP directory advertising -->
rtl_fm -f 162298000 -s 48000 -p 14 | lame --bitwidth 16 --signed -s 48000 --lowpass 3500 --abr 64 --scale 8 -r -m m - - | ezstream -c ezstream.xml

The test icecast2 stream can be found at http://your-ip:8000/weather. The icecast2 config can be edited at /etc/icecast2/icecast.xml. Documentation for the config file can be found at http://icecast.org/docs/icecast-2.4.1/config-file.html.

Next I’ll be working to integrate the python from https://github.com/cuppa-joe/dsame handle the digital side of the stream. For now we have the stream going to the icecast2 stream and also piping to the next thing.

rtl_fm -f 162298000 -s 48000 -p 14 | lame --bitwidth 16 --signed -s 48000 --lowpass 3500 --abr 64 --scale 8 -r -m m - - |tee >(ezstream -c ezstream.xml) | cat >test1.mp3
« Newer Posts

Powered by WordPress