Software for CircuitPython flight software in the PROVES Kit.
If this is your first time using CircuitPython, it is highly recommended that you check out Adafruit's Welcome to CircuitPython to help you get started!
If you have just received a clean PROVES Board, ensure you have loaded the latest firmware from that board's GitHub Repo. Currently the latest FC Board firmware is FC_FIRM_V2.uf2
.
You can cleanly load new software by doing the following:
- Clone the branch you wish to put on your board to your local machine.
- Connect to the target board so it mounts as an external drive.
- If many files have changed, the target board using a serial terminal and run the following code in the REPL to erase all of the existing code:
import storage
storage.erase_filesystem()
NOTE: If you have only changed one or two files, it is fine to just drag and drop them onto the external drive to overwrite the existing files.
- The target board will now disappear and remount. Once remounted copy and paste the contents of the flight software folder for the target board from your GitHub repo.
- When the new files are onboard you can verify that all the hardware on the board is working properly by opening a serial connection and typing one of the two following commands:
For Flight Controller Board
from pysquared import cubesat as c
For Battery Board
NOTE: Battery Board Support will be deprecated in PROVES Kit V2.
from pysquared_eps import cubesat as c
We welcome contributions so please feel free to join us. If you have any questions about contributing please open an issue or a discussion.
We have a few python tools to make development safer, easier, and more consistent. To get started you'll need to run
make
We are working on improving our automated testing but right now the best way to test your code is to run it on the board. We have provided the following command to make it easy to install code on the board:
make install BOARD_MOUNT_POINT=/PATH_TO_YOUR_BOARD
You can find the path to your board by looking for the volume named PYSQUARED
ls -lah /Volumes
...
drwx------@ 1 nate staff 16K Jan 9 08:09 PYSQUARED/
df -h
Everytime you make a change in git, it's called a commit. We have a tool called a precommit hook that will run before you make each commit to ensure your code is safe and formatted correctly. If you experience a lint failure you can run the following to fix it for you or tell you what's wrong.
make fmt
To ensure our code works we use automated testing. If you're seeing a testing failure in your build, you can see what's wrong by running those tests yourself with:
make test
- boot.py This is the code that runs on boot and initializes the stack limit
- main.py This code tasks all the functions the satellite should do in a semi-asynchronous manner utilizing the asyncio library
- payload.py This code implements any desired payload. On the Pleiades missions, the payload has been the BNO055 IMU. Since the use of a stemmaQT connector allows multiple devices on the same bus, a BNO IMU could be used in conjunction with several other sensors if desired.
- safemode.py This code is unimplemented pending new firmware releases that allow the microconrtoller to perform a routine when in safemode
This software contains all of the libraries required to operate the sensors, pysquared board, and radio module.
- asyncio This is the library responsible for scheduling tasks in the main code
- adafruit_bno055.py This is the library that is responsible for obtaining data from the BNO055 IMU
- adafruit_drv2605.mpy This is the pre-compiled library that is responsible for driving the magnetorquer coils using the drv2605 motor driver
- adafruit_ina219.py This is the library that is responsible for obtaining data from the INA219 Power Monitor
- adafruit_mcp9808.mpy This is the pre-compiled library that is responsible for obtaining data from the MCP9808 Temperature Sensor
- adafruit_pca9685.py This is the library that is responsible or driving the power to the satellite faces using the pca9685 LED driver
- adafruit_tca9548a.mpy This is the pre-compiled library that multiplexes the I2C line to each satellite face using the tca9548a I2C Multiplexer
- adafruit_veml7700.py This is the library that is responsible for obtaining data from the veml7700 Light Sensor
- adafruit_vl6180.py This is the library that is responsible for obtaining data from the vl6180 LiDAR sensor
- Big_Data.py This is a class developed to obtain data from the sensors on the 5 solar faces. Since all the faces maintain all the same sensors, this class handles the individual face sensors and returns them all to the main code.
- bitflags.py This is code that allows for some registers within the microcontroller to be written to and saved through power cycles
- debugcolor.py This is code that allows for easier debugging and is used by individual classes. Each class utilizes a different color and makes debugging substantially easier
- Field.py This is code that implements the radio module for sending and listening
- functions.py This is a library of functions utilized by the satellite to obtain data, detumble, run the battery heater
- pysquared.py This is a library that initializes and maintains all the main functions for the pysquared architecture
- pysquared_rfm9x.py This is a library that implements all the radio hardware. This code is a modified version of the pycubed_rfm9x which is a modified version of the adafruit_rfm9x file.
- cdh.py This is the code that handles all the commands. A majority of this code is pulled from the cdh file developed by Max Holliday at Stanford.
- detumble.py This code implements the B-dot algorithm and returns outputs that allow the system to do a controlled detumble with the satellite's embedded magnetourquer coils
This software is used for performing tests on the satellite
- Follow the steps to set up your venv and install packages in the linting setup
- Run tests with
make test