# APRS Balloon project
# Remote Access
Ground
`ssh -l pi -p 2223 IP`
Ballon
`ssh -l pi -p 2226 IP`
iGate
`ssh -l pi -p 2222 IP`
# Keeep up to date your raspberry
https://github.com/wb2osz/direwolf/blob/master/doc/Raspberry-Pi-SDR-IGate.pdf
```
sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update
sudo reboot
```
`sudo apt-get install build-essential cmake`
## Install Direwolf
You’ll need to install Git on your RaspberryPi in order to download Direwolf in the next step and libasound as another dependency. To do so, simply issue the following command:
`sudo apt-get install git libasound2-dev -y`
If you launch git-all or autoremove you will corrupt "systemd" and will be force to install it back with following command:
`sudo apt-get install systemd systemd-sysv`
The above will install what you need to move forward to the next step(s).
Visiting the Direwolf GitHub page, we can begin following the published instructions. This is the easy, copy/paste initial setup phase. Let’s go….
```
cd ~
git clone https://www.github.com/wb2osz/direwolf
cd direwolf
mkdir build && cd build
cmake ..
make -j4
sudo make install
make install-conf
make install-rpi
```
Direwolf is now ‘installed’, but not quite ready for use. We’ll get there soon. Hang tight.
To configure direwolf and add GPS support please look in the sections below.
# IGATE SETUP
## Install drivers for SDR dongle
http://qso365.co.uk/2017/02/a-guide-to-setting-up-an-aprs-receive-only-igate-using-a-raspberry-pi-and-an-rtl-sdr-dongle/
```
sudo apt-get install cmake build-essential libusb-1.0-0-dev
cd ~
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
make
sudo make install
sudo ldconfig
cd..
sudo cp ./rtl-sdr.rules /etc/udev/rules.d/
```
Now you need to complete the final configuration.
Use the APRS credentials:
> code sign= ES3BEC
> SSID = -10 for the igate RX only
> owner= mati teder
> Passcode for ES3BEC is 16560 (from aprsisce)
> Home address: Laulupeo 7-10 Tallinn
>
## Testing the dongle
```
rtl_test -t
```
A succesfull answer look like:
> Found 1 device(s):
> 0: Realtek, RTL2838UHIDIR, SN: 00000001
>
> Using device 0: Generic RTL2832U OEM
> Found Rafael Micro R820T tuner
> Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
> [R82XX] PLL not locked!
> Sampling at 2048000 S/s.
> No E4000 tuner found, aborting.
### Configuring
```
cd ~
sudo nano sdr.conf
```
Modify following line:
`PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=R lat=59.430 long=24.775 COMMENT="ES3BEC iGate | DireWolf 1.6 on RPi+RTL-SDR"`
### Running
`rtl_fm -f 144.80M - | direwolf -c sdr.conf -r 24000 -l . -D 1 -`
-l . means current folder for storing log files
### Automatic start
The last thing to do is to set everything to start automatically when you restart the Raspberry Pi. To do this, edit dw-start.sh
```
cd ~
sudo nano dw-start.sh
```
Scroll down and look for this line
> #DWCMD="bash -c 'rtl_fm -f 144.39M - | direwolf -c sdr.conf -r 24000 -D 1 -'"
Edit it to remove the hash at the start and change the frequency to whatever is appropriate in your area. In Europe, APRS is on 144.800 MHz so my line looks like this
> DWCMD="bash -c 'rtl_fm -f 144.8M - | direwolf -c sdr.conf -r 24000 -D 1 -'"
Save the file and then run the following command to make the script executable.
`sudo chmod +x dw-start.sh`
Currently I am using in sw-start.sh dwcmd() function following below suggestion:
nother solution is to replace
> DWCMD="bash -c 'rtl_fm -f 144.8M - | direwolf -c sdr.conf -r 24000 -D 1 -'"
with a function:
> dwcmd() \{ bash -c 'rtl_fm -f 144.8M - | direwolf -c sdr.conf -r 24000 -D 1 -'; }
and to replace
> $SCREEN -d -m -S direwolf $DWCMD >> $LOGFILE
with
> $SCREEN -d -m -S direwolf $(dwcmd) >> $LOGFILE
Finally, add a line to cron which will run once a minute to check whether Dire Wolf is running and if not, it will restart it.
`crontab -e`
If this is the first time you’ve edited the crontab, you’ll get a prompt asking which editor to use – Just hit enter to select nano as the default.
Scroll down to the bottom and paste the following line.
> * * * * * /home/pi/dw-start.sh >/dev/null 2>&1
Install screen
> sudo apt-get install screen
Reboot your Raspberry Pi and once it’s restarted, it will automatically connect to the APRS network and operate as a receive only iGate. Nothing will be echoed to the display while it’s running like this so you can check the status on aprs.fi.
I hope this guide is straightforward enough to follow – It looks more complicated than it actually is, it’s really quite simple just to follow all the steps through.
# Preparing Balloon for direwolf operation
## Update the system to the latest build
```
sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update
sudo reboot
```
## Install direwolf
See at the beginning fo this page
## Preparing for external GPS support
https://github.com/wb2osz/direwolf/blob/master/doc/Raspberry-Pi-APRS-Tracker.pdf
`sudo apt-get install gpsd libgps-dev`
Ok lets make our gpsd configuration permanent.
Edit the following configuration file using your favorite text editor.
and change the usb interface to what was detected above
`sudo vi /etc/default/gpsd`
```
# Default settings for the gpsd init script and the hotplug wrapper.
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"
# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="true"
# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
# Single GPS
#DEVICES=/dev/ttyUSB0
#Dual GPS
DEVICES=/dev/ttyUSB0 /dev/ttyUSB1
# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"
```
Lets restart the gpsd service
```
sudo systemctl stop gpsd.socket
sudo systemctl start gpsd.socket
```
You can now test if it works fine with the following command
`sudo gpsmon`
or
`cgps /dev/ttyUSB0`
`cgps /dev/ttyUSB1`
`cgps -s`
You should see the following if all is ok with gps connected.
## Removing Pulse Audio
https://n1aae.com/raspberry-pi-aprs-direwolf-linux-igate-digipeater/
Lets remove pulseaudio from the system if its installed by default. Although it works fine on most systems, it does not play well with ARM based devices such as the RaspberryPi. Let’s see if it’s installed, and if it is, remove it.
`dpkg-query -l 'pulseaudio*'`
Your terminal output will appear as below if pulseaudio is missing:
> ||/ Name Version Architecture Description
> +++-============================-========-=============-=========================
> un pulseaudio <none> <none> (no description available)
> un pulseaudio-esound-compat <none> <none> (no description available)
> un pulseaudio-module-bluetooth <none> <none> (no description available)
> ii pulseaudio-utils <none> <none> (no description available)
It should show as <none> under the version column. If pulseaudio is in fact installed, no worries. We’ll uninstall it with the following commands:
```
sudo apt-get remove --purge pulseaudio
rm -rf /home/pi/.pulse
sudo reboot
```
## Setup direwolf
We must now determine what your audio playback devices are for the Direwolf configuration. With your USB sound card plugged in, you can now issue the following command:
`aplay -l`
The output of this command should appear as shown below:
> **** List of PLAYBACK Hardware Devices ****
> card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
> Subdevices: 8/8
> Subdevice #0: subdevice #0
> Subdevice #1: subdevice #1
> Subdevice #2: subdevice #2
> Subdevice #3: subdevice #3
> Subdevice #4: subdevice #4
> Subdevice #5: subdevice #5
> Subdevice #6: subdevice #6
> Subdevice #7: subdevice #7
> card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
> Subdevices: 1/1
> Subdevice #0: subdevice #0
> card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
> Subdevices: 0/1
> Subdevice #0: subdevice #0
You can see that the USB soundcard is recognized as “card 1” in the above output.
To view your audio capture devices, which will be on the same USB soundcard, issue the following command:
`arecord -l`
Your output in the terminal should show the following. Since the RaspberryPi does not have a built-in capture device, the only device shown should be your USB soundcard.
> **** List of CAPTURE Hardware Devices ****
> card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
> Subdevices: 0/1
> Subdevice #0: subdevice #0
Take note of these.
`sudo nano direwolf.conf`
Let’s enter the directory in which Direwolf is now installed.
```
cd
cd ./direwolf
```
Now open up direwolf.conf in nano (if not already installed, do so by simply issuing, “sudo apt-get install nano”)
> nano direwolf.conf
The direwolf.conf file in your terminal is now displayed and ready for editing. We must edit a few items in this configuration file for our use.
First, locate (Line 69):
> #ADEVICE plughw:0,0
You will need to uncomment this line and enter the correct hardware device values that we found in the previous steps, which was card 1, device 0. Change this line in direwolf.conf to:
> ADEVICE plughw:1,0
Now we need to configure the PTT trigger for the baofeng with GPIO PIN
> #PTT GPIO 25
uncomment and replace with following:
> PTT GPIO -25
The minus makes the GPIO pin 25 high by default.
# Running the overall system
1. Fire up ZeroA
`rtl_fm -f 144.80M - | direwolf -c sdr.conf -r 24000 -D 1 -`
or
`/home/pi/start-igate.sh`
2. Fire up ZeroB direwolf
```
cd ~
cd direwolf
direwolf
```
Expect something like this:
> Dire Wolf version 1.5
> Includes optional support for: gpsd
>
> Reading config file direwolf.conf
> Audio device for both receive and transmit: plughw:1,0 (channel 0)
> Channel 0: 1200 baud, AFSK 1200 & 2200 Hz, E+, 44100 sample rate / 3.
> Ready to accept KISS TCP client application 0 on port 8001 ...
> Ready to accept AGW client application 0 on port 8000 ...
## Kissutil
In order to pass information to transmit to Direwolf we will use the embeded util that makes use of Kiss protcol listening on port 8001
We have to prepare inside direwolf a test folder
```
cd ~
cd direwolf
mkdir test
```
then we have to prepare a text file with the AX25 APRS compliant command to broadcast.
```
touch tx.txt
nano tx.txt
```
Paste the follwing:
> K1NRO-1>APDW14,WIDE2-2:!4238.80NS07105.63W#PHG5630
> HB9HCM-11>APOTW1,WIDE1-1:!4558.66N/00853.61E_103/000g004t081P000h29b11084OTW1
When the file tx.txt is copied inside the test folder automatically the content of the file is transmitted and then deleted. Keep always a copy of the file.
Let's now run the kissutil by opening a new session:
`kissutil -h localhost -p 8001 -f /tmp/tx -v`
As soon as we copy the tx.txt into.test with following command, following outcome is expected:
To read incoming APRS packets from direwolf TCP port:
`kissutil -h localhost -p 8001 -v -o /tmp/rx`
Production command:
`kissutil -h localhost -p 8001 -f /tmp/tx -o /tmp/rx &`
or split in two:
```
kissutil -h localhost -p 8001 -f /tmp/tx -v
kissutil -h localhost -p 8001 -o /tmp/rx -v
```
Open a third new session:
```
cd ~
cd direwolf
cp tx.txt ./test
```
This is the outcome on the Kissutil console:
> Processing tx.txt for transmit...
> IZ1VCX-10>APDW14,WIDE2-2:!4238.80NS07105.63W#PHG5630
> Sending to KISS TNC:
> 000: c0 00 82 a0 88 ae 62 68 e0 92 b4 62 ac 86 b0 f4 ......bh...b....
> 010: ae 92 88 8a 64 40 65 03 f0 21 34 32 33 38 2e 38 ....d@e..!4238.8
> 020: 30 4e 53 30 37 31 30 35 2e 36 33 57 23 50 48 47 0NS07105.63W#PHG
> 030: 35 36 33 30 c0 5630.
> HB9HCM-11>APOTW1,WIDE1-1:!4558.66N/00853.61E_103/000g004t081P000h29b11084OTW1
> Sending to KISS TNC:
> 000: c0 00 82 a0 9e a8 ae 62 e0 90 84 72 90 86 9a f6 .......b...r....
> 010: ae 92 88 8a 62 40 63 03 f0 21 34 35 35 38 2e 36 ....b@c..!4558.6
> 020: 36 4e 2f 30 30 38 35 33 2e 36 31 45 5f 31 30 33 6N/00853.61E_103
> 030: 2f 30 30 30 67 30 30 34 74 30 38 31 50 30 30 30 /000g004t081P000
> 040: 68 32 39 62 31 31 30 38 34 4f 54 57 31 c0 h29b11084OTW1.
>
>
and on Direwolf console following wil appear:
> Ready to accept KISS TCP client application 1 on port 8001 ...
> [0L] IZ1VCX-10>APDW14,WIDE2-2:!4238.80NS07105.63W#PHG5630
> [0L] HB9HCM-11>APOTW1,WIDE1-1:!4558.66N/00853.61E_103/000g004t081P000h29b11084OTW1
>
The baofeng radio will will have for a short istance a led light turning red to show the PTT key is pressed by grounding GPIO 25
# Testing
## PTT Testing
First make sure GPIO25 can activate the PTT thru the 4N25 opto coupler
```
nano test-gpio25.py
```
```
import RPi.GPIO as GPIO # import RPi.GPIO module
from time import sleep # lets us have a delay
GPIO.setmode(GPIO.BCM) # choose BCM or BOARD
GPIO.setup(25, GPIO.OUT) # set GPIO24 as an output
try:
while True:
GPIO.output(25, 1) # set GPIO24 to 1/GPIO.HIGH/True
print("GPIO25 set to high")
sleep(3) # wait half a second
GPIO.output(25, 0) # set GPIO24 to 0/GPIO.LOW/False
print("GPIO25 set to low")
sleep(3) # wait half a second
except KeyboardInterrupt: # trap a CTRL+C keyboard interrupt
GPIO.cleanup() # resets all GPIO ports used by this program
```
> ctrl+x and yes
`python test-gpio25.py`
## Speaker Testing
You can test the system with a nexternal speaker with following command:
`speaker-test -c2 -twav -l0 -D plughw:1,0`
with -l0 inifinite loop and -l7 7 loops
Can also send a sinwave in order to set the trimmers:
`speaker-test -c2 -f 440 -t sine -D plughw:1,0`
## Cabling


PTT connected to Red jumper out of Optocupler
Mic- Data connected to Black jumper out of Octocoupler
GND Data connected to White Jumper out of Transformer
Mic+ connected to Yellow cable out of Transformer


## Wiring for Easydigi card

# Wiring for Yaesu radios

# GPS Setup
Check that GPS is alive
`gpsmon /dev/ttyUSB0`
or
`cgps -s`
or use python
```
cd /home/pi/GPS
python serial_read.py
```
Then let's configure direwolf to transmit a beacon with GPS coordinate from serial GPS
```
cd direwolf
nano direwolf.conf
```
Comment out any line with PBEACON string enabled
Add the following lines:
> GPSD
> TBEACON delay=0:25 every=0:30 via=WIDE1-1,WIDE2-1 symbol=/O
Restart direwolf:
`sudo systemctl restart direwolf`
Main documentation to follow:
https://github.com/wb2osz/direwolf/blob/master/doc/Raspberry-Pi-APRS-Tracker.pdf
# Enable non free repository
> sudo nano /etcapt/sources.list
uncomment or add this line:
> deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
then:
> sudo apt-get update
# Set NTP time on Raspberry
```
sudo apt install ntp
sudo systemctl enable ntp
```
Check that NTP time correspond to local time
```
ntptime
date
```
# Setup Chrony
In order to get system time taken from GPS we need to use chrnoyd. Do not install NPT.
Run
> sudo apt -y install gpsd gpsd-clients python-gps chrony python-gi-cairo
Then configure:
> sudo nano /etc/default/gpsd
make sure looks like the below:
> START_DAEMON=”true”
>
> USBAUTO=”true”
>
> DEVICES="/dev/ttyUSB0″
>
> GPSD_OPTIONS=”-n”
Can you a G option to make the readngs available to the network.
Hit ctl-x followed by y to close and save the file.
Reboot the Pi and check that the following services are active:
> systemctl is-active gpsd
>
> systemctl is-active chronyd
You can use any of the following three commands to check that the GPS is visible and delivering NMEA words. NB: Most GPS dongles will show a flashing LED when they have a fix:
> cgps – s or gpsmon -n or xgps
Next, we need to make a change to the chrony configuration file:
> sudo nano /etc/chrony/chrony.conf
Add the following line to the end of the file:
> refclock SHM 0 offset 0.5 delay 0.2 refid NMEA
and comment out the following line:
> #pool 2.debian.pool.ntp.org iburst
Hit ctl-x followed by y to close and save the file.
You can now check chrony’s sources with the command:
> chronyc sources -v
If you are connected to the network, you will see a list of available time servers plus the GPS source which will be shown as NMEA. If you’re not network connected, you will just see the NMEA source listed. The two punctuation characters immediately before NMEA, indicate its status and you need to see #* where # means thge GPS is recognised as a local clock and * means that it’s being used to synchronise the Pi system time.
You can now use chronyc to provide a more detailed view using the command:
> sudo chronyc tracking
This will confirm that NMEA is being used as the reference and will list the time difference between the reference and the system clock. To avoid clock jitter that can cause lots of software problems, chrony slowly changes the system clock until it matches the reference. However, this makes for a very slow synchronisation.
If you want to quickly synchronise the time, use the following command to make a step change to the system clock:
> sudo chronyc makestep
# Telemetry
Destination address: APZSKU (experimental)
Source address: ES3BEC-11(balloon)
PATH: WIDE-2-1
Human format
ES3BEC-11>APZSKU,WIDE2-1:/091250z/8&_HPQWRO7P[/A=34000 Project by Skudo.tech
Beacon Testing
IZ1VCX-11>APZSKU,WIDE2-1:/250748Z/8-b9PJA9O7P[/A=34000 Testing a beacon
# Dealing with Raspberry configuration issues
if you get the following error then:
Activate I2C from with:
`sudo raspi-config`
> System has not been booted with systemd as init system (PID 1). Can't operate
> sudo nano /boot/cmdline.txt
add:
> init=/bin/systemd
then:
> sudo reboot
OR rather use:
sudo service name_service start|stop|restart
# MACOS Configurations
To solve the issue of shell timeout do the followingL
```
cd .ssh
sudo nano config
```
add ServerAliveInterval 120 to the problematic host (if want to apply to all the host pasted under Host*)
> Host cipo
> HostName cipo
> Port 2223
> User pi
> ServerAliveInterval 120
# Python Virtualenv
To create:
```
sudo apt-get install python3-venv -y
python3 -m venv ~/venv_version
```
To activate:
`source /home/pi/venv_3.7.3/bin/activate`
You can add also to .bashrc and it will start automatically
to deactivate:
`deactivate`
# Reading from BME280
```
cd /home/pi/PyProjects/esa-poc
python temp_pres.py
```
# TEST CASES
1. Make sure time is correctly fetched from GPS via chronyd
2. Ensure message lenght in messages is checked
# Github SW repository
https://github.com/simseve/skudo
#Dockerize the app
## Create a docker
https://www.wintellect.com/containerize-python-app-5-minutes/#:~:text=To%20build%20the%20image%2C%20run,the%20image%20as%20a%20container.
## Install docker
https://phoenixnap.com/kb/docker-on-raspberry-pi
# Sensors
## BME 280

BM280 is providing pressure, temperature and humidity readings. It will sits inside the box.
It uses I2C interface.
## DS18B20
Following sensor is using 1 Wire protocol

The data cable (yellow wire) will connect to GPIO4 by default and the VCC wire (red) needs to be wired to the 5V from the RPi (the sensor works with a Voltage betwen 3V and 5V5)

http://www.bambusekd.cz/dev/raspberry-1-wire-temperature-ds18b20
Now we are ready to read the temperature data. All connected 1-Wire devices will create a folder named after its unique identifier in /sys/bus/w1/devices/. To see the folders, use your command line:
`ls /sys/bus/w1/devices/`
In my case it gives me this output:
28-000009f8259a 28-000009f96000 w1_bus_master1
Lets ignore the w1_bus_master1, the rest of the folders are our sensors. The first two digits tell us, what kind of a sensor we are dealing with, 28 stands for DS18B20 temperature sensor, so everything is working as expected.
```
cd /sys/bus/w1/devices
cd 28-012022465863
cat w1_slave
```
`nano read1wire.py`
Then paste:
> import os
> import glob
> import time
>
> \# These tow lines mount the device:
> os.system('modprobe w1-gpio')
> os.system('modprobe w1-therm')
>
> base_dir = '/sys/bus/w1/devices/'
> \# Get all the filenames begin with 28 in the path base_dir.
> device_folder = glob.glob(base_dir + '28*')[0]
> device_file = device_folder + '/w1_slave'
> def read_rom():
> name_file=device_folder+'/name'
> f = open(name_file,'r')
> return f.readline()
>
> def read_temp_raw():
> f = open(device_file, 'r')
> lines = f.readlines()
> f.close()
> return lines
>
> def read_temp():
> lines = read_temp_raw()
> # Analyze if the last 3 characters are 'YES'.
> while lines[0].strip()[-3:] != 'YES':
> time.sleep(0.2)
> lines = read_temp_raw()
> # Find the index of 't=' in a string.
> equals_pos = lines[1].find('t=')
> if equals_pos != -1:
> # Read the temperature .
> temp_string = lines[1][equals_pos+2:]
> temp_c = float(temp_string) / 1000.0
> temp_f = temp_c * 9.0 / 5.0 + 32.0
> return temp_c, temp_f
>
> print(' rom: '+ read_rom())
> while True:
> print(' C=%3.3f F=%3.3f'% read_temp())
> time.sleep(1)
and run:
`python read_1wire.py`
## Blinking LED when decoded packets
If you would like a data carrier detect (DCD) LED to light up when it looks like a signal is present, add a line like this:
DCD GPIO -24
This means drive GPIO 24 to ground for signal present.
Connect an LED like this:

## Useful UNIX commands
In order to get current public IP address:
`curl ifconfig.me`
### Tunnelling GPSD to be available to other machines
ssh -L 0.0.0.0:2947:127.0.0.1:2947 pi@balloon -p 2226
the -L directive makes the GPSd port available on my machine (notebook)
# Mission Control SW
The mission control SW uses
1. MQTT broker
2. Grafana to visualize the dashboard
3. Influxdb, a time series DB, to store the messages
## MQTT installation
```
sudo apt install mosquitto mosquitto-clients
sudo systemctl enable mosquitto
sudo systemctl status mosquitto
```
To subscribe to MQTT topic for the demo:
`mosquitto_sub -h cipo -v -t "skudo/#"`
## InfluxDB, telegraf and Grafana installation
First we need to update the repository:
```
curl -sL https://packages.grafana.com/gpg.key | sudo apt-key add -
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
```
`sudo apt-get update`
Then we install:
```
sudo apt-get install -y grafana influxdb telegraf
```
Enable the services at boot:
```
sudo systemctl enable influxdb grafana-server telegraf
sudo systemctl start influxdb grafana-server telegraf
```
## InfluxDB configuration
`influx`
`CREATE DATABASE mqtt_aprs`
`USE mqtt_aprs`
Create user
`CREATE USER aprs with password 'aprs' with all privileges`
`grant all privileges on mqtt_aprs to aprs`
`create retention policy "4Weeks" on "mqtt_aprs" duration 4w replication 1 default`
Let's quit, we done here:
`exit`
## Telegraf configuration
```
sudo nano /etc/telegraf/telegraf.conf
```
Paste the following:
> [global_tags]
> [agent]
> interval = "10s"
> round_interval = true
> metric_batch_size = 1000
> metric_buffer_limit = 10000
> collection_jitter = "0s"
> flush_interval = "10s"
> flush_jitter = "0s"
> precision = ""
> debug = true
> quiet = false
> logtarget = "file"
> logfile = "/home/pi/logs/telegraf"
> hostname = ""
> omit_hostname = false
> [[outputs.influxdb]]
> urls = ["http://127.0.0.1:8086"]
> database = "skudo"
> skip_database_creation = true
> username = "aprs"
> password = "aprs"
> [[inputs.mqtt_consumer]]
> servers = ["tcp://localhost:1883"]
> topics = ["skudo_ch/#"]
> qos = 0
> connection_timeout = "30s"
> persistent_session = false
> client_id = ""
> data_format = "value"
> data_type = "string"
## Grafana configuration
To login into grafana:
on Chrome URL bar type:
<ground-ip-address or public-ip>:3000
User: admin
Password: skud0
User: aprs
Password: aprs
Install clock panel:
`sudo grafana-cli plugins install grafana-clock-panel`
# Running Mission control SW
It is important to have either the iGate active or Ground with direwolf configured to push data into the APRS-IS network
## Google proto buffer installation
`sudo apt install protobuf-compiler`
## Qt
`sudo apt-get install qt5-default`
# How to Run and configure the demo (simulated GPS)
## Ground
Download the SW package from github from /home/pi:
`git clone https://github.com/Skudo-HSM/esa-poc`
If the SW was already downloaded:
```
cd ~/esa-poc
git pull
```
Compile GUI (it can be run only using VNC):
VNC groud: publicIP:5900
https://www.realvnc.com/en/connect/download/viewer/
```
cd ~/esa-poc/sdls_service/gui
qmake
make
./poc-ui
```
Qmake must be installed as per the previous chapter.
Run direwolf:
`direwolf`
Run ground.py
```
cd ~/esa-poc/esa-poc/
python ground.py
```
To summarize these all the processes to be run:
| Process | Command | Note |
| -------- | --------------------------------- | ------------ |
| SDLS GUI | ~/esa-poc/sdls_service/gui/poc-ui | SDLS GUI |
| Direwolf | direwolf | Direwolf TNC from anywhere |
| Ground SW | python ~/esa-poc/esa-poc/ground.py | Ground Control SW |
### Potential issues:
When VNC is run sometime the USB sound card address change.
run
`aplay -l`
Take not of card number:

In this example is 1.
Check direwolf configuration:
nano ~/direwolf.conf
Look for the line that starts with ADEVICE:
nano ~/direwolf.conf

make sure that the first digit that comes after "plughw:" reflects the card number. If USB sound card is number 2 direwolf conf should be modifcied as:
> ADEVICE plughw:2,0
## Balloon
Download the SW package from github from /home/pi:
`git clone https://github.com/Skudo-HSM/esa-poc`
If the SW was already downloaded:
```
cd ~/esa-poc
git pull
```
Compile SDLS service:
```
cd /home/pi/esa-poc/sdls_service/gui/sdls/tc_sdls/x509/curves
make
cd ~/esa-poc/sdls_service/service
make
./sdls_service
```
If already compiled directly run the service:
```
cd ~/esa-poc/sdls_service/service
./sdls_service
```
Setup Simulated GPS
Change a settings in the code:
`nano ~/esa-poc/esa-poc/settings.py`
Change GPSD_PORT number from 2947 to 12947
For real GPS must be set = 2947
the run the process:
```
cd ~/esa-poc/tests
python gpsd_sim.py
```
for latest simulator:
```
python gpsd_sim_v2.py
```
The latest simulator generates a kml file into the directory with a prediction of the course and landing point. Can be imported directly into Google Earth.
Run direwolf:
`direwolf`
Run balloon.py
```
cd ~/esa-poc/esa-poc/
python balloon.py
```
## To summarize these are the 4 commands that must be run sequentially:
| Process | Command | Note |
| ------------ | ------------------------------------------- | -------------------------- |
| SDLS service | ~/esa-poc/sdls_service/service/sdls_service | SDLS service |
| Direwolf | direwolf | Direwolf TNC from anywhere |
| GPS Simulator |python ~/esa-poc/tests/gpsd_sim_v2.py |Basic simulator: gpsd_sim.py Advanced simulator: gpsd_sim_v2.py |
| Ground SW | python ~/esa-poc/esa-poc/balloon.py | Balloon control SW |
## To monitor the demo:
from Chrome:
ground_ip_address:3000
username: aprs
password: aprs
From aprs.fi
search for "ES3BEC-11"
To verify from MQTT topic:
`mosquitto_sub -h cipo -v -t "skudo/#"`