Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

A repository with the core code used by the Tugaspace satelite in the Cansat 2024 competition in Azores

Notifications You must be signed in to change notification settings

Flower804/Tugaspace_code_2024

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This reposatory is for the safekeeping of the code used by Tugaspace in the Cansat competition of 2024 in Azores
Made by yours trully Flower

Guide


Esp32 code

  • TugaSpace2024Primarymission -

    This code was originaly made by Professor Miguel, only modified by Flower(me) to implement the multithreading for 2 way Serial comm with the Raspberry Pi so it can do sensor reading at the same time it handles communication with the Raspberry Pi, and optimisse some structs and correct some minor errors in the memory dump and data loss betwhen comms trough anttena.
    • thread 1 : main c++ code for sensor reading

    • thread 2 : sensor comunication via Serial and antenna communication with the ground station.

The code reads values of the Pressure,Temperature, Latitude, Longitude, GPSaltitude, Horizontal velocity and time DFRobot and TinyGPS sensores
And using the values it gathers to calculate its Altitude and time between readings
And then sending the data trough it's anteena for the data to be captured in the ground station and sending the data trough Serial for the Raspberry Pi
The esp32 also has a boot protocol that asks the Raspberry Pi for the last reading it's received from the Esp32, and compares the last reading values to it's current values, and if there is a diference it updates he's own values so it's calculations are accurate

Raspberry Pi codes

  • bbt.py(Raspberry Pi code) -

    This code was completely made by Flower(me :D), the code uses multiprocessing to run 2 processes simultaneously.

    • Process 1(communication_protocol):
      • This protocol reads the Serial comm betwhen the esp32 and the Raspberry Pi to receive and save all the data gathered by the esp32 on the Raspberry Pi's internal memory as a csv file so we can prevent dataloss if the groundstation losses communication with the esp32.
      • This protocol is also responsable for detecting if the esp32 is connected, in case the esp32 has lost conection with the Raspberry Pi (like a short circuit) the Raspberry Pi is able to handle it by changing it's mode and starts using the backup bmp_Adafruit to save the Pressure, Temperature and Altitude in the data file used in the csv file to prevent complete data loss.
      • And when the esp32 comes back online the Raspberry Pi is capable of sending the esp32's last reading to it so the esp32 can update he's data for it's calculations
    • Process 2(camera_protocol):
      • This protocol uses the piCamera library with the implemented camera on the Tugaspace satelite to take and save the photo every 3 seconds on the Raspberry Pi's internal memory, so after retrival the images can be inputed on the Tugaspace's AI protocol to calculate the fire's risk and safe areas for the fireman to escape.
        This protocol also puts the pressure, temperature and altitude values gathered by the bmp_Adafruit sensores in the photo.

        CSV file created as a test by the bbt.py code image

  • launcher.sh -

This Shell script code was completely made by Flower(me again), the code is implemented as a start-up protocol to launch the python code(bbt.py) imediatly when the Raspberry Pi turns on and launches the OS.
The script is run with Shell admin privelege.

  • pythonkill.sh -

This Shell script is used for debuging purposes and made by Flower(ayo its me again), the code when ran stops the python code bbt.py and the launcher script, so the Raspberry Pi codes can be modified and the data can be transfered and analised.

  • crontab log -

Used the daemon crontab log function to save the log of all the actions made in the Raspberry Pi and save in a log dir

AI explanation

Materiais

  • Cansat

    • esp32 wroom 32u wi-fi
    • Raspberry Pi Zero 2
    • MPU-6500
    • Veml7700
    • GT-U7 gps
    • DFrobot BMP 388
    • ds18b20
    • APC220
    • Bateria 602535 3.7v 600mah
    • RASPBERRY-PI RPI-6MM LENS
    • Ra 02 Lora
  • Ground Station

    • 3 ground stations
      • 3x esp32 c6 wroom 1
      • 3x Ra 02 Lora
      • Yagi Uda anttena
      • 2x omnidirecional anttenas

Flower's comments

Hello everyone, I'm Flower the Tugaspace's programmer.
Almost all of the final code was saddly lost and due to not saving the files in other locations except on the Raspberry Pi's internal memory and the esp32 (a bad practice but I was on a tight schedule) it was lost in the fall where the Raspberry Pi was broken in half and the micro Sd card was broken.
I'm in the process of trying to decript the Sd card and finding scraps of the codes to recreate it, right now I was able to recover the launcher.sh script from the Sd card, and I recreated the bbt.py and the using a old version I created and the pythonkill.sh from my Raspberry Pi for testing.
But I still have a little hope I will be able to recover more things from that broken and corrupted Sd card.
Overall I loved this competition , it was like nothing I've ever done before, I was able to test my codding skills and meet amazing people and have fun
A special thanks to professor Miguel from the agrupamento de escolas da lousã for keeping me in place when I'm stressing and losing my mind and to orbisat for making me have fun and turning this into an unforgetable experience

Thank You

IMG-20240430-WA0000

Links

Tugaspace

Flower



     Tugaspace24            +                Flower

Repository made by Flower

About

A repository with the core code used by the Tugaspace satelite in the Cansat 2024 competition in Azores

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published