# dpineda1996/iot-lorawan-mqtt-datalogger-node-red architecture

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

- Interactive diagram: https://gitdiagram.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red
- Repository: https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red

## Overview

This repository provides a Node-RED field datalogger for LoRaWAN crop sensors. Sensors send data through a gateway over MQTT to flows running on a Raspberry Pi; those flows decode readings, display them, check alarm limits, and store them in MariaDB. Users configure experiment and alert settings, which the system restores after a reboot, and can request CSV downloads for chosen date ranges. The README describes these capabilities, but no flow JSON excerpt was supplied, so relationships below reflect documented behavior rather than inspected node-level calls.

Main entry points: [`generic_lorawan_app.json`](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json) (Web dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_field_ingest["Field data ingest"]
  node_sensors(("LoRaWAN sensors"))
  node_gateway["LoRaWAN gateway"]
  node_mqtt["MQTT broker"]
end

subgraph group_user_control["User control"]
  node_dashboard["Web dashboard"]
  node_parameters["User parameters"]
  node_experiment["Experiment settings"]
end

subgraph group_data_services["Data services"]
  node_email["Alert email"]
  node_database[("MariaDB")]
end

subgraph group_flow_runtime["Node-RED flows"]
  node_sensor_flow["Sensor decode"]
  node_initialize["Initialize flow"]
  node_alarms["Alarm checks"]
  node_time_sync["Device time sync"]
  node_database_flow["Dynamic database storage"]
  node_download["Date-range CSV export"]
end

node_user(("Field user"))

node_sensors -->|"send readings"| node_gateway
node_gateway -->|"publish MQTT"| node_mqtt
node_mqtt -->|"deliver readings"| node_sensor_flow
node_sensor_flow -->|"show readings"| node_dashboard
node_user -->|"interact"| node_dashboard
node_dashboard -->|"set parameters"| node_parameters
node_parameters -->|"set experiment"| node_experiment
node_initialize -->|"apply settings"| node_parameters
node_database -->|"restore settings"| node_initialize
node_parameters -->|"configure storage"| node_database_flow
node_sensor_flow -->|"store readings"| node_database_flow
node_database_flow -->|"create columns and store"| node_database
node_sensor_flow -->|"check readings"| node_alarms
node_alarms -->|"send alerts"| node_email
node_user -->|"choose date limits"| node_download
node_download -->|"query date range"| node_database
node_download -->|"provide CSV"| node_dashboard
node_dashboard -->|"provide device time"| node_time_sync

click node_sensor_flow "https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json"
click node_dashboard "https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json"
click node_initialize "https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json"
click node_parameters "https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json"
click node_experiment "https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json"
click node_alarms "https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json"
click node_time_sync "https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json"
click node_database_flow "https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json"
click node_download "https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json"

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_sensors,node_gateway,node_mqtt,node_user toneBlue
class node_dashboard,node_parameters,node_experiment toneAmber
class node_email,node_database toneMint
class node_sensor_flow,node_initialize,node_alarms,node_time_sync,node_database_flow,node_download toneRose
```

## Components

### Field data ingest

- **LoRaWAN sensors**
- **LoRaWAN gateway**
- **MQTT broker**

### User control

- [Web dashboard](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json): `generic_lorawan_app.json`
- [User parameters](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json): `generic_lorawan_app.json`
- [Experiment settings](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json): `generic_lorawan_app.json`

### Data services

- **Alert email**
- **MariaDB**

### Node-RED flows

- [Sensor decode](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json): `generic_lorawan_app.json`
- [Initialize flow](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json): `generic_lorawan_app.json`
- [Alarm checks](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json): `generic_lorawan_app.json`
- [Device time sync](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json): `generic_lorawan_app.json`
- [Dynamic database storage](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json): `generic_lorawan_app.json`
- [Date-range CSV export](https://github.com/dpineda1996/iot-lorawan-mqtt-datalogger-node-red/blob/main/generic_lorawan_app.json): `generic_lorawan_app.json`

### Other components

- **Field user**

## Connections

- LoRaWAN sensors → LoRaWAN gateway: send readings (evidence: `README.md`)
- LoRaWAN gateway → MQTT broker: publish MQTT (evidence: `README.md`)
- MQTT broker → Sensor decode: deliver readings (evidence: `README.md`)
- Sensor decode → Web dashboard: show readings (evidence: `README.md`)
- Field user → Web dashboard: interact (evidence: `README.md`)
- Web dashboard → User parameters: set parameters (evidence: `README.md`)
- User parameters → Experiment settings: set experiment (evidence: `README.md`)
- Initialize flow → User parameters: apply settings (evidence: `README.md`)
- MariaDB → Initialize flow: restore settings (evidence: `README.md`)
- User parameters → Dynamic database storage: configure storage (evidence: `README.md`)
- Sensor decode → Dynamic database storage: store readings (evidence: `README.md`)
- Dynamic database storage → MariaDB: create columns and store (evidence: `README.md`)
- Sensor decode → Alarm checks: check readings (evidence: `README.md`)
- Alarm checks → Alert email: send alerts (evidence: `README.md`)
- Field user → Date-range CSV export: choose date limits (evidence: `README.md`)
- Date-range CSV export → MariaDB: query date range (evidence: `README.md`)
- Date-range CSV export → Web dashboard: provide CSV (evidence: `README.md`)
- Web dashboard → Device time sync: provide device time (evidence: `README.md`)
