Raspberry Pi NOAA and Meteor-M 2 Receiver
by NateDN10 in Circuits > Raspberry Pi
12477 Views, 20 Favorites, 0 Comments
Raspberry Pi NOAA and Meteor-M 2 Receiver
This instructable will help you set up a receiving station for not just APT from NOAA-15, 18 and 19, but also Meteor-M 2.
It's really just a small follow-on project to haslettj's great "Raspberry Pi NOAA Weather Satellite Receiver" project.
Start With Haslettj's Instructable
Before you follow haslettj's Instructable, note these changes first:
The old address for wxtoimg is no longer up. You can now use this address instead in the wget command:
https://www.wxtoimgrestored.xyz/beta/wxtoimg-linux-armhf-2.11.2-beta.tar.gz
I also had to make a change to the "receive_and_process_satellite.sh" script, because rtl_fm apparently does not actually output "wav" format audio. But it's no problem, sox can handle it. So I changed this line:
sudo timeout $6 rtl_fm -f ${2}M -s 60k -g 45 -p 55 -E wav -E deemp -F 9 - | sox -t wav - $3.wav rate 11025
To this (but remember to replace the "-g 0" gain setting and "-p 68" PPM frequency error setting with something that works for your hardware):
sudo timeout $6 rtl_fm -f ${2}M -s 48k -g 0 -p 68 -E dc -A fast -F 9 - | sox -t raw -r 48000 -es -b16 -c1 -V1 - $3.wav rate 11025
In the same script, you may also want to change the wxtoimg argument "-e ZA" to "-e MSA" to get nice color images, like this:
/usr/local/bin/wxtoimg -m ${3}-map.png -e MSA $3.wav $3.png
Now go do the Instructable!
Install GnuRadio and Blocks for RTL-SDR
The Meteor-M 2 receiver uses GnuRadio. To install what you need, do this:
sudo apt install gnuradio sudo apt install gr-osmosdr
Download GnuRadio Scripts
If you're not familiar, GnuRadio includes a graphical tool called GnuRadio-Companion which can be used to build flow graphs and compile them into Python code which is then executed.
I have forked "otti-soft"s "meteor-m2-lrpt" receiver by modifying some of the parameters to improve performance and using RTL-SDR instead of Airspy. Download it from here:
https://github.com/NateDN10/meteor-m2-lrpt
The .grc files can be opened with GnuRadio-Companion, but they're not executable scripts - they're there for your reference and to play around with. To just get it working, copy the file "rtlsdr_m2_lrpt_rx.py" into your /home/pi/weather/predict directory, and make sure it's executable:
chmod +x rtlsdr_m2_lrpt_rx.py
You'll also want to change the frequency offset:
self.rtlsdr_source_0.set_freq_corr(69, 0)
And gain to whatever works for your setup:
self.rtlsdr_source_0.set_gain(4, 0)
Download the Decoder
Download "artlav"s Meteor LRPT decoder from here - you want the Linux ARM version:
http://orbides.org/page.php?id=1023
You can accomplish this on the Raspberry Pi using these commands:
cd /home/pi/weather wget https://orbides.org/etc/medet/medet_190825_arm.tar.gz mkdir medet; cd medet tar xvzf ../medet_190825_arm.tar.gz
You should now have a directory called "medet" within your "weather" directory, and inside it should be a "medet_arm" executable.
Download Other Tools
To fix the aspect ratio of the images we're going to use dbdexter's "meteor_rectify" Python tool from Github.
If you don't already have git and ImageMagick installed:
sudo apt install git sudo apt install imagemagick
Then clone the repository:
cd /home/pi/weather git clone https://github.com/dbdexter-dev/meteor_rectify.gi...
You may also need the "pillow" and "numpy" Python libraries:
pip3 install numpy pip3 install pillow
Update the Scripts
First, add the following line to the end of "schedule_all.sh":
/home/pi/weather/predict/schedule_satellite.sh "METEOR-M 2" 137.1000
Then, in "schedule_satellite.sh", change this block:
if [ $MAXELEV -gt 19 ]; then echo ${1//" "}${OUTDATE} $MAXELEV echo "/home/pi/weather/predict/receive_and_process_satellite.sh \"${1}\" $2 /home/pi/weather/${1//" "}${OUTDATE} /home/pi/weather/predict/weather.tle $var1 $TIMER" | at `date --date="TZ=\"UTC\" $START_TIME" +"%H:%M %D"` fi
To this:
if [ $MAXELEV -gt 19 ]; then echo ${1//" "}${OUTDATE} $MAXELEV if [ "$1" == "METEOR-M 2" ] then echo "/home/pi/weather/predict/receive_and_process_meteor.sh \"${1}\" $2 /home/pi/weather/${1//" "}${OUTDATE} /home/pi/weather/predict/weather.tle $var1 $TIMER" | at `date --date="TZ=\"UTC\" $START_TIME" +"%H:%M %D"` else echo "/home/pi/weather/predict/receive_and_process_satellite.sh \"${1}\" $2 /home/pi/weather/${1//" "}${OUTDATE} /home/pi/weather/predict/weather.tle $var1 $TIMER" | at `date --date="TZ=\"UTC\" $START_TIME" +"%H:%M %D"` fi fi
Finally, create a new script called "receive_and_process_meteor.sh" with the following contents:
#! /bin/bash # $1 = Satellite Name # $2 = Frequency # $3 = FileName base # $4 = TLE File # $5 = EPOC start time # $6 = Time to capture cd /home/pi/weather timeout $6 predict/rtlsdr_m2_lrpt_rx.py $1 $2 $3 # Winter #medet/medet_arm ${3}.s $3 -r 68 -g 65 -b 64 -na -S # Summer medet/medet_arm ${3}.s $3 -r 66 -g 65 -b 64 -na -S rm ${3}.s if [ -f "${3}_0.bmp" ]; then #rm ${3}.s dte=`date +%H` # Winter #convert ${3}_1.bmp ${3}_1.bmp ${3}_0.bmp -combine -set colorspace sRGB ${3}.bmp #convert ${3}_2.bmp ${3}_2.bmp ${3}_2.bmp -combine -set colorspace sRGB -negate ${3}_ir.bmp # Summer convert ${3}_2.bmp ${3}_1.bmp ${3}_0.bmp -combine -set colorspace sRGB ${3}.bmp meteor_rectify/rectify.py ${3}.bmp # Winter only #meteor_rectify/rectify.py ${3}_ir.bmp # Rotate evening images 180 degrees if [ $dte -lt 13 ]; then convert ${3}-rectified.png -normalize -quality 90 $3.jpg # Winter only #convert ${3}_ir-rectified.png -normalize -quality 90 ${3}_ir.jpg else convert ${3}-rectified.png -rotate 180 -normalize -quality 90 $3.jpg # Winter only #convert ${3}_ir-rectified.png -rotate 180 -normalize -quality 90 ${3}_ir.jpg fi rm $3.bmp rm ${3}_0.bmp rm ${3}_1.bmp rm ${3}_2.bmp rm ${3}-rectified.png # Winter only #rm ${3}_ir.bmp #rm ${3}_ir-rectified.png fi
Make it executable:
chmod +x receive_and_process_meteor.sh
And that's it! Next time your existing cron job runs to schedule satellites, Meteor-M 2 will be scheduled also. The decoder will output a .bmp using APID 66 for red, 65 for green, and 64 for blue.
The standard output from the scripts, when they're run by the scheduler, is appended to /var/mail/pi. To read it, use this command:
less /var/mail/pi
And to erase old messages, do this:
> /var/mail/pi