# nishantgaurav45/aht2415c00-nrf54l15-i2c-driver architecture

> Architecture diagram of the GitHub repository nishantgaurav45/aht2415c00-nrf54l15-i2c-driver, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver
- Repository: https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver

## Overview

#### 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: [`src/main.c`](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/src/main.c) (Sensor readiness), [`CMakeLists.txt`](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/CMakeLists.txt) (CMake build metadata), [`prj.conf`](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/prj.conf) (Zephyr feature config), [`nrf54l15dk_nrf54l15_cpuapp.overlay`](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/nrf54l15dk_nrf54l15_cpuapp.overlay) (Board I2C overlay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build &amp; deployment"]
  node_cmake["CMake build metadata<br/>build file<br/>[CMakeLists.txt]"]
  node_prjconf["Zephyr feature config<br/>Kconfig<br/>[prj.conf]"]
  node_west{{"west workflow<br/>SDK tool"}}
end

subgraph group_firmware["Firmware image"]
  node_main["Application main loop<br/>firmware entry<br/>[main.c]"]
  node_sensor_setup["Sensor readiness<br/>protocol stage<br/>[main.c]"]
  node_measurement_request["Conversion request<br/>protocol stage<br/>[main.c]"]
  node_response_decode["Response decoding<br/>protocol stage<br/>[main.c]"]
  node_logging["Zephyr logging<br/>runtime service"]
  node_zephyr_i2c["Zephyr I2C APIs<br/>HAL boundary"]
end

subgraph group_hardware["Board &amp; sensor"]
  node_overlay["Board I2C overlay<br/>devicetree overlay"]
  node_nrf54{{"nRF54L15 DK CPU app<br/>target hardware"}}
  node_i2c_bus["Configured I2C bus<br/>Nordic peripheral"]
  node_aht2415["AHT2415C00 sensor<br/>I2C device"]
  node_rtt_serial["RTT / serial output<br/>debug interface"]
end

node_cmake -->|"defines application build"| node_west
node_prjconf -->|"selects Zephyr features"| node_west
node_west -->|"builds and flashes"| node_nrf54
node_overlay -->|"configures controller and pins"| node_i2c_bus
node_nrf54 -->|"hosts peripheral"| node_i2c_bus
node_i2c_bus -->|"I2C address 0x38"| node_aht2415
node_main -->|"verify/configure"| node_sensor_setup
node_sensor_setup -->|"ready sensor"| node_measurement_request
node_measurement_request -->|"read response"| node_response_decode
node_response_decode -->|"formatted %RH and °C"| node_logging
node_main -->|"communication failures"| node_logging
node_sensor_setup -->|"status and init commands"| node_zephyr_i2c
node_measurement_request -->|"trigger and read"| node_zephyr_i2c
node_zephyr_i2c -->|"devicetree I2C spec"| node_i2c_bus
node_logging -->|"runtime output"| node_rtt_serial

click node_cmake "https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/CMakeLists.txt"
click node_prjconf "https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/prj.conf"
click node_main "https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/src/main.c"
click node_sensor_setup "https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/src/main.c"
click node_measurement_request "https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/src/main.c"
click node_response_decode "https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/src/main.c"
click node_overlay "https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/nrf54l15dk_nrf54l15_cpuapp.overlay"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cmake,node_prjconf,node_west toneBlue
class node_main,node_sensor_setup,node_measurement_request,node_response_decode,node_logging,node_zephyr_i2c toneAmber
class node_overlay,node_nrf54,node_i2c_bus,node_aht2415,node_rtt_serial toneMint
```

## Components

### Build & deployment

- [CMake build metadata](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/CMakeLists.txt): build file · `CMakeLists.txt`
- [Zephyr feature config](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/prj.conf): Kconfig · `prj.conf`
- **west workflow**: SDK tool · Builds and flashes the CPU application image.

### Firmware image

- [Application main loop](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/src/main.c): firmware entry · Polls, reports, then sleeps for two seconds. · `src/main.c`
- [Sensor readiness](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/src/main.c): protocol stage · Reads status and initializes uncalibrated sensors with 0xBE. · `src/main.c`
- [Conversion request](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/src/main.c): protocol stage · Sends 0xAC 0x33 0x00 and waits for completion. · `src/main.c`
- [Response decoding](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/src/main.c): protocol stage · Converts encoded fields to %RH and Celsius. · `src/main.c`
- **Zephyr logging**: runtime service · Emits formatted measurement records and communication failures.
- **Zephyr I2C APIs**: HAL boundary · i2c_write_dt() and i2c_read_dt() bridge protocol logic to hardware.

### Board & sensor

- [Board I2C overlay](https://github.com/nishantgaurav45/aht2415c00-nrf54l15-i2c-driver/blob/main/nrf54l15dk_nrf54l15_cpuapp.overlay): devicetree overlay · Binds SCL P1.11 and SDA P1.12 for the configured controller. · `nrf54l15dk_nrf54l15_cpuapp.overlay`
- **nRF54L15 DK CPU app**: target hardware · Target: nrf54l15dk/nrf54l15/cpuapp.
- **Configured I2C bus**: Nordic peripheral · Physical I2C path to address 0x38.
- **AHT2415C00 sensor**: I2C device · Temperature and humidity probe at 0x38.
- **RTT / serial output**: debug interface

## Connections

- 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
