Sensor_Kit is a hardware-independent sensor framework written in Ada for embedded systems.
It provides a consistent, strongly typed API for interacting with sensors while keeping sensor protocols and hardware-specific details separated from application logic.
The goal is to make sensor programming simple, portable, deterministic, and reliable without sacrificing control over the underlying hardware.
Build a modern embedded sensor framework where applications interact with sensors and meaningful measurements, rather than low-level hardware details.
Sensor drivers should not need to know:
- Which microcontroller is being used.
- How GPIO hardware is implemented.
- How communication peripherals are accessed.
- Which hardware registers are involved.
- How raw sensor data is converted into meaningful values.
The application should describe what sensor it wants and what hardware resources it provides. Sensor_Kit handles the rest.
- Hardware-independent sensor drivers.
- Strongly typed APIs using Ada.
- Consistent API across supported sensors.
- Static memory allocation.
- Deterministic behavior.
- No hidden background tasks.
- No unnecessary dynamic allocation.
- Clear separation between hardware access and sensor logic.
- Simple sensor configuration and creation APIs.
- Meaningful, sensor-specific measurement records.
- Portable architecture suitable for microcontrollers and embedded systems.
Sensor_Kit is built around a simple idea:
Applications ask for measurements. Sensor drivers handle the hardware interaction.
A sensor is configured once and created from its configuration:
DHT_Config : Sensor_Kit.DHT11.Configuration := (Data_Pin => DHT_Pin'Access);
Temperature : Sensor_Kit.DHT11.Sensor :=
Sensor_Kit.DHT11.Create (DHT_Config);Measurements are then obtained through the sensor:
Readings := Temperature.Read;The application works with meaningful sensor data instead of implementing the sensor protocol itself.
For example:
Readings.Temperature
Readings.HumidityThe DHT11 driver is responsible for GPIO transitions, timing, protocol handling, checksum validation, and conversion of the raw response into the returned measurement.
Sensor_Kit uses a layered architecture that separates sensor logic from hardware implementation:
Application
│
▼
Sensor_Kit Sensor API
│
▼
Sensor Driver
│
├──── GPIO
├──── Wait
└──── Future Hardware Interfaces
│
▼
Platform Implementation
│
▼
Hardware
The sensor driver only depends on the hardware capabilities it requires.
For example, a digital sensor may use:
Sensor Driver
│
├── GPIO
└── Wait
An I²C sensor may eventually use:
Sensor Driver
│
└── I²C
This allows the same sensor driver to be used across different microcontrollers without changing the sensor implementation.
Sensor_Kit does not depend on a specific microcontroller or hardware platform.
Sensor drivers communicate with hardware through small abstractions rather than accessing registers directly.
Hardware resources are provided to sensors through configuration.
Configuration := (Data_Pin => DHT_Pin'Access);Sensor drivers do not create or own the underlying hardware resources.
Sensor data is represented using strongly typed Ada records rather than loosely structured values.
Drivers convert raw sensor responses into useful measurements whenever appropriate.
Sensor operations should have predictable execution and resource behavior suitable for embedded systems.
No Hidden Concurrency
Sensor_Kit does not create background tasks or threads on behalf of the application.
Sensor drivers handle:
- Sensor communication.
- Sensor-specific timing.
- Protocol decoding.
- Validation.
- Conversion into measurements.
Applications handle:
- Hardware/platform initialization.
- Sensor configuration.
- Application logic.
- Filtering.
- Sensor fusion.
- Data presentation.
Sensor_Kit follows a consistent lifecycle:
Configuration
│
▼
Create
│
▼
Sensor
│
▼
Read
│
▼
Readings
A typical sensor follows this pattern:
Config : Sensor_Kit.DHT11.Configuration := (Data_Pin => DHT_Pin'Access);
Temperature : Sensor_Kit.DHT11.Sensor :=
Sensor_Kit.DHT11.Create (Config);
Readings := Temperature.Read;Each sensor defines its own configuration and measurement record while following the same overall API model.
For example:
Readings.Temperature
Readings.HumidityThe returned record can contain multiple related measurements from a single sensor read.
Sensor_Kit currently provides only the hardware abstractions required by its implemented sensors.
Current interfaces include:
- GPIO
- Wait
Planned interfaces will be introduced as sensors require them:
- I²C
- SPI
- UART
- ADC
- Timing
Interfaces are intentionally kept small so that platform implementations remain simple and portable.
A future shared hardware-interface project may be extracted when the broader embedded ecosystem matures.
Each sensor is maintained as an independent package.
Sensor_Kit
│
├── DHT11
├── HC_SR04
├── MPU6050
├── BMP280
└── ...
The public package follows the sensor name:
Sensor_Kit.DHT11
Sensor_Kit.HC_SR04
Sensor_Kit.MPU6050Each sensor can internally contain whatever protocol-specific implementation it requires.
Communication protocols are therefore treated as an implementation detail of the sensor rather than the primary way of organizing the library.
Sensor_Kit is intentionally focused on sensor acquisition and representation.
It does not aim to provide:
- Sensor fusion.
- General-purpose signal processing.
- Application-level data storage.
- Graphing or visualization.
- Networking.
- Cloud connectivity.
- Device management.
- RTOS abstractions.
- Microcontroller-specific peripheral drivers.
These concerns can be handled by other layers or libraries.
Version 0.1.0
Sensor_Kit is currently in the early architecture and implementation phase.
- Project structure
- Sensor package structure
- GPIO abstraction
- Wait abstraction
- Sensor configuration model
- Sensor creation API
- Sensor reading API
- DHT11 package skeleton
- GPIO protocol implementation
- Timing implementation
- 40-bit data decoding
- Checksum validation
- Temperature and humidity readings
- Hardware validation
- I²C
- SPI
- UART
- ADC
- Extended timing support
Additional sensors will be introduced after the core architecture has been validated with the initial implementation.
Licensed under the Apache License 2.0.