reynico / raspberry-noaa

Fully automated ISS SSTV, NOAA and Meteor satellite image downloader using Raspberry PI
https://github.com/reynico/raspberry-noaa
GNU General Public License v3.0
180 stars 56 forks source link

Create directory for ISS wav file recordings #90

Closed MihajloPi closed 3 years ago

MihajloPi commented 3 years ago

Added sudo mkdir -p /usr/share/html/iss because sox couldn't save file since the directory didn't exist. This is from the log:

/usr/bin/sox FAIL formats: can't open output file `/usr/share/html/iss/iss-20201225-094200.wav': No such file or directory

reynico commented 3 years ago

ISS reception script is a bit old, thus the /usr/share/html path is no longer correct. I would rather point the receive_iss.sh script to /var/www/wx/iss

MihajloPi commented 3 years ago

It seems that sound files aren't recorded properly, only 44 bytes long each. By the way, I've changed the file path to /var/www/wx/iss/.

image

reynico commented 3 years ago

Mmmh, any error displayed when you manually run the script?

MihajloPi commented 3 years ago

This is from the log:

From pi@raspberrypi Sun Dec 27 09:44:00 2020
Return-path: <pi@raspberrypi>
Envelope-to: pi@raspberrypi
Delivery-date: Sun, 27 Dec 2020 09:44:00 +0100
Received: from pi by raspberrypi with local (Exim 4.92)
        (envelope-from <pi@raspberrypi>)
        id 1ktRei-0000mn-LY
        for pi@raspberrypi; Sun, 27 Dec 2020 09:44:00 +0100
Subject: Output from your job       71
To: pi@raspberrypi
Message-Id: <E1ktRei-0000mn-LY@raspberrypi>
From: pi@raspberrypi
Date: Sun, 27 Dec 2020 09:44:00 +0100

/home/pi/raspberry-noaa/receive_iss.sh: 4: [: -eq: unexpected operator
/home/pi/raspberry-noaa/receive_iss.sh: 8: /home/pi/raspberry-noaa/common.sh: Syntax error: "(" unexpected

And this is my receive_iss.sh script:

#!/bin/sh

### Run as a normal user
if [ $EUID -eq 0 ]; then
    echo "This script shouldn't be run as root."
    exit 1
fi

## import common lib
. "$HOME/.noaa.conf"
. "$HOME/.tweepy.conf"
. "$NOAA_HOME/common.sh"

datetime=$(date +"%Y%m%d-%H%M%S")
timeout 660 /usr/local/bin/rtl_fm -M fm -f 145.8M -s 48k -g $GAIN -p 55 -E wav -E deemp -F 9 - | sox -t raw -e signed -c 1 -b 16 -r 48000 - /var/www/wx/iss/iss-${datetime}.wav rate 11025
reynico commented 3 years ago

Hi buddy, I pushed a branch with i think every component we need to integrate ISS transmissions. Take a look at iss_support

git fetch -pt && git pull
git checkout iss_support

There's a migration script under migrations/ that handles some minor modifications to the database and php files.

Just

cd migrations/
./20201292-iss.sh

got it working on my testing station, https://weather.reyni.co/

MihajloPi commented 3 years ago

Hi buddy, I pushed a branch with i think every component we need to integrate ISS transmissions. Take a look at iss_support

git fetch -pt && git pull
git checkout iss_support

There's a migration script under migrations/ that handles some minor modifications to the database and php files.

Just

cd migrations/
./20201292-iss.sh

got it working on my testing station, https://weather.reyni.co/

I'm just looking at the repository and it says that the last commit was 7 days ago.

MihajloPi commented 3 years ago

I'm not familiar with the usage of git on Raspberry Pi but it seems that it won't update it due to the changes which I've made in the scripts.

pi@raspberrypi:~ $ git fetch -pt && git pull
fatal: not a git repository (or any of the parent directories): .git
pi@raspberrypi:~ $ cd raspberry-noaa/
pi@raspberrypi:~/raspberry-noaa $ git fetch -pt && git pull
remote: Enumerating objects: 66, done.
remote: Counting objects: 100% (66/66), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 83 (delta 50), reused 59 (delta 44), pack-reused 17
Unpacking objects: 100% (83/83), done.
From https://github.com/reynico/raspberry-noaa
   d247e15..9acaa1d  master      -> origin/master
 * [new branch]      iss_support -> origin/iss_support
 * [new tag]         v1.6        -> v1.6
Updating d247e15..9acaa1d
error: Your local changes to the following files would be overwritten by merge:
        install.sh
Please commit your changes or stash them before you merge.
Aborting
pi@raspberrypi:~/raspberry-noaa $ git checkout iss_support
error: Your local changes to the following files would be overwritten by checkout:
        install.sh
        receive.sh
        receive_iss.sh
        receive_meteor.sh
        schedule.sh
Please commit your changes or stash them before you switch branches.
Aborting
pi@raspberrypi:~/raspberry-noaa $ ls
autoupdate.sh  HARDWARE.md      INSTALL.md  LICENSE  METEOR.md        panel.db  predict   README.md       receive_meteor.sh  rectify.py        schedule_iss.sh     schedule_sat.sh  software  synchronise.sh  test_reception.sh  WORKING.md
common.sh      header_1600.png  install.sh  map      migrate_data.sh  post.py   prune.sh  receive_iss.sh  receive.sh         requirements.txt  schedule_meteor.sh  schedule.sh      sun.py    templates       WEBPANEL.md
reynico commented 3 years ago

Hi, two easy options:

  1. commit and push your local changes so they don't get overwritten (you may need to change your upstream repo)
  2. the easiest one as you don't need to mess up with your upstream URL repository / commit files
    cd /home/pi/
    mv raspberry-noaa raspberry-noaa-bak
    git clone https://github.com/reynico/raspberry-noaa.git -b iss_support
    cp raspberry-noaa-bak/sun.py raspberry-noaa/sun.py

and then run the migration

cd raspberry-noaa/migrations/
./20201292-iss.sh

I'm just looking at the repository and it says that the last commit was 7 days ago.

Yeah, that's because you're seeing the master branch. Change to iss_support

MihajloPi commented 3 years ago

Hi, I've tried to run everything as you've said, but I get an error. This happens when I try to run the script. It cannot be seen here, but previously I've downloaded and renamed my folder into raspberry-noaa-backup.

pi@raspberrypi:~/raspberry-noaa $ cd migrations/
pi@raspberrypi:~/raspberry-noaa/migrations $ ls
20201292-iss.sh
pi@raspberrypi:~/raspberry-noaa/migrations $ ./20201292-iss.sh            INFO : 1/6: Backing up database
cp: cannot stat '/home/pi/raspberry-noaa/panel.db': No such file or directory
reynico commented 3 years ago

ah sorry, you'll need to copy your existing database

cp raspberry-noaa-bak/panel.db raspberry-noaa/panel.db
MihajloPi commented 3 years ago

I've applied those changes, now I'm waiting for the next ISS pass over my location. By the way, could you explain me the reasoning behind this piece of code in Conn.php:

case 2: // ISS
    for ($x = 0; $x <= $pass['img_count']-1; $x++) {
    $enhacements[] = "-$x.png";
    }
    break;

And why does in V_viewLastImages.php we have:

case 2: // ISS
    $ending = "-0.png";
    break;

Why zero in -0.png? Why don't you push those changes for receiving the ISS as a new commit or a new version of your repository?

reynico commented 3 years ago

Sure,

case 2: // ISS
    for ($x = 0; $x <= $pass['img_count']-1; $x++) {
    $enhacements[] = "-$x.png";
    }
    break;

The ISS sends 2-minute SSTV transmissions almost all the time (I think they wait 1-2 minutes between transmissions). A good ISS pass down here at Argentina is about 9-11 minutes so I receive up to 2-3 images in the same pass. In order to get all the images decoded I append a counter at the end of the file so for example I got

ISS20201230-144046-0.png
ISS20201230-144046-1.png

img_count is a column of the database where I store how many images I decoded. Then the model creates an array enhancements with each filename where $x is a variable that goes from zero to img_count - 1. Thus If I receive two images I got -0.png and -1.png.

In case of the View, I display just the first image as the "cover" for the details. then in the details I display as many pictures I decode.

case 2: // ISS
    $ending = "-0.png";
    break;

Why don't you push those changes for receiving the ISS as a new commit or a new version of your repository?

Actually those changes are new commits, you can see them here: https://github.com/reynico/raspberry-noaa/commits/iss_support

MihajloPi commented 3 years ago

Hi! I'm still not getting anything decoded. It's curently 2 am here and ISS pass.has been an hour ago. This is the log:

From pi@raspberrypi Fri Jan 01 01:04:48 2021
Return-path: <pi@raspberrypi>
Envelope-to: pi@raspberrypi
Delivery-date: Fri, 01 Jan 2021 01:04:48 +0100
Received: from pi by raspberrypi with local (Exim 4.92)
(envelope-from <pi@raspberrypi>)
id 1kv7w0-0000JR-B5
for pi@raspberrypi; Fri, 01 Jan 2021 01:04:48 +0100
Subject: Output from your job      163
To: pi@raspberrypi
Message-Id: <E1kv7w0-0000JR-B5@raspberrypi>
From: pi@raspberrypi
Date: Fri, 01 Jan 2021 01:04:48 +0100

INFO : Starting rtl_fm record
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to 7.70 dB.
Tuned to 146184000 Hz.
Oversampling input by: 32x.
Oversampling output by: 1x.
Buffer size: 5.33ms
Sampling at 1536000 S/s.
Output at 48000 Hz.
Signal caught, exiting!

User cancel, exiting...

Screenshot_20210101-015635.png

reynico commented 3 years ago

could you please upload the wav files from the ISS? they're located at /var/www/wx/audio/

MihajloPi commented 3 years ago

I've received the audio files but they are all noise since the ISS passed on the north and my house is blocking the view so there is no point in uploading the audio files. I was just confused earlier that the ISS in the pass schedule table isn't greyed out after the pass has completed.

reynico commented 3 years ago

I was just confused earlier that the ISS in the pass schedule table isn't greyed out after the pass has completed.

yeah I think I'll need to put hands on on some notification-like setup as the ISS passes are greyed up just if they had something to decode and generate a picture.

@mihajlo2003petkovic I just merged the iss_support branch into master. Could you please close this PR?

MihajloPi commented 3 years ago

Nice! Thanks!