Skip to main content

A sensor library for the CubeSat STS1 (TU Wien Space Team).

Project description

Docs | Github | PyPI

sts1-sensors

Streamline the process of handling sensors for the STS1 project.

The following sensors are available both on the satellite and on the EDU module:

  • ADXL345 - Digital accelerometer.
  • BME688 - Pressure, humidity, temperature and gas sensor.
  • BMM150 - Geomagnetic sensor.
  • L3GD20H - Three-axis gyroscope.
  • TMP112 - High-accuracy temperature sensor.

The following sensors are available on the satellite only:

Quickstart

from sts1_sensors import ADXL345, BME688, BMM150, L3GD20H, TMP112

# Accelerometer
accel = ADXL345()
x, y, z = accel.get_acceleration()
print(f"{x=:.2f} g, {y=:.2f} g, {z=:.2f} g")

# Temperature, pressure, humidity and gas sensor
multi = BME688(enable_gas_measurements=True)
t = multi.get_temperature()
p = multi.get_pressure()
h = multi.get_humidity()
heat = multi.get_heat_stable()
res = multi.get_gas_resistance()
print(f"{t:.2f} °C, {p:.2f} hPa, {h:.2f} %RH, {heat=}, {res:.2f} Ohms")

# Geomagnetic sensor
mag = BMM150()
x, y, z = mag.get_magnetic_data()
print(f"{x=:.2f} µT, {y=:.2f} µT, {z=:.2f} µT")
print(f"Heading: {mag.get_heading():.2f}°")

# Gyroscope
gyro = L3GD20H()
x, y, z = gyro.get_angular_momentum()
print(f"{x=:.2f} dps, {y=:.2f} dps, {z=:.2f} dps")

# Temperature sensor
temp = TMP112()
print(f"{temp.get_temperature():.2f} °C")

More examples, see examples folder.

Installation

Initial Setup on the Raspberry Pi

  • Open a terminal on the Raspberry Pi (e.g. via SSH).
  • Activate the I2C interface: sudo raspi-config
  • Reboot sudo reboot now then reconnect.
  • Run sudo apt-get install i2c-tools
  • Run ls /dev/i2c*. Note the last number that apprears. E.g. for /dev/i2c-1 this would be 1.
  • Run i2cdetect -y 1. You may change that last number according to what you saw in the previous step.
  • If you see a grid of dashes -- with some numbers, this means some sensors were recognized and you are good to go. For example:
flo@raspberrypi:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: 10 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- 53 -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- 6a -- -- -- -- --
70: -- -- -- -- -- -- 76 --

Installing the Python Package on the Raspberry Pi

Before installing this library, make sure picamera2 is installed system-wide:

sudo apt install python3-picamera2

If you want the latest stable version of the senor libray, install it like so:

pip install sts1-sensors

Depending on the Raspberry Pi OS version you are using it may be necessary to install the library in a python virtual environment

python3 -m venv --system-site-packages .venv
source .venv/bin/activate
pip install sts1-sensors

🚨 Note: This library has only been tested with the Arducam IMX519 camera module (link).
Camera-specific setup steps are required before use.
Here are the steps required for the Arducam IMX519 (link)

For Developers

  • Install just: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
  • Add it to ~/.bashrc: export PATH="$PATH:$HOME/bin"
  • Install the package manager uv: curl -LsSf https://astral.sh/uv/install.sh | sh
  • Add its path to your ~/.bashrc such that the command uv is available: export PATH=$HOME/.local/bin:$PATH
  • Clone this repo: git clone https://github.com/SpaceTeam/STS1_sensor_libraries
  • Switch into the directory.
  • Run uv sync --all-extras --dev. This creates a .venv folder and installs all necessary dependencies.
  • (Only on Raspberry Pi) Run pytest

Acknowledgments

This project makes use of the following open-source libraries and resources:

  • bmm150 - Usage of the bmm150 sensor.
  • bme680 - Usage of the bme680 sensor.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sts1_sensors-0.5.3.tar.gz (50.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sts1_sensors-0.5.3-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file sts1_sensors-0.5.3.tar.gz.

File metadata

  • Download URL: sts1_sensors-0.5.3.tar.gz
  • Upload date:
  • Size: 50.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sts1_sensors-0.5.3.tar.gz
Algorithm Hash digest
SHA256 58b146ee4a10b9f4251a5207e6b5170112cdf5890170c50d3e9aedc152b4cef5
MD5 32b2294b84db51c62399186bccc88dd5
BLAKE2b-256 9bee2c29870c6588bb0e2613c79040119d7105301a0372f43ae95a8c9abed001

See more details on using hashes here.

Provenance

The following attestation bundles were made for sts1_sensors-0.5.3.tar.gz:

Publisher: publish.yml on SpaceTeam/STS1_sensor_libraries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sts1_sensors-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: sts1_sensors-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sts1_sensors-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 25e939a527936776043c46bad692b332abae89ffd2bd35540028a65514b10787
MD5 ebe42953eacd45e7043493cdd315169d
BLAKE2b-256 67d479adaa96070faeda7edf53558e948c29b0596b54fa6ba4a46d6018fe2f6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sts1_sensors-0.5.3-py3-none-any.whl:

Publisher: publish.yml on SpaceTeam/STS1_sensor_libraries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page