commit
22899c3cc1
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,311 @@
|
||||
#!/bin/bash
|
||||
|
||||
# echo $1
|
||||
|
||||
if [ "$2" = "-n" ]; then
|
||||
norestart=1
|
||||
else
|
||||
norestart=0
|
||||
fi
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
value=`cat /home/pi/CubeSatSim/.mode`
|
||||
echo "$value" > /dev/null
|
||||
set -- $value
|
||||
|
||||
if [ "$1" = "ARG1=a" ]; then
|
||||
echo "APRS mode is set"
|
||||
elif [ "$1" = "ARG1=f" ]; then
|
||||
echo "FSK mode is set"
|
||||
elif [ "$1" = "ARG1=b" ]; then
|
||||
echo "BPSK mode is set"
|
||||
elif [ "$1" = "ARG1=s" ]; then
|
||||
echo "SSTV mode is set"
|
||||
else
|
||||
echo
|
||||
fi
|
||||
echo
|
||||
echo -e "Current sim.cfg configuration file:"
|
||||
echo
|
||||
|
||||
value=`cat /home/pi/CubeSatSim/sim.cfg`
|
||||
echo "$value" > /dev/null
|
||||
set -- $value
|
||||
|
||||
echo $1 $2 $3 $4 $5
|
||||
echo
|
||||
|
||||
if [ "$sim" = "y" ] ; then
|
||||
sim="yes"
|
||||
echo "Simulated Telemetry is ON"
|
||||
else
|
||||
sim="no"
|
||||
echo "Simulated Telemetry is OFF"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "To change, include an OPTION"
|
||||
echo
|
||||
set -- "-h"
|
||||
fi
|
||||
|
||||
if [ "$1" = "-i" ]; then
|
||||
echo "Restarting CubeSatSim"
|
||||
sudo systemctl restart cubesatsim
|
||||
exit
|
||||
elif [ "$1" = "-a" ]; then
|
||||
echo "changing CubeSatSim to AFSK mode"
|
||||
sudo echo "ARG1=a" > /home/pi/CubeSatSim/.mode
|
||||
sudo systemctl restart cubesatsim
|
||||
exit
|
||||
elif [ "$1" = "-f" ]; then
|
||||
echo "changing CubeSatSim to FSK mode"
|
||||
sudo echo "ARG1=f" > /home/pi/CubeSatSim/.mode
|
||||
sudo systemctl restart cubesatsim
|
||||
exit
|
||||
elif [ "$1" = "-b" ]; then
|
||||
echo "changing CubeSatSim to BPSK mode"
|
||||
sudo echo "ARG1=b" > /home/pi/CubeSatSim/.mode
|
||||
sudo systemctl restart cubesatsim
|
||||
exit
|
||||
elif [ "$1" = "-s" ]; then
|
||||
echo "changing CubeSatSim to SSTV mode"
|
||||
sudo echo "ARG1=s" > /home/pi/CubeSatSim/.mode
|
||||
sudo systemctl restart cubesatsim
|
||||
exit
|
||||
elif [ "$1" = "-h" ]; then
|
||||
echo "config OPTION"
|
||||
echo
|
||||
echo "Changes CubeSatSim mode, resets, or modifies configuration file"
|
||||
echo
|
||||
echo " -h This help info"
|
||||
echo " -a Change to AFSK/APRS mode"
|
||||
echo " -f Change to FSK/DUV mode"
|
||||
echo " -b Change to BPSK mode"
|
||||
echo " -s Change to SSTV mode"
|
||||
echo " -i Restarts CubeSatsim software"
|
||||
echo " -c Change the CALLSIGN in the configuration file sim.cfg"
|
||||
echo " -m Change the Simulated Telemetry setting in sim.cfg"
|
||||
echo " -r Change the Resets Count in the configuration file sim.cfg"
|
||||
echo " -l Change the Latitude and Longitude in the configuration file sim.cfg"
|
||||
echo " Only used for APRS telemetry"
|
||||
echo
|
||||
exit
|
||||
|
||||
elif [ "$1" = "-m" ]; then
|
||||
|
||||
echo
|
||||
echo "Editing the Simulated Telemetry setting in"
|
||||
echo "the configuration file for CubeSatSim"
|
||||
echo
|
||||
|
||||
value=`cat /home/pi/CubeSatSim/sim.cfg`
|
||||
echo "$value" > /dev/null
|
||||
set -- $value
|
||||
|
||||
if [ "$5" = "yes" ]; then
|
||||
echo "Simualted Telemetry is ON"
|
||||
else
|
||||
echo "Simualted Telemetry is OFF"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
# echo $1 $2 $3 $4
|
||||
|
||||
echo "Do you want Simulated Telemetry ON (y/n) "
|
||||
read sim
|
||||
echo
|
||||
|
||||
if [ "$sim" = "y" ] ; then
|
||||
sim="yes"
|
||||
echo "Simulated Telemetry is ON"
|
||||
else
|
||||
sim="no"
|
||||
echo "Simulated Telemetry is OFF"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
|
||||
echo
|
||||
echo $1 $2 $3 $4 $sim
|
||||
echo $1 $2 $3 $4 $sim > /home/pi/CubeSatSim/sim.cfg
|
||||
echo
|
||||
echo "Restarting CubeSatSim with new configuraation file"
|
||||
echo
|
||||
|
||||
sudo systemctl restart cubesatsim
|
||||
|
||||
elif [ "$1" = "-c" ]; then
|
||||
|
||||
echo
|
||||
echo "Editing the CALLSIGN in the"
|
||||
echo "configuration file for CubeSatSim"
|
||||
echo
|
||||
echo "Return keeps current value."
|
||||
# echo -e "Current sim.cfg configuration file:"
|
||||
# echo
|
||||
|
||||
value=`cat /home/pi/CubeSatSim/sim.cfg`
|
||||
echo "$value" > /dev/null
|
||||
set -- $value
|
||||
|
||||
echo "Current value of CALLSIGN is"
|
||||
echo $1
|
||||
echo
|
||||
|
||||
# echo $1 $2 $3 $4 $5
|
||||
|
||||
echo "Enter callsign in all capitals: "
|
||||
read callsign
|
||||
|
||||
if [ -z $callsign ] ; then
|
||||
|
||||
callsign="$1"
|
||||
echo "Keeping value of" $callsign
|
||||
norestart=1
|
||||
else
|
||||
|
||||
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
|
||||
|
||||
echo $callsign $2 $3 $4 $5
|
||||
echo $callsign $2 $3 $4 $5 > /home/pi/CubeSatSim/sim.cfg
|
||||
fi
|
||||
|
||||
if [ "$norestart" = "1" ]; then
|
||||
echo
|
||||
else
|
||||
echo
|
||||
echo "Restarting CubeSatSim with new configuraation file"
|
||||
echo
|
||||
sudo systemctl restart cubesatsim
|
||||
fi
|
||||
|
||||
elif [ "$1" = "-r" ]; then
|
||||
|
||||
echo
|
||||
echo "Editing the Reset Count in the"
|
||||
echo "configuration file for CubeSatSim"
|
||||
echo
|
||||
echo "Return keeps current value."
|
||||
# echo -e "Current sim.cfg configuration file:"
|
||||
# echo
|
||||
|
||||
value=`cat /home/pi/CubeSatSim/sim.cfg`
|
||||
echo "$value" > /dev/null
|
||||
set -- $value
|
||||
|
||||
echo
|
||||
echo "Current value of Reset Count is"
|
||||
echo $2
|
||||
echo
|
||||
|
||||
# echo $1 $2 $3 $4 $5
|
||||
|
||||
echo -e "Enter Reset Count (integer): "
|
||||
|
||||
read resets
|
||||
|
||||
if [ -z $resets ] ; then
|
||||
resets="$2"
|
||||
echo "Keeping value of" $resets
|
||||
fi
|
||||
|
||||
if ! [[ $resets =~ ^[0-9]+$ ]] ; then
|
||||
echo "Error: not an integer!"
|
||||
resets="$2"
|
||||
echo "Keeping value of" $resets
|
||||
norestart=1
|
||||
else
|
||||
|
||||
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
|
||||
|
||||
echo $1 $resets $3 $4 $5
|
||||
echo $1 $resets $3 $4 $5 > /home/pi/CubeSatSim/sim.cfg
|
||||
fi
|
||||
|
||||
if [ "$norestart" = "1" ]; then
|
||||
echo
|
||||
else
|
||||
echo
|
||||
echo "Restarting CubeSatSim with new configuraation file"
|
||||
echo
|
||||
sudo systemctl restart cubesatsim
|
||||
fi
|
||||
|
||||
elif [ "$1" = "-l" ]; then
|
||||
|
||||
echo
|
||||
echo "Editing latitude and longitude in the"
|
||||
echo "configuration file for CubeSatSim"
|
||||
echo "(Only used for APRS telemetry)"
|
||||
echo
|
||||
echo "Return keeps current value."
|
||||
# echo -e "Current sim.cfg configuration file:"
|
||||
# echo
|
||||
|
||||
value=`cat /home/pi/CubeSatSim/sim.cfg`
|
||||
echo "$value" > /dev/null
|
||||
set -- $value
|
||||
|
||||
echo
|
||||
echo "Current value of latitude is"
|
||||
echo $3
|
||||
echo
|
||||
|
||||
# echo $1 $2 $3 $4 $5
|
||||
|
||||
echo -e "Enter latitude (decimal degrees, positive is north): "
|
||||
|
||||
read lat
|
||||
|
||||
if [ -z $lat ] ; then
|
||||
|
||||
lat="$3"
|
||||
echo "Keeping value of" $lat
|
||||
fi
|
||||
|
||||
if ! [[ $lat =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
|
||||
|
||||
echo "Error: not a number!"
|
||||
lat="$3"
|
||||
echo "Keeping value of" $lat
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Current value of longitude is"
|
||||
echo $4
|
||||
echo
|
||||
|
||||
echo -e "Enter longitude (decimal degrees, positive is east): "
|
||||
|
||||
read long
|
||||
|
||||
if [ -z $long ] ; then
|
||||
|
||||
long="$4"
|
||||
echo "Keeping value of" $long
|
||||
fi
|
||||
|
||||
if ! [[ $long =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
|
||||
|
||||
echo "Error: not a number!"
|
||||
long="$4"
|
||||
echo "Keeping value of" $long
|
||||
fi
|
||||
|
||||
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
|
||||
echo $1 $2 $lat $long $5
|
||||
echo $1 $2 $lat $long $5 > /home/pi/CubeSatSim/sim.cfg
|
||||
|
||||
if [ "$norestart" = "1" ]; then
|
||||
echo
|
||||
else
|
||||
echo
|
||||
echo "Restarting CubeSatSim with new configuraation file"
|
||||
echo
|
||||
sudo systemctl restart cubesatsim
|
||||
fi
|
||||
fi
|
||||
|
||||
# sudo systemctl restart cubesatsim
|
||||
@ -0,0 +1,168 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo -e "\ninstallation script for CubeSatSim\n"
|
||||
|
||||
sudo apt-get update && sudo apt-get dist-upgrade -y
|
||||
|
||||
sudo apt-get install -y wiringpi git libasound2-dev i2c-tools cpulimit python-picamera python3-picamera build-essential libgd-dev libmagic-dev
|
||||
|
||||
cd /tmp
|
||||
|
||||
wget https://project-downloads.drogon.net/wiringpi-latest.deb
|
||||
|
||||
sudo dpkg -i wiringpi-latest.deb
|
||||
|
||||
|
||||
cd
|
||||
|
||||
sudo apt install -y python3-pip python-smbus
|
||||
|
||||
sudo pip3 install --upgrade setuptools
|
||||
|
||||
sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219
|
||||
|
||||
|
||||
|
||||
cd ~/CubeSatSim
|
||||
|
||||
git pull
|
||||
|
||||
make debug
|
||||
|
||||
FILE=/home/pi/CubeSatSim/.mode
|
||||
if [ -f "$FILE" ]; then
|
||||
echo "$FILE exists."
|
||||
else
|
||||
echo "creating $FILE"
|
||||
echo "ARG1=f" > .mode
|
||||
fi
|
||||
|
||||
|
||||
FILE=/home/pi/CubeSatSim/sim.cfg
|
||||
if [ -f "$FILE" ]; then
|
||||
echo "$FILE exists."
|
||||
else
|
||||
echo "creating $FILE"
|
||||
echo "AMSAT 1 0.0 0.0" > /home/pi/CubeSatSim/sim.cfg
|
||||
fi
|
||||
|
||||
|
||||
cd
|
||||
|
||||
git clone https://github.com/alanbjohnston/direwolf.git
|
||||
|
||||
cd direwolf
|
||||
|
||||
make -j
|
||||
|
||||
sudo make install
|
||||
|
||||
make install-rpi
|
||||
|
||||
|
||||
cd
|
||||
|
||||
git clone https://github.com/alanbjohnston/pi-power-button.git
|
||||
|
||||
cd pi-power-button
|
||||
|
||||
./script/install
|
||||
|
||||
|
||||
cd
|
||||
|
||||
git clone https://github.com/alanbjohnston/PiSSTVpp.git
|
||||
|
||||
cd PiSSTVpp
|
||||
|
||||
make pisstvpp
|
||||
|
||||
|
||||
cd
|
||||
|
||||
git clone https://github.com/alanbjohnston/rpitx.git
|
||||
|
||||
cd rpitx
|
||||
|
||||
./install.sh
|
||||
|
||||
|
||||
cd
|
||||
|
||||
sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
|
||||
|
||||
sudo systemctl enable cubesatsim
|
||||
|
||||
sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service
|
||||
|
||||
sudo systemctl enable rpitx
|
||||
|
||||
sudo cp /boot/config.txt /boot/config.txt.0
|
||||
|
||||
sudo cp /boot/cmdline.txt /boot/cmdline.txt.0
|
||||
|
||||
|
||||
sudo raspi-config nonint do_i2c 0
|
||||
|
||||
sudo raspi-config nonint do_camera 0
|
||||
|
||||
|
||||
#if [ "$1" = "u" ]; then
|
||||
#fi
|
||||
|
||||
sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
|
||||
|
||||
sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt
|
||||
|
||||
if [[ $(grep 'dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24' /boot/config.txt) ]]; then
|
||||
echo "dtoverlay=i2c-gpio already in /boot/config.txt"
|
||||
else
|
||||
echo "adding dtoverlay=i2c-gpio to /boot/config.txt"
|
||||
sudo sh -c 'echo "\ndtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24" >> /boot/config.txt'
|
||||
fi
|
||||
|
||||
if [[ $(grep 'enable_uart=1' /boot/config.txt) ]]; then
|
||||
echo "enable_uart=1 already in /boot/config.txt"
|
||||
else
|
||||
echo "adding enable_uart=1 to /boot/config.txt"
|
||||
sudo sh -c 'echo "\nenable_uart=1" >> /boot/config.txt'
|
||||
fi
|
||||
|
||||
if [[ $(grep 'dtoverlay=disable-bt' /boot/config.txt) ]]; then
|
||||
echo "dtoverlay=disable-bt already in /boot/config.txt"
|
||||
else
|
||||
echo "adding dtoverlay=disable-bt to /boot/config.txt"
|
||||
sudo sh -c 'echo "\ndtoverlay=disable-bt" >> /boot/config.txt'
|
||||
fi
|
||||
|
||||
if [[ $(grep 'dtoverlay=dwc2' /boot/config.txt) ]]; then
|
||||
echo "dtoverlay=dwc2 aalready in /boot/config.txt"
|
||||
else
|
||||
echo "adding dtoverlay=dwc2 to /boot/config.txt"
|
||||
sudo sh -c 'echo "\ndtoverlay=dwc2" >> /boot/config.txt'
|
||||
fi
|
||||
|
||||
if [[ $(grep 'modules-load=dwc2,g_ether' /boot/cmdline.txt) ]]; then
|
||||
echo "modules-load=dwc2,g_ether already in /boot/cmdline.txt"
|
||||
else
|
||||
echo "adding modules-load=dwc2,g_ether to /boot/cmdline.txt"
|
||||
sudo sed -i 's/ rootwait/ rootwait modules-load=dwc2,g_ether/g' /boot/cmdline.txt
|
||||
fi
|
||||
|
||||
CubeSatSim/config -c -n
|
||||
|
||||
CubeSatSim/config -l -n
|
||||
|
||||
echo "Would you like to reboot to complete the installation (y/n)?"
|
||||
|
||||
read -r ANS
|
||||
|
||||
if [ "$ANS" = "y" ]; then
|
||||
|
||||
sudo reboot now
|
||||
|
||||
else
|
||||
|
||||
echo "The CubeSatSim software will start next time you reboot"
|
||||
|
||||
fi
|
||||
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo -e "\nLog file script for CubeSatSim\n"
|
||||
|
||||
sudo journalctl -u cubesatsim > log.txt
|
||||
cat log.txt
|
||||
|
||||
echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt"
|
||||
|
||||
@ -1,66 +1,354 @@
|
||||
"""Sample code and test for adafruit_in219"""
|
||||
# Reads all voltage and current sensors for two I2C buses
|
||||
|
||||
import time
|
||||
import sys
|
||||
#import board
|
||||
import busio
|
||||
from adafruit_extended_bus import ExtendedI2C as I2C
|
||||
from adafruit_ina219 import INA219
|
||||
from adafruit_ina219 import ADCResolution, BusVoltageRange
|
||||
|
||||
if __name__ == "__main__":
|
||||
# print 'Length: ', len(sys.argv)
|
||||
|
||||
buses = [1, 3] # default I2C buses
|
||||
config = False
|
||||
single = False
|
||||
one = two = three = four = five = six = seven = eight = 0
|
||||
|
||||
if (len(sys.argv)) > 1:
|
||||
# print("There are arguments!")
|
||||
# print("There are arguments!", file=sys.stderr)
|
||||
# if (('a' == sys.argv[1]) or ('afsk' in sys.argv[1])):
|
||||
# print(sys.argv[1])
|
||||
buses[0] = int(sys.argv[1], base=10)
|
||||
if (len(sys.argv)) > 2:
|
||||
buses[1] = int(sys.argv[2], base=10)
|
||||
if (len(sys.argv)) > 3:
|
||||
if sys.argv[3] == "c":
|
||||
config = True
|
||||
from adafruit_ina219 import ADCResolution, BusVoltageRange
|
||||
if sys.argv[3] == "s":
|
||||
single = True
|
||||
|
||||
# print(buses[0])
|
||||
# print(buses[1])
|
||||
|
||||
addresses = [0x40, 0x41, 0x44, 0x45] #INA219 addresses on the bus
|
||||
# print("buses: ", buses, " addr: ", addresses)
|
||||
for x in buses:
|
||||
try:
|
||||
i2c_bus = I2C(x) # Device is /dev/i2c-x
|
||||
for y in addresses:
|
||||
# print(x,y)
|
||||
try:
|
||||
# print("buses: ", buses, " addr: ", addresses, file=sys.stderr)
|
||||
|
||||
# config
|
||||
|
||||
# for x in buses:
|
||||
# try:
|
||||
# i2c_bus = I2C(x) # Device is /dev/i2c-x
|
||||
# for y in addresses:
|
||||
# print(x,y)
|
||||
# try:
|
||||
# Create library object using Extended Bus I2C port
|
||||
# print("bus: ", x, " addr: ", y)
|
||||
if x == 0 and y == 0x45:
|
||||
# if x == 0 and y == 0x45:
|
||||
# print("Reading INA219 in MoPower Board")
|
||||
i2c_bus = I2C(1)
|
||||
ina219 = INA219(i2c_bus, 0x4a)
|
||||
else:
|
||||
ina219 = INA219(i2c_bus, y)
|
||||
|
||||
# i2c_bus = I2C(1)
|
||||
# ina219 = INA219(i2c_bus, 0x4a)
|
||||
# else:
|
||||
# ina219 = INA219(i2c_bus, y)
|
||||
# print("ina219 test")
|
||||
if config:
|
||||
|
||||
# print("Configuring")
|
||||
# optional : change configuration to use 32 samples averaging for both bus voltage and shunt voltage
|
||||
ina219.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
ina219.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
# ina219.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
# ina219.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
# optional : change voltage range to 16V
|
||||
ina219.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
# ina219.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
# except:
|
||||
# print("Python Error 2", file=sys.stderr, flush=True)
|
||||
# except:
|
||||
# print("Python Error 1", file=sys.stderr, flush=True)
|
||||
# No try checking yet
|
||||
|
||||
# if buses[0] == 0 and addresses[0] == 0x45:
|
||||
# print("Reading INA219 in MoPower Board")
|
||||
# ina219_one = INA219(I2C(1), 0x4a)
|
||||
# else:
|
||||
if (buses[0] != -1):
|
||||
try:
|
||||
i2c_one = I2C(buses[0])
|
||||
try:
|
||||
ina219_one = INA219(i2c_one, addresses[0])
|
||||
ina219_one.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_one.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_one.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
one = 1
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
one = 0
|
||||
try:
|
||||
ina219_two = INA219(i2c_one, addresses[1])
|
||||
ina219_two.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_two.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_two.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
two = 1
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
two = 0
|
||||
|
||||
try:
|
||||
ina219_three = INA219(i2c_one, addresses[2])
|
||||
ina219_three.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_three.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_three.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
three = 1
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
three = 0
|
||||
|
||||
try:
|
||||
ina219_four= INA219(i2c_one, addresses[3])
|
||||
ina219_four.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_four.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_four.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
four = 1
|
||||
except:
|
||||
four = 0
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
except:
|
||||
print("Python Error 5", file=sys.stderr, flush=True)
|
||||
|
||||
if (buses[1] != -1):
|
||||
try:
|
||||
i2c_two = I2C(buses[1])
|
||||
# print(i2c_two)
|
||||
try:
|
||||
ina219_five = INA219(i2c_two, addresses[0])
|
||||
ina219_five.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_five.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_five.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
five = 1
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
five = 0
|
||||
try:
|
||||
ina219_six = INA219(i2c_two, addresses[1])
|
||||
ina219_six.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_six.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_six.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
six = 1
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
six = 0
|
||||
try:
|
||||
ina219_seven = INA219(i2c_two, addresses[2])
|
||||
ina219_seven.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_seven.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_seven.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
seven = 1
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
seven = 0
|
||||
try:
|
||||
ina219_eight = INA219(i2c_two, addresses[3])
|
||||
ina219_eight.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_eight.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_eight.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
eight = 1
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
eight = 0
|
||||
except:
|
||||
print("Python Error 5", file=sys.stderr, flush=True)
|
||||
|
||||
while True:
|
||||
error = 0
|
||||
try:
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_one.bus_voltage), "{:6.3f} ".format(ina219_one.current) , end = '')
|
||||
except:
|
||||
|
||||
try:
|
||||
ina219_one = INA219(i2c_one, addresses[0])
|
||||
ina219_one.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_one.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_one.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_one.bus_voltage), "{:6.3f} ".format(ina219_one.current) , end = '')
|
||||
error = 1
|
||||
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '')
|
||||
|
||||
|
||||
try:
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_two.bus_voltage), "{:6.3f} ".format(ina219_two.current) , end = '')
|
||||
except:
|
||||
|
||||
try:
|
||||
ina219_two = INA219(i2c_one, addresses[1])
|
||||
ina219_two.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_two.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_two.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_two.bus_voltage), "{:6.3f} ".format(ina219_two.current) , end = '')
|
||||
error = 1
|
||||
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '')
|
||||
|
||||
|
||||
try:
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_three.bus_voltage), "{:6.3f} ".format(ina219_three.current) , end = '')
|
||||
except:
|
||||
|
||||
try:
|
||||
ina219_three = INA219(i2c_one, addresses[2])
|
||||
ina219_three.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_three.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_three.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_three.bus_voltage), "{:6.3f} ".format(ina219_three.current) , end = '')
|
||||
error = 1
|
||||
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '')
|
||||
|
||||
try:
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_four.bus_voltage), "{:6.3f} ".format(ina219_four.current) , end = '')
|
||||
except:
|
||||
|
||||
try:
|
||||
ina219_four= INA219(i2c_one, addresses[3])
|
||||
ina219_four.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_four.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_four.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_four.bus_voltage), "{:6.3f} ".format(ina219_four.current) , end = '')
|
||||
error = 1
|
||||
|
||||
bus_voltage = ina219.bus_voltage # voltage on V- (load side)
|
||||
# shunt_voltage = ina219.shunt_voltage # voltage between V+ and V- across the shunt
|
||||
current = ina219.current # current in mA
|
||||
if x == 0 and y == 0x45:
|
||||
current = current * 10
|
||||
# INA219 measure bus voltage on the load side. So PSU voltage = bus_voltage + shunt_voltage
|
||||
# print("{:6.3f}".format(bus_voltage + shunt_voltage))
|
||||
print("{:6.3f} ".format(bus_voltage), "{:6.3f} ".format(current) , end = '')
|
||||
except:
|
||||
print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '')
|
||||
|
||||
try:
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_five.bus_voltage), "{:6.3f} ".format(ina219_five.current) , end = '')
|
||||
except:
|
||||
|
||||
try:
|
||||
ina219_five = INA219(i2c_two, addresses[0])
|
||||
ina219_five.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_five.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_five.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_five.bus_voltage), "{:6.3f} ".format(ina219_five.current) , end = '')
|
||||
error = 1
|
||||
|
||||
except:
|
||||
print("{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '')
|
||||
# pass
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '')
|
||||
|
||||
try:
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_six.bus_voltage), "{:6.3f} ".format(ina219_six.current) , end = '')
|
||||
except:
|
||||
|
||||
try:
|
||||
ina219_six = INA219(i2c_two, addresses[1])
|
||||
ina219_six.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_six.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_six.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_six.bus_voltage), "{:6.3f} ".format(ina219_six.current) , end = '')
|
||||
error = 1
|
||||
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '')
|
||||
|
||||
try:
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_seven.bus_voltage), "{:6.3f} ".format(ina219_seven.current) , end = '')
|
||||
except:
|
||||
|
||||
try:
|
||||
ina219_seven = INA219(i2c_two, addresses[2])
|
||||
ina219_seven.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_seven.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_seven.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_seven.bus_voltage), "{:6.3f} ".format(ina219_seven.current) , end = '')
|
||||
error = 1
|
||||
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '')
|
||||
|
||||
try:
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_eight.bus_voltage), "{:6.3f} ".format(ina219_eight.current), end = '')
|
||||
except:
|
||||
|
||||
try:
|
||||
ina219_eight = INA219(i2c_two, addresses[3])
|
||||
ina219_eight.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_eight.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S # 1S
|
||||
time.sleep(0.001)
|
||||
ina219_eight.bus_voltage_range = BusVoltageRange.RANGE_16V
|
||||
time.sleep(0.01)
|
||||
print("{:6.3f} ".format(ina219_eight.bus_voltage), "{:6.3f} ".format(ina219_eight.current), end = '')
|
||||
error = 1
|
||||
|
||||
except:
|
||||
# print("Python Error 3", file=sys.stderr, flush=True)
|
||||
print("{:6.3f} ".format(0), "{:6.3f} ".format(0), end = '')
|
||||
|
||||
if (error == 0):
|
||||
print(" ")
|
||||
else:
|
||||
print("Python Error Recovered!")
|
||||
|
||||
if not single:
|
||||
inp = input()
|
||||
# print(inp)
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
|
||||
|
|
|
|
|
|
|
@ -0,0 +1,72 @@
|
||||
#Fox 1 Telemetry Decoder Properties
|
||||
#Thu Apr 11 13:23:23 EST 2020
|
||||
user_mode=4
|
||||
foxId=99
|
||||
IHU_SN=7
|
||||
catalogNumber=0
|
||||
model=0
|
||||
mpptResistanceError=6.58
|
||||
mpptSensorOffThreshold=1600
|
||||
name=CubeSatSim
|
||||
displayName=CubeSatSim-BPSK
|
||||
BATTERY_CURRENT_ZERO=-1.834
|
||||
hasImprovedCommandReceiver=true
|
||||
EXP1=0
|
||||
EXP2=0
|
||||
EXP3=0
|
||||
EXP4=0
|
||||
description=CubeSatSim, the AMSAT CubeSat Simulator, is a functional satellite model that generates real telemetry from solar panels, batteries, and temperature sensors. Use this for BPSK telemetry. For more information see http://cubesatsim.org
|
||||
numberOfFrameLayouts=5
|
||||
frameLayout0.filename=FOX1E_Type0_ALL_WOD.frame
|
||||
frameLayout0.name=All WOD
|
||||
frameLayout1.filename=CubeSatSim_PSK_Type1_HEALTH.frame
|
||||
frameLayout1.name=Health
|
||||
frameLayout2.filename=CubeSatSim_PSK_Type2_MINMAX.frame
|
||||
frameLayout2.name=MinMax
|
||||
frameLayout3.filename=FOX1E_Type3_REALTIME_BEACON.frame
|
||||
frameLayout3.name=Realtime Beacon
|
||||
frameLayout4.filename=FOX1E_Type4_WOD_BEACON.frame
|
||||
frameLayout4.name=WOD Beacon
|
||||
numberOfLayouts=9
|
||||
layout0.filename=FOX1A_debug.csv
|
||||
layout0.name=DEBUG
|
||||
layout1.filename=CubeSatSim_PSK_maxtelemetry.csv
|
||||
layout1.name=maxtelemetry
|
||||
layout2.filename=CubeSatSim_PSK_rttelemetry.csv
|
||||
layout2.name=rttelemetry
|
||||
layout3.filename=CubeSatSim_PSK_mintelemetry.csv
|
||||
layout3.name=mintelemetry
|
||||
layout4.filename=FOX1E_radtelemetry.csv
|
||||
layout4.name=radtelemetry
|
||||
layout5.filename=FOX1E_radtelemetry2.csv
|
||||
layout5.name=radtelemetry2
|
||||
layout5.parentLayout=radtelemetry
|
||||
layout6.filename=CubeSatSim_PSK_wodtelemetry.csv
|
||||
layout6.name=wodtelemetry
|
||||
layout7.filename=FOX1E_wodradtelemetry.csv
|
||||
layout7.name=wodradtelemetry
|
||||
layout8.filename=FOX1E_wodradtelemetry2.csv
|
||||
layout8.name=wodradtelemetry2
|
||||
layout8.parentLayout=wodradtelemetry
|
||||
numberOfLookupTables=3
|
||||
lookupTable0.filename=FOX1A_rssiFM.tab
|
||||
lookupTable0=RSSI
|
||||
lookupTable1.filename=FOX1E_ihuVBattSNx.tab
|
||||
lookupTable1=IHU_VBATT
|
||||
lookupTable2.filename=FOX1A_ihutempSN7.tab
|
||||
lookupTable2=IHU_TEMP
|
||||
maxFreqBoundkHz=434950
|
||||
measurementsFileName=measurements.csv
|
||||
memsRestValueX=2129
|
||||
memsRestValueY=2131
|
||||
memsRestValueZ=2103
|
||||
minFreqBoundkHz=434850
|
||||
passMeasurementsFileName=passmeasurements.csv
|
||||
telemetryDownlinkFreqkHz=434900
|
||||
track=false
|
||||
useIHUVBatt=false
|
||||
numberOfSources=1
|
||||
source0.name=amsat.cubesat_simulator.ihu.bpsk
|
||||
user_format=0
|
||||
useConversionCoeffs=true
|
||||
conversionCurvesFileName=CubeSatSim_conversion_curves.csv
|
||||
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 22 KiB |
@ -0,0 +1,125 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo -e "\nupdate script for CubeSatSim\n"
|
||||
|
||||
if [ "$1" = "u" ]; then
|
||||
|
||||
sudo apt-get update && sudo apt-get dist-upgrade -y
|
||||
|
||||
sudo apt-get install -y wiringpi git libasound2-dev i2c-tools cpulimit python-picamera python3-picamera build-essential libgd-dev libmagic-dev
|
||||
|
||||
fi
|
||||
|
||||
sudo sed -i 's/update.sh/update /g' /etc/motd
|
||||
|
||||
sudo sed -i 's/installed and/installed\nand/g' /etc/motd
|
||||
|
||||
sudo sed -i 's/more information/more\ninformation/g' /etc/motd
|
||||
|
||||
sudo sed -i 's/update to/update\nto/g' /etc/motd
|
||||
|
||||
cd /home/pi/CubeSatSim
|
||||
|
||||
git pull > .updated
|
||||
|
||||
make debug
|
||||
|
||||
FLAG=0
|
||||
|
||||
if [[ $(diff systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service) ]]; then
|
||||
echo "changed cubesatsim.service"
|
||||
sudo cp /home/pi/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
|
||||
FLAG=1
|
||||
else
|
||||
echo "no changes to cubesatsim.service"
|
||||
fi
|
||||
|
||||
if [[ $(diff systemd/rpitx.service /etc/systemd/system/rpitx.service) ]]; then
|
||||
echo "changed rpitx.service"
|
||||
sudo cp /home/pi/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service
|
||||
FLAG=1
|
||||
else
|
||||
echo "no changes to rpitx.service"
|
||||
fi
|
||||
|
||||
FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "Copying SSTV image 1"
|
||||
cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
|
||||
fi
|
||||
|
||||
FILE=/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "Copying SSTV image 2"
|
||||
cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
|
||||
fi
|
||||
|
||||
grep 'update' /home/pi/CubeSatSim/.updated
|
||||
if [[ $(grep 'update' /home/pi/CubeSatSim/.updated) ]]; then
|
||||
echo "update script updated, running again"
|
||||
/home/pi/CubeSatSim/update
|
||||
fi
|
||||
|
||||
if [ $FLAG -eq 1 ]; then
|
||||
echo "systemctl daemon-reload and restart"
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart cubesatsim
|
||||
else
|
||||
grep 'changed' /home/pi/CubeSatSim/.updated
|
||||
if [[ $(grep 'changed' /home/pi/CubeSatSim/.updated) ]]; then
|
||||
echo "systemctl restart cubesatsim"
|
||||
sudo systemctl restart cubesatsim
|
||||
else
|
||||
echo "nothing to do"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d "/home/pi/PiSSTVpp" ]; then
|
||||
|
||||
sudo apt-get update && sudo apt-get dist-upgrade -y
|
||||
|
||||
sudo apt-get install -y python-picamera python3-picamera build-essential libgd-dev libmagic-dev
|
||||
|
||||
|
||||
cd
|
||||
|
||||
git clone https://github.com/alanbjohnston/PiSSTVpp.git
|
||||
|
||||
cd PiSSTVpp
|
||||
|
||||
make pisstvpp
|
||||
|
||||
cd
|
||||
|
||||
|
||||
sudo raspi-config nonint do_camera 0
|
||||
|
||||
|
||||
FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "Copying SSTV image 1"
|
||||
cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
|
||||
fi
|
||||
|
||||
FILE=/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "Copying SSTV image 2"
|
||||
cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
|
||||
fi
|
||||
|
||||
echo "You need to reboot to complete the installation. Reboot now (y/n)?"
|
||||
|
||||
read -r ANS
|
||||
|
||||
if [ "$ANS" = "y" ]; then
|
||||
|
||||
sudo reboot now
|
||||
|
||||
else
|
||||
|
||||
echo "The CubeSatSim software may not work correctly until you reboot."
|
||||
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
Loading…
Reference in new issue