# cnlohr/esplocalizer architecture

> Architecture diagram of the GitHub repository cnlohr/esplocalizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cnlohr/esplocalizer
- Repository: https://github.com/cnlohr/esplocalizer

## Overview

ESPLocalizer is an ESP8266-based sensor board with two firmware implementations: Arduino 10-DoF sensor code and ESP8266 C firmware. In the C firmware, boot setup initializes I²C and sensor access; the fast-accelerometer HTTP endpoint collects and streams samples. The web directory also contains browser and firmware-transfer components, but their wiring is not established by the sampled evidence. The README documents the board’s BMP280 and LSM9DS1 sensors and battery charger; charger behavior is not represented in the available source. Several relationships are omitted where implementation details were not shown.

Main entry points: [`firmware-c/user/user_main.c`](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/user_main.c) (Firmware Runtime), [`firmware-c/user/i2c.c`](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/i2c.c) (Sensor Coordinator), [`firmware-arduino/esp_10dof/esp_10dof.ino`](https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/esp_10dof.ino) (Arduino Sketch), [`firmware-arduino/esp_10dof/lsm9ds1.h`](https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/lsm9ds1.h) (LSM9DS1 Driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_arduino["Arduino Firmware"]
  node_arduino_entry["Arduino Sketch<br/>[esp_10dof.ino]"]
  node_arduino_bmp["BMP280 Driver<br/>[bmp280.cpp]"]
  node_arduino_imu["IMU Interface<br/>[imu.h]"]
  node_arduino_lsm["LSM9DS1 Driver<br/>[lsm9ds1.h]"]
  node_arduino_regs["Sensor Registers<br/>[lsm9ds1_reg.h]"]
  node_arduino_types["Sensor Types<br/>[lsm9ds1_types.h]"]
end

subgraph group_c_firmware["ESP8266 C Firmware"]
  node_c_boot["Firmware Runtime<br/>[user_main.c]"]
  node_c_commands["Custom Commands<br/>[custom_commands.c]"]
  node_c_promisc["Wi-Fi Scanning<br/>[promiscuous.c]"]
end

subgraph group_sensors["Sensor Interfaces"]
  node_c_i2c["Sensor Coordinator<br/>[i2c.c]"]
  node_c_bus["Bit-Banged I²C<br/>[static_i2c.h]"]
  node_c_bmp["BMP280 Access<br/>[bmp280.h]"]
  node_c_lsm["LSM9DS1 Access<br/>[lsm9ds1.h]"]
end

subgraph group_web_tools["Web Tools"]
  node_web_ui["Web Interface<br/>[menuinterface.js]"]
  node_web_page["Web Page<br/>[index.html]"]
  node_web_reflash["Reflash Handler<br/>[execute_reflash.c]"]
  node_web_upload["Device Transfer<br/>[pushtodev.c]"]
  node_web_fs["Filesystem Maker<br/>[mfsmaker.c]"]
  node_md5["MD5 Digest<br/>[md5.c]"]
end

node_developer(("User"))
node_esp_board["ESP8266 Board"]
node_sensor_hardware["Sensor Hardware"]

node_developer -.->|"loads firmware"| node_arduino_entry
node_developer -.->|"uses board"| node_c_boot
node_c_boot -.->|"runs on"| node_esp_board
node_sensor_hardware -.->|"connects to"| node_esp_board
node_c_boot -->|"initializes"| node_c_i2c
node_c_boot -->|"reads samples"| node_c_i2c
node_c_i2c -->|"uses bus"| node_c_bus
node_c_i2c -->|"calls"| node_c_bmp
node_c_i2c -->|"calls"| node_c_lsm
node_c_boot -.->|"serves interface"| node_web_ui
node_web_reflash -->|"uses digest"| node_md5
node_arduino_entry -.->|"uses driver"| node_arduino_bmp
node_arduino_entry -.->|"uses driver"| node_arduino_lsm
node_arduino_entry -.->|"uses interface"| node_arduino_imu
node_arduino_lsm -->|"uses definitions"| node_arduino_regs
node_arduino_lsm -->|"uses types"| node_arduino_types

click node_arduino_entry "https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/esp_10dof.ino"
click node_arduino_bmp "https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/bmp280.cpp"
click node_arduino_imu "https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/imu.h"
click node_arduino_lsm "https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/lsm9ds1.h"
click node_arduino_regs "https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/lsm9ds1_reg.h"
click node_arduino_types "https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/lsm9ds1_types.h"
click node_c_boot "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/user_main.c"
click node_c_commands "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/custom_commands.c"
click node_c_promisc "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/promiscuous.c"
click node_c_i2c "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/i2c.c"
click node_c_bus "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/static_i2c.h"
click node_c_bmp "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/bmp280.h"
click node_c_lsm "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/lsm9ds1.h"
click node_web_ui "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/page/menuinterface.js"
click node_web_page "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/page/index.html"
click node_web_reflash "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/execute_reflash.c"
click node_web_upload "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/pushtodev.c"
click node_web_fs "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/mfsmaker.c"
click node_md5 "https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/md5.c"

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_arduino_entry,node_arduino_bmp,node_arduino_imu,node_arduino_lsm,node_arduino_regs,node_arduino_types,node_developer toneBlue
class node_c_boot,node_c_commands,node_c_promisc toneAmber
class node_c_i2c,node_c_bus,node_c_bmp,node_c_lsm toneMint
class node_web_ui,node_web_page,node_web_reflash,node_web_upload,node_web_fs,node_md5 toneRose
class node_esp_board,node_sensor_hardware toneIndigo
```

## Components

### Arduino Firmware

- [Arduino Sketch](https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/esp_10dof.ino): `firmware-arduino/esp_10dof/esp_10dof.ino`
- [BMP280 Driver](https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/bmp280.cpp): `firmware-arduino/esp_10dof/bmp280.cpp`
- [IMU Interface](https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/imu.h): `firmware-arduino/esp_10dof/imu.h`
- [LSM9DS1 Driver](https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/lsm9ds1.h): `firmware-arduino/esp_10dof/lsm9ds1.h`
- [Sensor Registers](https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/lsm9ds1_reg.h): `firmware-arduino/esp_10dof/lsm9ds1_reg.h`
- [Sensor Types](https://github.com/cnlohr/esplocalizer/blob/master/firmware-arduino/esp_10dof/lsm9ds1_types.h): `firmware-arduino/esp_10dof/lsm9ds1_types.h`

### ESP8266 C Firmware

- [Firmware Runtime](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/user_main.c): `firmware-c/user/user_main.c`
- [Custom Commands](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/custom_commands.c): `firmware-c/user/custom_commands.c`
- [Wi-Fi Scanning](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/promiscuous.c): `firmware-c/user/promiscuous.c`

### Sensor Interfaces

- [Sensor Coordinator](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/i2c.c): `firmware-c/user/i2c.c`
- [Bit-Banged I²C](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/static_i2c.h): `firmware-c/user/static_i2c.h`
- [BMP280 Access](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/bmp280.h): `firmware-c/user/bmp280.h`
- [LSM9DS1 Access](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/user/lsm9ds1.h): `firmware-c/user/lsm9ds1.h`

### Web Tools

- [Web Interface](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/page/menuinterface.js): `firmware-c/web/page/menuinterface.js`
- [Web Page](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/page/index.html): `firmware-c/web/page/index.html`
- [Reflash Handler](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/execute_reflash.c): `firmware-c/web/execute_reflash.c`
- [Device Transfer](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/pushtodev.c): `firmware-c/web/pushtodev.c`
- [Filesystem Maker](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/mfsmaker.c): `firmware-c/web/mfsmaker.c`
- [MD5 Digest](https://github.com/cnlohr/esplocalizer/blob/master/firmware-c/web/md5.c): `firmware-c/web/md5.c`

### Other components

- **User**
- **ESP8266 Board**
- **Sensor Hardware**

## Connections

- User → Arduino Sketch: loads firmware (evidence: `README.md`)
- User → Firmware Runtime: uses board (evidence: `README.md`)
- Firmware Runtime → ESP8266 Board: runs on (evidence: `README.md`)
- Sensor Hardware → ESP8266 Board: connects to (evidence: `README.md`)
- Firmware Runtime → Sensor Coordinator: initializes (evidence: `firmware-c/user/user_main.c`)
- Firmware Runtime → Sensor Coordinator: reads samples (evidence: `firmware-c/user/user_main.c`)
- Sensor Coordinator → Bit-Banged I²C: uses bus (evidence: `firmware-c/user/i2c.c`)
- Sensor Coordinator → BMP280 Access: calls (evidence: `firmware-c/user/i2c.c`)
- Sensor Coordinator → LSM9DS1 Access: calls (evidence: `firmware-c/user/i2c.c`)
- Firmware Runtime → Web Interface: serves interface
- Reflash Handler → MD5 Digest: uses digest (evidence: `firmware-c/web/execute_reflash.c`)
- Arduino Sketch → BMP280 Driver: uses driver
- Arduino Sketch → LSM9DS1 Driver: uses driver
- Arduino Sketch → IMU Interface: uses interface
- LSM9DS1 Driver → Sensor Registers: uses definitions (evidence: `firmware-arduino/esp_10dof/lsm9ds1.h`)
- LSM9DS1 Driver → Sensor Types: uses types (evidence: `firmware-arduino/esp_10dof/lsm9ds1.h`)
