How nishantgaurav45/aht2415c00-nrf54l15-i2c-driver works
Purpose and target
This is a Zephyr/nRF Connect SDK firmware image for the nRF54L15 DK application core. It directly drives an AHT2415C00 temperature/humidity sensor over I2C address 0x38, then logs measurements every two seconds.
Primary firmware entry point: src/main.c.
Build and board integration
Zephyr application build metadata and feature selection are defined by:
• CMakeLists.txt
• prj.conf
The intended target is nrf54l15dk/nrf54l15/cpuapp, built and flashed through the nRF Connect SDK’s west workflow. Runtime output is exposed through Zephyr logging and viewed over RTT or the board’s serial/J-Link interfaces.
Hardware binding boundary
The board devicetree overlay establishes the physical I2C controller/pin routing used by the application:
• nrf54l15dk_nrf54l15_cpuapp.overlay
Its pin selections bind SCL to P1.11 and SDA to P1.12 by default. This is the hardware abstraction boundary: changing sensor wiring should require an overlay update, while the application continues to obtain and use the configured I2C devicetree specification.
Sensor protocol stage
src/main.c implements the AHT2415C00 protocol rather than using Zephyr’s sensor subsystem, because no native Zephyr driver is available for this probe.
The direct I2C command flow is:
1. Read sensor status with 0x71.
2. Initialize with 0xBE if the sensor is not calibrated/ready.
3. Trigger a conversion with 0xAC 0x33 0x00.
4. Wait for conversion completion and read the sensor response.
Zephyr I2C APIs, including i2c_write_dt() and i2c_read_dt(), form the boundary between device-specific command logic and the configured Nordic I2C peripheral.
Measurement decoding and reporting
After a successful response, src/main.c converts the AHT2415C00 encoded humidity and temperature fields into %RH and degrees Celsius. It emits formatted records through Zephyr’s logging subsystem.
Negative I2C return codes are treated as communication failures, making wiring, pull-ups, sensor power, and I2C availability the main operational failure boundary.
Main control loop
The application uses a periodic polling model in src/main.c:
• verify/configure the I2C-backed sensor;
• request one measurement;
• decode and log it;
• sleep for two seconds;
• repeat.
There is no network service, persistent storage, host application, or separate driver module. The firmware is intentionally a single-image, board-bound sensor reader whose external dependencies are the nRF Connect SDK/Zephyr runtime, Nordic nRF54L15 hardware, and the AHT2415C00 I2C device.
Main entry points: main.c Sensor readiness · CMakeLists.txt CMake build metadata · prj.conf Zephyr feature config · nrf54l15dk_nrf54l15_cpuapp.overlay Board I2C overlay
Components 14
Build & deployment
- CMake build metadata
CMakeLists.txt - Zephyr feature config
prj.conf - west workflow · Builds and flashes the CPU application image.
Firmware image
- Application main loop · Polls, reports, then sleeps for two seconds.
src/main.c - Sensor readiness · Reads status and initializes uncalibrated sensors with 0xBE.
src/main.c - Conversion request · Sends 0xAC 0x33 0x00 and waits for completion.
src/main.c - Response decoding · Converts encoded fields to %RH and Celsius.
src/main.c - Zephyr logging · Emits formatted measurement records and communication failures.
- Zephyr I2C APIs · i2c_write_dt() and i2c_read_dt() bridge protocol logic to hardware.
Board & sensor
- Board I2C overlay · Binds SCL P1.11 and SDA P1.12 for the configured controller.
nrf54l15dk_nrf54l15_cpuapp.overlay - nRF54L15 DK CPU app · Target: nrf54l15dk/nrf54l15/cpuapp.
- Configured I2C bus · Physical I2C path to address 0x38.
- AHT2415C00 sensor · Temperature and humidity probe at 0x38.
- RTT / serial output
Connections 15
- CMake build metadata → west workflow: defines application build
- Zephyr feature config → west workflow: selects Zephyr features
- west workflow → nRF54L15 DK CPU app: builds and flashes
- Board I2C overlay → Configured I2C bus: configures controller and pins
- nRF54L15 DK CPU app → Configured I2C bus: hosts peripheral
- Configured I2C bus → AHT2415C00 sensor: I2C address 0x38
- Application main loop → Sensor readiness: verify/configure
- Sensor readiness → Conversion request: ready sensor
- Conversion request → Response decoding: read response
- Response decoding → Zephyr logging: formatted %RH and °C
- Application main loop → Zephyr logging: communication failures
- Sensor readiness → Zephyr I2C APIs: status and init commands
- Conversion request → Zephyr I2C APIs: trigger and read
- Zephyr I2C APIs → Configured I2C bus: devicetree I2C spec
- Zephyr logging → RTT / serial output: runtime output