How michelouieacompanado-prog/internet-of-things-with-esp32 works
This repository implements a three-node ESP32 BLE Mesh smart-home system. A browser command reaches the gateway over Wi-Fi and is sent through BLE Mesh to the relay switch; independently, a light sensor reads ambient light and publishes state changes for mesh nodes. The graph includes the documented provisioning/attention support and the shared sensor and I2C layers. Relationships not visible in sampled source are attributed to the README; unsampled module internals are not inferred.
Main entry points: src/main.c Gateway Startup · src/main.c Sensor Startup · src/main.c Switch Startup · app_web.c HTTP Web UI
Components 18
Gateway
- Gateway Startup
ch9/gateway/src/main.c - HTTP Web UI
ch9/gateway/src/app_web.c - Wi-Fi Connection
ch9/gateway/src/app_ip.c - Mesh OnOff Client
ch9/gateway/src/app_ble.c
Light Sensor
- Sensor Startup
ch9/light_sensor/src/main.c - Light Sampling
ch9/light_sensor/src/app_sensor.c - Mesh Status Publisher
ch9/light_sensor/src/app_ble.c
Relay Switch
- Switch Startup
ch9/switch/src/main.c - Mesh OnOff Models
ch9/switch/src/app_ble.c - Relay Control
ch9/switch/src/app_sw.c
Shared Components
- BLE Provisioning
common/ble/app_blecommon.c - Attention LED
common/led/app_ledattn.c - TSL2561 Driver
common/esp-idf-lib/components/tsl2561/tsl2561.c - I2C Bus Driver
common/esp-idf-lib/components/i2cdev/i2cdev.c
Other components
- Browser Client
- BLE Mesh Network
- Relay Module
- Ambient Light
Connections 25
- Browser Client → HTTP Web UI: sends HTTP commands
README.md - Gateway Startup → HTTP Web UI: initializes with callback
ch9/gateway/src/main.c - Gateway Startup → Wi-Fi Connection: connects Wi-Fi
ch9/gateway/src/main.c - Wi-Fi Connection → Gateway Startup: calls connected handler
README.md - Gateway Startup → HTTP Web UI: starts server on connect
ch9/gateway/src/main.c - HTTP Web UI → Mesh OnOff Client: submits switch command
README.md - Mesh OnOff Client → BLE Mesh Network: sends OnOff Set
README.md - Sensor Startup → Light Sampling: starts sampling
ch9/light_sensor/src/main.c - Sensor Startup → Mesh Status Publisher: passes state callback
ch9/light_sensor/src/main.c - Ambient Light → Light Sampling: provides light level
README.md - Light Sampling → TSL2561 Driver: reads illuminance
README.md - TSL2561 Driver → I2C Bus Driver: uses I2C bus
- Mesh Status Publisher → BLE Mesh Network: publishes status
README.md - Switch Startup → Mesh OnOff Models: initializes mesh callbacks
ch9/switch/src/main.c - Switch Startup → Relay Control: initializes relay
ch9/switch/src/main.c - BLE Mesh Network → Mesh OnOff Models: delivers OnOff commands
README.md - BLE Mesh Network → Mesh Status Publisher: distributes status
README.md - Mesh OnOff Models → Relay Control: sets and reads state
- Relay Control → Relay Module: drives GPIO relay
README.md - Gateway Startup → BLE Provisioning: uses BLE support
- Sensor Startup → BLE Provisioning: uses BLE support
- Switch Startup → BLE Provisioning: uses BLE support
- Gateway Startup → Attention LED: initializes attention LED
ch9/gateway/src/main.c - Sensor Startup → Attention LED: initializes attention LED
ch9/light_sensor/src/main.c - Switch Startup → Attention LED: initializes attention LED
ch9/switch/src/main.c