diff --git a/README.md b/README.md index c21f2325..bf145833 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ To get the software follow these steps: `cd CubeSatSim` -`git checkout sr-frs-rx` +`git checkout beta-v1.3.2` You are now ready to install the software using this script in the CubeSatSim directory: diff --git a/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_bnames.pdf b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_bnames.pdf new file mode 100644 index 00000000..b00d4aee Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_bnames.pdf differ diff --git a/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_bom.csv.txt b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_bom.csv.txt new file mode 100644 index 00000000..0f3ec2a8 --- /dev/null +++ b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_bom.csv.txt @@ -0,0 +1,54 @@ +"Qty";"Value";"Device";"Package";"Parts";"Description";""; +"2";"100";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R8, R30";"Resistor";""; +"1";"100";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R19";"Resistor";""; +"2";"100nF";"CAPPTH";"CAP-PTH-SMALL";"C6, C9";"Capacitor";""; +"1";"10K";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R27";"Resistor";""; +"2";"13nH";"SMD-FERRITE-CHIP-120-OHM-500MA(0603)";"L0603";"L1, L2";"303030001";""; +"2";"16pF";"CERAMIC-10PF-50V-5%-NPO(0603)";"C0603";"C2, C4";"302010097";""; +"1";"180";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R14";"Resistor";""; +"2";"18pF";"CERAMIC-10PF-50V-5%-NPO(0603)";"C0603";"C1, C3";"302010097";""; +"2";"1K";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R1, R3";"Resistor";""; +"1";"1N4148";"DIODE-D-2.5";"D-2.5";"D3";"DIODE";""; +"3";"1N5817";"DIODE-D-2.5";"D-2.5";"D1, D2, D4";"DIODE";""; +"2";"1k";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R7, R29";"Resistor";""; +"1";"220";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R9";"Resistor";""; +"1";"220";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R20";"Resistor";""; +"2";"4.7k";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R23, R24";"Resistor";""; +"1";"47uF";"CAPPTH";"CAP-PTH-SMALL";"C5";"Capacitor";""; +"2";"68";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R13, R15";"Resistor";""; +"2";"ANT-916-CHP-T";"ANT-916-CHP-T";"XDCR_ANT-916-CHP-T";"E1, E2";"868MHz ISM, LoRa, Sensor Networks, SigFox Chip RF Antenna 863MHz ~ 873MHz 0.5dBi Solder Surface Mount Check prices";""; +"1";"BME280";"M04NO_SILK_ALL_ROUND";"1X04_NO_SILK_ALL_ROUND";"J5";"Header 4";""; +"2";"Blue 5mm";"LED3MM";"LED3MM";"LED2, LED4";"LED";""; +"1";"CONN_20X2";"CONN_20X2";"2X20";"J1";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"3";"DNI/100";"SMD-RES-1.2K-1%-1/10W(0603)";"R0603";"R11, R21, R32";"301010206";""; +"2";"DNI/100nF";"CERAMIC-10PF-50V-5%-NPO(0603)";"C0603";"C8, C10";"302010097";""; +"1";"DNI/10k";"R-EU_R0603";"R0603";"R28";"RESISTOR, European symbol";""; +"1";"DNI/180";"SMD-RES-1.2K-1%-1/10W(0603)";"R0603";"R17";"301010206";""; +"1";"DNI/1N5817";"DIODE-D-2.5";"D-2.5";"D9";"DIODE";""; +"2";"DNI/1k";"R-EU_R0603";"R0603";"R2, R4";"RESISTOR, European symbol";""; +"2";"DNI/1k";"SMD-RES-1.2K-1%-1/10W(0603)";"R0603";"R10, R31";"301010206";""; +"1";"DNI/1x4 pin header";"CONN_041X04_NO_SILK";"1X04_NO_SILK";"J12";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"2";"DNI/220";"SMD-RES-1.2K-1%-1/10W(0603)";"R0603";"R12, R22";"301010206";""; +"2";"DNI/4.7k";"RESISTORPTH-1/4W-VERT";"AXIAL-0.1";"R33, R34";"Resistor";""; +"2";"DNI/4.7k";"SMD-RES-1.2K-1%-1/10W(0603)";"R0603";"R25, R26";"301010206";""; +"1";"DNI/4148WS";"DIODESOD-323F";"SOD-323F";"D7";"Diode";""; +"1";"DNI/47uF";"CERAMIC-10PF-50V-5%-NPO(0603)";"C0603";"C7";"302010097";""; +"2";"DNI/5.1k";"R-EU_R0603";"R0603";"R5, R6";"RESISTOR, European symbol";""; +"1";"DNI/5V1 Zener 1W";"ZENER-DIODEZD-2.5";"ZDIO-2.5";"D8";"Z-Diode";""; +"2";"DNI/68";"R-US_R0805";"R0805";"R16, R18";"RESISTOR, American symbol";""; +"2";"DNI/B5817WS";"DIODESOD-323F";"SOD-323F";"D5, D6";"Diode";""; +"1";"DNI/Sparkfun QWIIC Breakout";"CONN_041X04_NO_SILK";"1X04_NO_SILK";"J10";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"1";"DNI/Test Point for MIC_IN";"CONN_01PTH_NO_SILK_YES_STOP";"1X01_NO_SILK";"J11";"Single connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"1";"DNI/USB4105-GF-A or GT-USB-7010B";"USB_C_2-LAYER_PADS";"USB-C-16P-2LAYER-PADS";"J9";"USB Type C 16Pin Connector";""; +"2";"Green 5mm";"LED3MM";"LED3MM";"LED1, LED3";"LED";""; +"3";"JUMPER-SMT_2_NC_TRACE_SILK";"JUMPER-SMT_2_NC_TRACE_SILK";"SMT-JUMPER_2_NC_TRACE_SILK";"JP1, JP3, JP4";"Normally closed trace jumper";""; +"4";"JUMPER-SMT_2_NO_SILK";"JUMPER-SMT_2_NO_SILK";"SMT-JUMPER_2_NO_SILK";"JP2, JP5, JP6, JP7";"Normally open jumper";""; +"1";"MPU6050";"M08NO_SILK_FEMALE_PTH";"1X08_NO_SILK@1";"J4";"Header 8";""; +"2";"Micro JST";"M02JST-PTH-VERT";"JST-2-PTH-VERT";"J6, J7";"Standard 2-pin 0.1" header. Use with";""; +"1";"RA-SPST";"RA-SPST";"RA-SPST";"S1";"";""; +"1";"Raspberry Pi Pico";"RASPBERRY_PICO-NO_DEBUG";"PICO-PKG-NO_DEBUG";"U1";"";""; +"1";"Red 5mm";"LED3MM";"LED3MM";"LED5";"LED";""; +"1";"SC1464-ND";"PG203J";"PG203J";"X1";"MIC/HEADPHONE JACK";""; +"2";"SMA-VERT";"SMA-VERT";"SMA-VERT";"X2, X3";"";""; +"1";"SRFRS0W5";"SR_FRS_0W5";"SR_FRS_0W5";"U6";"";""; +"1";"Sparkfun USB-C Breakout";"CONN_06NO_SILK_FEMALE_PTH";"1X06_NO_SILK";"J8";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; diff --git a/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_bottom.png b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_bottom.png new file mode 100644 index 00000000..a81acd56 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_bottom.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_gerbers.zip b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_gerbers.zip new file mode 100644 index 00000000..a6a5e4dc Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_gerbers.zip differ diff --git a/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_pcb.png b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_pcb.png new file mode 100644 index 00000000..ccc92b60 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_pcb.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_pour.png b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_pour.png new file mode 100644 index 00000000..71af21cc Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_pour.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_schematic.pdf b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_schematic.pdf new file mode 100644 index 00000000..f1b0ae13 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_schematic.pdf differ diff --git a/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_tnames.pdf b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_tnames.pdf new file mode 100644 index 00000000..b6f981a8 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_tnames.pdf differ diff --git a/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_top.png b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_top.png new file mode 100644 index 00000000..e55056cc Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-STEM-b1.3.2_top.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2._gerbers.zip b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2._gerbers.zip new file mode 100644 index 00000000..88fa73fc Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2._gerbers.zip differ diff --git a/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_bnames.pdf b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_bnames.pdf new file mode 100644 index 00000000..d730ff98 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_bnames.pdf differ diff --git a/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_bom.csv.txt b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_bom.csv.txt new file mode 100644 index 00000000..dc06f39c --- /dev/null +++ b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_bom.csv.txt @@ -0,0 +1,11 @@ +"Qty";"Value";"Device";"Package";"Parts";"Description";""; +"3";"";"CONN_01";"1X01";"JP2, JP3, JP7";"Single connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"1";"AA battery holder BH3AA-PC";"BH3AA-PC";"BAT_BH3AA-PC";"BT2";"Holder Batt 3-Aa Cells Pc Mount";""; +"1";"CONN_20X2";"CONN_20X2";"2X20";"J1";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"1";"DNI/0.1µF";"CAP_CERAMIC0603";"0603";"C1";"Ceramic Capacitors";""; +"1";"DNI/R100";"R-US_R0805";"R0805";"R1";"RESISTOR, American symbol";""; +"1";"INA219 purple board";"INA219";"INA219";"U1";"";""; +"1";"INA219AIDR";"INA219AIDR";"D0008A_N";"U2";"";""; +"3";"JUMPER-SMT_2_NO_SILK";"JUMPER-SMT_2_NO_SILK";"SMT-JUMPER_2_NO_SILK";"JP4, JP5, JP6";"Normally open jumper";""; +"1";"Micro JST";"M02JST-PTH-VERT";"JST-2-PTH-VERT";"JP1";"Standard 2-pin 0.1" header. Use with";""; +"1";"PTC 0ZRG0120FF1E";"PTCPTH";"PTC";"F1";"Resettable Fuse PTC";""; diff --git a/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_bottom.png b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_bottom.png new file mode 100644 index 00000000..8ef684e5 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_bottom.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_pcb.png b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_pcb.png new file mode 100644 index 00000000..9575c241 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_pcb.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_pour.png b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_pour.png new file mode 100644 index 00000000..e1f24e4f Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_pour.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_schematic.pdf b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_schematic.pdf new file mode 100644 index 00000000..49281a35 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_schematic.pdf differ diff --git a/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_tnames.pdf b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_tnames.pdf new file mode 100644 index 00000000..86506605 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_tnames.pdf differ diff --git a/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_top.png b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_top.png new file mode 100644 index 00000000..b4733cd1 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-battery-b1.3.2_top.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2._bottom.png b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2._bottom.png new file mode 100644 index 00000000..a7ef6c5b Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2._bottom.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2._pcb.png b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2._pcb.png new file mode 100644 index 00000000..31e54786 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2._pcb.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2._pour.png b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2._pour.png new file mode 100644 index 00000000..36aa645f Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2._pour.png differ diff --git a/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_bnames.pdf b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_bnames.pdf new file mode 100644 index 00000000..2161269a Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_bnames.pdf differ diff --git a/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_bom.csv.txt b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_bom.csv.txt new file mode 100644 index 00000000..98f15be6 --- /dev/null +++ b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_bom.csv.txt @@ -0,0 +1,18 @@ +"Qty";"Value";"Device";"Package";"Parts";"Description";""; +"2";"";"CONN_01PTH_NO_SILK_YES_STOP";"1X01_NO_SILK";"JP16, JP19";"Single connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"6";"0.1µF";"CAP_CERAMIC0603";"0603";"C2, C3, C4, C5, C6, C7";"Ceramic Capacitors";""; +"6";"1A/23V/620mV";"DIODE-SCHOTTKY-BAT20J";"SOD-323";"D7, D8, D9, D10, D11, D12";"Schottky diode";""; +"6";"1N5817";"DIODE-D-2.5";"D-2.5";"D1, D2, D3, D4, D5, D6";"DIODE";""; +"2";"4.7k";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R3, R4";"Resistor";""; +"1";"CONN_20X2";"CONN_20X2";"2X20";"J1";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"2";"DNI-4.7k";"R-US_R0603";"R0603";"R11, R12";"RESISTOR, American symbol";""; +"2";"DNI-4.7k";"RESISTORPTH-1/4W-VERT-KIT";"AXIAL-0.1EZ";"R7, R8";"Resistor";""; +"1";"DNI/Sparkfun QWIIC Breakout";"CONN_041X04_NO_SILK";"1X04_NO_SILK";"J5";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"1";"Female socket 1x4";"CONN_06NO_SILK_NO_POP";"1X06_NO_SILK";"J4";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"6";"INA219 purple board";"INA219";"INA219";"U3, U4, U5, U6, U7, U8";"";""; +"6";"INA219AIDR";"INA219AIDR";"D0008A_N";"U2, U10, U11, U12, U13, U14";"";""; +"1";"JUMPER-SMT_2_NO_SILK";"JUMPER-SMT_2_NO_SILK";"SMT-JUMPER_2_NO_SILK";"JP18";"Normally open jumper";""; +"1";"Micro JST";"CONN_021X02_NO_SILK";"1X02_NO_SILK";"JP8";"Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections";""; +"14";"Micro JST";"M02JST-PTH-VERT";"JST-2-PTH-VERT";"JP1, JP2, JP3, JP4, JP5, JP6, JP7, JP10, JP11, JP12, JP13, JP14, JP15, JP17";"Standard 2-pin 0.1" header. Use with";""; +"6";"R100";"R-US_R0805";"R0805";"R1, R2, R5, R6, R9, R10";"RESISTOR, American symbol";""; +"1";"VDD-EN";"JUMPER-SMT_2_NC_TRACE_SILK";"SMT-JUMPER_2_NC_TRACE_SILK";"JP9";"Normally closed trace jumper";""; diff --git a/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_gerbers.zip b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_gerbers.zip new file mode 100644 index 00000000..6acd612a Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_gerbers.zip differ diff --git a/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_schematic.pdf b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_schematic.pdf new file mode 100644 index 00000000..749176d7 Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_schematic.pdf differ diff --git a/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_tnames.pdf b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_tnames.pdf new file mode 100644 index 00000000..e9fae5fb Binary files /dev/null and b/hardware/beta-v1.3.2/cubesatsim-solar-b1.3.2_tnames.pdf differ diff --git a/hardware/beta-v1.3.2/readme.md b/hardware/beta-v1.3.2/readme.md new file mode 100644 index 00000000..a494677d --- /dev/null +++ b/hardware/beta-v1.3.2/readme.md @@ -0,0 +1,33 @@ +Here is information about the Beta version of the CubeSatSim V2 Boards, version beta v1.3.2 + +There are 3 boards: STEM Payload, Solar (was Main in v1), and Battery + +Here's what the files are: + +*_gerbers.zip -- All gerber files used to fabricate PCBs along with .TXT drill file + +*_schematic.pdf -- Schematic + +*_pcb.png -- View of board + +*_pour.png -- View of board with fill + +*_top.png -- Top view of PCB generated by gerbers + +*_bottom.png -- Bottom view of PCB generated by gerbers + +*_tNames.pdf -- Top outline of components + +*_bNames.pdf -- Bottom outline of components + +*.mnt -- top SMD component placement data + +*.mnb -- bottom SMD component placement data + +*_bom.csv.txt -- Bill of Materials in CSV format + +I use PCBWay to fabricate PCBs https://pcbway.com + +Here is a very draft bill of materials: https://docs.google.com/spreadsheets/d/1Ta5UaJcinGozcheROrkfwXdGSDUZrXvQ1_nbIBdIIOY/edit?usp=sharing + +Draft wiki instructions: https://github.com/alanbjohnston/CubeSatSim/wiki/v1.3.2-0.-Home diff --git a/main.c b/main.c index 4c5dc785..b78eac85 100644 --- a/main.c +++ b/main.c @@ -22,7 +22,7 @@ #include "main.h" -// #define HAB // uncomment to change APRS icon from Satellite to Balloon +//#define HAB // uncomment to change APRS icon from Satellite to Balloon and only BAT telemetry int main(int argc, char * argv[]) { @@ -44,9 +44,13 @@ int main(int argc, char * argv[]) { } printf("\n\nCubeSatSim v1.3b starting...\n\n"); + + wiringPiSetup(); + + program_radio(); - FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); - pclose(rpitx_stop); + //FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); + //pclose(rpitx_stop); FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r"); pclose(file_deletes); @@ -61,6 +65,10 @@ int main(int argc, char * argv[]) { fflush(stdout); // sleep(2); + +#ifdef HAB + Serial.println("HAB mode enabled - balloon icon and BAT only telem and no low voltage shutdown"); +#endif FILE * rpitx_restart = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_restart); @@ -168,8 +176,6 @@ int main(int argc, char * argv[]) { if (strcmp(sim_yes, "yes") == 0) sim_mode = TRUE; - wiringPiSetup(); - if (mode == AFSK) { // Check for SPI and AX-5043 Digital Transceiver Board @@ -346,6 +352,9 @@ int main(int argc, char * argv[]) { payload = OFF; if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600 + printf("Serial opened to Pico\n"); + payload = ON; +/* char c; int charss = (char) serialDataAvail(uart_fd); if (charss != 0) @@ -386,6 +395,7 @@ int main(int argc, char * argv[]) { payload = ON; } +*/ } else { fprintf(stderr, "Unable to open UART: %s\n -> Did you configure /boot/config.txt and /boot/cmdline.txt?\n", strerror(errno)); } @@ -805,6 +815,7 @@ int main(int argc, char * argv[]) { // if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V /**/ +#ifndef HAB if ((batteryCurrent > currentThreshold) && (batteryVoltage < voltageThreshold) && !sim_mode) // currentThreshold ensures that this won't happen when running on DC power. { fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage); @@ -820,17 +831,17 @@ int main(int argc, char * argv[]) { sleep(1); digitalWrite(onLed, onLedOff); - FILE * file6 = popen("/home/pi/CubeSatSim/log > shutdown_log.txt", "r"); - pclose(file6); - sleep(80); + FILE * file6; // = popen("/home/pi/CubeSatSim/log > shutdown_log.txt", "r"); +// pclose(file6); +// sleep(80); file6 = popen("sudo shutdown -h now > /dev/null 2>&1", "r"); pclose(file6); sleep(10); } - +#endif FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w"); printf("Writing telem_string.txt\n"); - fprintf(fp, "Vbatt = %4.2f\n", batteryVoltage); + fprintf(fp, "BAT %4.2fV %5.1fmA\n", batteryVoltage, batteryCurrent); fclose(fp); /**/ @@ -1030,10 +1041,18 @@ void get_tlm(void) { channel, upper_digit(tlm[channel][4]), lower_digit(tlm[channel][4])); // printf("%s",tlm_str); -// if (mode != AFSK) +#ifdef HAB + if (mode != AFSK) +#endif strcat(str, tlm_str); - } + } +#ifdef HAB + if (mode == AFSK) { + sprintf(tlm_str, "BAT %4.2f %5.1f ", batteryVoltage, batteryCurrent); + strcat(str, tlm_str); + } +#endif // read payload sensor if available /* char sensor_payload[500]; @@ -2164,3 +2183,48 @@ int get_payload_serial(int debug_camera) { fflush(stdout); return(finished); } + +void program_radio() { +// if (sr_frs_present) { + printf("Programming FM module!\n"); + + pinMode(28, OUTPUT); + pinMode(29, OUTPUT); + digitalWrite(29, HIGH); // enable SR_FRS + digitalWrite(28, HIGH); // stop transmit + +if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 + printf("serial opened 9600\n"); + for (int i = 0; i < 5; i++) { + sleep(1); // delay(500); +//#ifdef APRS_VHF +// char vhf_string[] = "AT+DMOSETGROUP=0,144.3900,144.3900,0,3,0,0\r\n"; +// serialPrintf(uart_fd, vhf_string); +// mySerial.println("AT+DMOSETGROUP=0,144.3900,144.3900,0,3,0,0\r"); // can change to 144.39 for standard APRS +// mySerial.println("AT+DMOSETGROUP=0,145.0000,145.0000,0,3,0,0\r"); // can change to 145 for testing ASPRS +//#else + char uhf_string[] = "AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n"; + serialPrintf(uart_fd, uhf_string); +// mySerial.println("AT+DMOSETGROUP=0,435.1000,434.9900,0,3,0,0\r"); // squelch set to 3 +//#endif + sleep(1); + char mic_string[] = "AT+DMOSETMIC=8,0\r\n"; + serialPrintf(uart_fd, mic_string); +// mySerial.println("AT+DMOSETMIC=8,0\r"); // was 8 + + } + } +//#ifdef APRS_VHF +// printf("Programming FM tx 144.39, rx on 144.39 MHz\n"); +//#else + printf("Programming FM tx 434.9, rx on 435.0 MHz\n"); +//#endif +// digitalWrite(PTT_PIN, LOW); // transmit carrier for 0.5 sec +// sleep(0.5); +// digitalWrite(PTT_PIN, HIGH); + digitalWrite(29, LOW); // disable SR_FRS + pinMode(28, INPUT); + pinMode(29, INPUT); + + serialClose(uart_fd); +} diff --git a/main.h b/main.h index 143c3d8d..6a9057dc 100644 --- a/main.h +++ b/main.h @@ -77,6 +77,7 @@ void update_rs(unsigned char parity[32], unsigned char c); void write_little_endian(unsigned int word, int num_bytes, FILE *wav_file); static int init_rf(); extern int Encode_8b10b[][256]; +void program_radio(); int socket_open = 0; int sock = 0; @@ -129,7 +130,7 @@ unsigned int sampleTime = 0; int frames_sent = 0; int cw_id = ON; int vB4 = FALSE, vB5 = FALSE, vB3 = FALSE, ax5043 = FALSE, transmit = FALSE, onLed, onLedOn, onLedOff, txLed, txLedOn, txLedOff, payload = OFF; -float voltageThreshold = 3.25, batteryVoltage = 4.5, batteryCurrent = 0, currentThreshold = 100; +float voltageThreshold = 3.6, batteryVoltage = 4.5, batteryCurrent = 0, currentThreshold = 100; float latitude = 39.027702f, longitude = -77.078064f; float lat_file, long_file; double cpuTemp; diff --git a/rpitx.py b/rpitx.py index 5c36241d..060667f3 100644 --- a/rpitx.py +++ b/rpitx.py @@ -135,7 +135,13 @@ GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(green, GPIO.OUT) -GPIO.setup(squelch, GPIO.IN) +GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected + +if GPIO.input(squelch) == False: + print("squelch not set correctly, no command input!") + no_command = True +else: + no_command = False transmit = False if GPIO.input(12) == False: @@ -256,8 +262,7 @@ if __name__ == "__main__": system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1") -# if (mode != 'a'): - if (command_tx == True): + if (mode != 'a') and (command_tx == True): output(pd, 1) output (ptt, 0) output(txLed, txLedOn) @@ -277,7 +282,7 @@ if __name__ == "__main__": output(pd, 0) sleep(1) else: - print("Don't transmit CW ID since command_tx is False") + print("Don't transmit CW ID since command_tx is False or APRS mode") if (transmit): @@ -322,7 +327,7 @@ if __name__ == "__main__": system("sudo rm /home/pi/CubeSatSim/ready") f.close() sleep(1) - if GPIO.input(squelch) == False: + if (no_command == False and GPIO.input(squelch) == False): print("carrier received!") # command_tx = not command_tx print(command_tx) @@ -388,7 +393,7 @@ if __name__ == "__main__": output (ptt, 1) sleep(5) while True: - if GPIO.input(squelch) == False: + if (no_command == False and GPIO.input(squelch) == False): print("carrier received!") # command_tx = not command_tx print(command_tx) @@ -498,7 +503,7 @@ if __name__ == "__main__": file='/home/pi/CubeSatSim/camera_out.jpg' font1 = ImageFont.truetype('DejaVuSerif.ttf', 20) - font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 20) + font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16) try: filep = open("/home/pi/CubeSatSim/telem_string.txt") @@ -513,8 +518,10 @@ if __name__ == "__main__": draw = ImageDraw.Draw(img) # draw.text((10, 10), callsign, font=font2, fill='white') # draw.text((120, 10), telem_string, font=font2, fill='white') - draw.text((10, 10), callsign, font=font2, fill='black') - draw.text((120, 10), telem_string, font=font2, fill='black') + draw.text((12, 12), callsign, font=font1, fill='black') + draw.text((10, 10), callsign, font=font1, fill='white') + draw.text((122, 12), telem_string, font=font2, fill='black') + draw.text((120, 10), telem_string, font=font2, fill='white') img.save(file) system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/camera_out.jpg") @@ -522,7 +529,7 @@ if __name__ == "__main__": output(pd, 1) sleep(1) - if GPIO.input(squelch) == False: + if (no_command == False and GPIO.input(squelch) == False): print("carrier received!") # command_tx = not command_tx print(command_tx) @@ -607,7 +614,7 @@ if __name__ == "__main__": output(pd, 1) sleep(1) - if GPIO.input(squelch) == False: + if (no_command == False and GPIO.input(squelch) == False): print("carrier received!") # command_tx = not command_tx print(command_tx) @@ -691,7 +698,7 @@ if __name__ == "__main__": # output(txLed, txLedOn) # sleep(0.03) # output(txLed, txLedOff) - if GPIO.input(squelch) == False: + if (no_command == False and GPIO.input(squelch) == False): print("carrier received!") # command_tx = not command_tx print(command_tx) @@ -739,7 +746,7 @@ if __name__ == "__main__": # output(txLed, txLedOn) # sleep(0.03) # output(txLed, txLedOff) - if GPIO.input(squelch) == False: + if (no_command == False and GPIO.input(squelch) == False): print("carrier received!") # command_tx = not command_tx print(command_tx) diff --git a/stempayload/payload_pico/payload_pico.h b/stempayload/payload_pico/payload_pico.h index 89729dbc..2b3dba7c 100644 --- a/stempayload/payload_pico/payload_pico.h +++ b/stempayload/payload_pico/payload_pico.h @@ -152,6 +152,10 @@ uint32_t tx_channel = 0; //ax5043_conf_t hax5043; //ax25_conf_t hax25; +float xOffset; +float yOffset; +float zOffset; + int twosToInt(int val, int len); float toAprsFormat(float input); float rnd_float(double min, double max); @@ -213,7 +217,7 @@ void get_serial_char(); void get_serial_clear_buffer(); void set_lat_lon(); void program_radio(); -void read_config_file(); +bool read_config_file(); void write_config_file(); void read_mode(); void write_mode(); diff --git a/stempayload/payload_pico/payload_pico.ino b/stempayload/payload_pico/payload_pico.ino index fbf2445b..bbebb246 100644 --- a/stempayload/payload_pico/payload_pico.ino +++ b/stempayload/payload_pico/payload_pico.ino @@ -6,7 +6,7 @@ * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * (at your option) any later version. - * + *F * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -96,7 +96,7 @@ void setup() { delay(10000); -// LittleFS.begin(); + LittleFS.begin(); // LittleFS.format(); // only format if files of size 0 keep showing up //#ifdef APRS_VHF // mode = AFSK; // force to APRS @@ -113,7 +113,7 @@ void setup() { // otherwise, run CubeSatSim Pico code - Serial.println("CubeSatSim Pico Payload v0.1 starting...\n"); + Serial.println("CubeSatSim Pico Payload v0.2 starting...\n"); /**/ if (check_for_wifi()) { @@ -132,7 +132,7 @@ void setup() { Serial.print("Pi Zero present, so running Payload OK code."); sr_frs_present = true; - program_radio(); +// program_radio(); start_payload(); pinMode(15, INPUT_PULLUP); @@ -181,23 +181,22 @@ void program_radio() { for (int i = 0; i < 5; i++) { sleep(0.5); // delay(500); -// Serial1.println("AT+DMOSETGROUP=0,434.9100,434.9100,1,2,1,1\r"); -// mySerial.println("AT+DMOSETGROUP=0,434.9000,434.9000,1,2,1,1\r"); -// mySerial.println("AT+DMOSETGROUP=0,434.9000,434.9000,0,8,0,0\r"); -// mySerial.println("AT+DMOSETGROUP=0,432.2510,432.2510,0,8,0,0\r"); -// mySerial.println("AT+DMOSETGROUP=0,432.2500,432.2500,0,8,0,0\r"); #ifdef APRS_VHF - mySerial.println("AT+DMOSETGROUP=0,144.3900,144.3900,0,8,0,0\r"); // can change to 144.39 for standard APRS + mySerial.println("AT+DMOSETGROUP=0,144.3900,144.3900,0,3,0,0\r"); // can change to 144.39 for standard APRS +// mySerial.println("AT+DMOSETGROUP=0,145.0000,145.0000,0,3,0,0\r"); // can change to 145 for testing ASPRS #else - mySerial.println("AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r"); // squelch set to 3 + mySerial.println("AT+DMOSETGROUP=0,435.1000,434.9900,0,3,0,0\r"); // squelch set to 3 #endif sleep(0.5); mySerial.println("AT+DMOSETMIC=8,0\r"); // was 8 } } +#ifdef APRS_VHF + Serial.println("Programming FM tx 144.39, rx on 144.39 MHz"); +#else Serial.println("Programming FM tx 434.9, rx on 435.0 MHz"); - +#endif // digitalWrite(PTT_PIN, LOW); // transmit carrier for 0.5 sec // sleep(0.5); // digitalWrite(PTT_PIN, HIGH); @@ -206,75 +205,37 @@ void program_radio() { pinMode(PTT_PIN, INPUT); } -void read_config_file() { +bool read_config_file() { char buff[255]; // Open configuration file with callsign and reset count Serial.println("Reading config file"); - File config_file = LittleFS.open("/sim.cfg", "r"); -// FILE * config_file = fopen("/sim.cfg", "r"); + File config_file = LittleFS.open("/payload.cfg", "r"); +// FILE * config_file = fopen("/payload.cfg", "r"); if (!config_file) { - Serial.println("Creating config file."); -// config_file = fopen("/sim.cfg", "w+"); - config_file = LittleFS.open("/sim.cfg", "w+"); - -// fprintf(config_file, "%s %d", " ", 100); -// sprintf(buff, "%d\n", cnt); - sprintf(buff, "%s %d", "AMSAT", 0); - config_file.write(buff, strlen(buff)); - - - config_file.close(); - - config_file = LittleFS.open("/sim.cfg", "r"); + return(false); } // char * cfg_buf[100]; config_file.read((uint8_t *)buff, 255); // sscanf(buff, "%d", &cnt); - sscanf(buff, "%s %d %f %f %s", callsign, & reset_count, & lat_file, & long_file, sim_yes); + sscanf(buff, "%f %f %f", xOffset, yOffset, zOffset); config_file.close(); - if (debug_mode) - Serial.printf("Config file /sim.cfg contains %s %d %f %f %s\n", callsign, reset_count, lat_file, long_file, sim_yes); - - reset_count = (reset_count + 1) % 0xffff; - - if ((fabs(lat_file) > 0) && (fabs(lat_file) < 90.0) && (fabs(long_file) > 0) && (fabs(long_file) < 180.0)) { - Serial.println("Valid latitude and longitude in config file\n"); -// convert to APRS DDMM.MM format - latitude = lat_file; // toAprsFormat(lat_file); - longitude = long_file; // toAprsFormat(long_file); - Serial.printf("Lat/Lon updated to: %f/%f\n", latitude, longitude); - } -// } else { // set default -// latitude = toAprsFormat(latitude); -// longitude = toAprsFormat(longitude); -// } -// Serial.printf("sim_yes: %s\n", sim_yes); - char yes_string[] = "yes"; -// if (strcmp(sim_yes, yes_string) == 0) { - if (sim_yes[0] == 'y') { - sim_mode = true; - Serial.println("Simulated telemetry mode set by config file"); - } +// if (debug_mode) + Serial.printf("Config file /payload.cfg contains %f %f %f\n", xOffset, yOffset, zOffset); config_file.close(); - write_config_file(); +// write_config_file(); + + return(true); } void write_config_file() { - Serial.println("Writing /sim.cfg file"); + Serial.println("Writing /payload.cfg file"); char buff[255]; - File config_file = LittleFS.open("/sim.cfg", "w+"); + File config_file = LittleFS.open("/payload.cfg", "w+"); -// sprintf(buff, "%s %d", callsign, ); - - if (sim_mode) - strcpy(sim_yes, "yes"); - else - strcpy(sim_yes, "no"); - - sprintf(buff, "%s %d %f %f %s", callsign, reset_count, latitude, longitude, sim_yes); + sprintf(buff, "%f %f %f", xOffset, yOffset, zOffset); Serial.println("Writing string "); // if (debug_mode) print_string(buff); @@ -365,28 +326,16 @@ void start_payload() { else { mpuPresent = 1; mpu6050.begin(); - - long flag; - float xOffset; - float yOffset; - float zOffset; - EEPROM.get(0, flag); - - if ((flag == 0xA07) && (payload_command != PAYLOAD_RESET)) - { - Serial.println("Reading gyro offsets from EEPROM\n"); - EEPROM.get(4, xOffset); - EEPROM.get(8, yOffset); - EEPROM.get(12, zOffset); - - Serial.println(xOffset, DEC); - Serial.println(yOffset, DEC); - Serial.println(zOffset, DEC); +// if ((read_config_file()) && (payload_command != PAYLOAD_RESET)) + if (false) + { + Serial.println("Reading gyro offsets from config file\n"); mpu6050.setGyroOffsets(xOffset, yOffset, zOffset); } + else { payload_command = false; @@ -400,32 +349,12 @@ void start_payload() { eeprom_word_write(2, (int)(mpu6050.getGyroYoffset() * 100.0) + 0.5); eeprom_word_write(3, (int)(mpu6050.getGyroZoffset() * 100.0) + 0.5); */ - flag = 0xA07; +// flag = 0xA07; xOffset = mpu6050.getGyroXoffset(); yOffset = mpu6050.getGyroYoffset(); zOffset = mpu6050.getGyroZoffset(); - EEPROM.put(0, flag); - EEPROM.put(4, xOffset); - EEPROM.put(8, yOffset); - EEPROM.put(12, zOffset); - - if (EEPROM.commit()) { - Serial.println("EEPROM successfully committed"); - } else { - Serial.println("ERROR! EEPROM commit failed"); - } - - Serial.println(" "); - float f; - EEPROM.get(0, flag); - Serial.println(flag, HEX); - EEPROM.get(4, f); - Serial.println(f); - EEPROM.get(8, f); - Serial.println(f); - EEPROM.get(12, f); - Serial.println(f); + write_config_file(); } } @@ -1049,7 +978,7 @@ void prompt_for_input() { Serial.println("d Change debug mode"); Serial.println("w Connect to WiFi\n"); -// Serial.printf("Software version v0.39 \nConfig file /sim.cfg contains %s %d %f %f %s\n\n", callsign, reset_count, lat_file, long_file, sim_yes); +// Serial.printf("Software version v0.39 \nConfig file /payload.cfg contains %s %d %f %f %s\n\n", callsign, reset_count, lat_file, long_file, sim_yes); /* switch(mode) {