This repository contains C drivers for various sensors used in the BLESS (Bexus Low-power Embedded Sensor System) project. These drivers are built on top of the STM32 Hardware Abstraction Layer (HAL).
⚠️ Project Status: Functional Subset These drivers implement the specific features required for our high-altitude balloon mission. They do not cover 100% of the sensors' internal registers or functionalities. Users requiring advanced features should refer to the technical datasheets provided in theDocs/folder.
- Bus Voltage Sensing: Measures bus voltages from 0 to 26 V.
- Crucial Calibration: The
INA219_INITfunction requires the Maximum Expected Current. This value is essential to calculate the internal Calibration Register and define theCurrent_LSB. - Data Handling: Bus Voltage Register bits are shifted right by three positions and multiplied by a 4-mV LSB.
- Addressing: Supports up to 16 programmable I2C addresses via A0 and A1 pins.
- Range: Senses temperature from -40ºC to +125ºC.
- Resolution: 12-bit resolution (0.0625ºC per LSB).
- Interface: I2C compatible.
- Sensor Type: Optimized for PT100/PT1000 platinum RTDs.
- Interface: SPI.
Drivers/: Contains the.cand.hsource files for each individual sensor.Examples/: Containssensors.c, a comprehensive reference implementation showing how to initialize all sensors and acquire data into a unified telemetry packet.Docs/: Technical datasheets and reference manuals for the integrated hardware.
- Add the required sensor files from the
Drivers/directory to your STM32CubeIDE project (typically underCore/IncandCore/Src). - Enable the corresponding I2C or SPI peripherals in your STM32CubeMX configuration (
.iocfile). - Important: When calling
INA219_INIT, you must provide the specificMax_Expected_Currentfor your application to ensure accurate power and current readings.
For a complete demonstration of how to initialize the drivers and handle sensor data acquisition (including error flagging and data scaling), please refer to the provided example:
👉 Examples/sensors.c
This project is licensed under the MIT License - see the LICENSE file for details.