# openenergymonitor/stm32 architecture

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

- Interactive diagram: https://gitdiagram.com/openenergymonitor/stm32
- Repository: https://github.com/openenergymonitor/stm32

## Overview

This repository is a collection of STM32 firmware examples and development notes for OpenEnergyMonitor hardware, not one single application. Its main product workflow is firmware that samples analog inputs and performs energy-monitoring calculations; variants add temperature sensing, radio, meter communication, and board-specific behavior. The source excerpts show HAL-based ADC activity in the Sombrero firmware, while the README documents the broader example capabilities. Many example implementations were not sampled, so their internal links are omitted rather than inferred.

Main entry points: [`Software/ADC/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h`](https://github.com/openenergymonitor/stm32/blob/master/Software/ADC/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h) (STM32 HAL), [`Software/Sombrero_CB_STM32mini/Src/main.c`](https://github.com/openenergymonitor/stm32/blob/master/Software/Sombrero_CB_STM32mini/Src/main.c) (Sombrero Mini), [`Software/Sombrero_VE_STM32full/Src/main.c`](https://github.com/openenergymonitor/stm32/blob/master/Software/Sombrero_VE_STM32full/Src/main.c) (Sombrero Full)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_basics["Board Basics"]
  node_blink["Blink<br/>[main.c]"]
  node_adc["ADC Example<br/>[main.c]"]
  node_dma["DMA Example<br/>[main.c]"]
  node_hal["STM32 HAL<br/>[stm32f3xx_hal.h]"]
end

subgraph group_measurement["Energy Measurement"]
  node_emon["Emon Example<br/>[main.c]"]
  node_emon1ct["Single CT<br/>[main.c]"]
  node_emon_temp["CT with Temperature<br/>[main.c]"]
  node_phase["Phase Angle<br/>[main.c]"]
  node_emon3ct["Three CTs<br/>[main.c]"]
  node_emon3cb["CB Three CTs<br/>[main.c]"]
  node_emon3cb2["CB Three CTs v2<br/>[main.c]"]
  node_emonvet["VET Monitor<br/>[main.c]"]
  node_multi["Multichannel Monitor<br/>[main.c]"]
  node_sombrero_mini["Sombrero Mini<br/>[main.c]"]
  node_sombrero_full["Sombrero Full<br/>[main.c]"]
end

subgraph group_connectivity["Communications"]
  node_radio_monitor["Radio Monitor<br/>[main.c]"]
  node_rfm69["RFM69 Example<br/>[main.c]"]
  node_mbus["MBUS Reader<br/>[main.c]"]
end

node_sombrero_full -->|"calls ADC APIs"| node_hal
node_sombrero_mini -->|"calls ADC APIs"| node_hal

click node_blink "https://github.com/openenergymonitor/stm32/blob/master/Software/Blink/Src/main.c"
click node_adc "https://github.com/openenergymonitor/stm32/blob/master/Software/ADC/Src/main.c"
click node_dma "https://github.com/openenergymonitor/stm32/blob/master/Software/DMA/Src/main.c"
click node_hal "https://github.com/openenergymonitor/stm32/blob/master/Software/ADC/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h"
click node_emon "https://github.com/openenergymonitor/stm32/blob/master/Software/Emon/Src/main.c"
click node_emon1ct "https://github.com/openenergymonitor/stm32/blob/master/Software/Emon1CT/Src/main.c"
click node_emon_temp "https://github.com/openenergymonitor/stm32/blob/master/Software/Emon1CT_ds18b20/Src/main.c"
click node_phase "https://github.com/openenergymonitor/stm32/blob/master/Software/Emon1CT_phase_angle/Src/main.c"
click node_emon3ct "https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT/Src/main.c"
click node_emon3cb "https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT_CB/Src/main.c"
click node_emon3cb2 "https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT_CB_v2/Src/main.c"
click node_emonvet "https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT_VET/Src/main.c"
click node_multi "https://github.com/openenergymonitor/stm32/blob/master/Software/emonTxshield_dBC/Src/main.c"
click node_sombrero_mini "https://github.com/openenergymonitor/stm32/blob/master/Software/Sombrero_CB_STM32mini/Src/main.c"
click node_sombrero_full "https://github.com/openenergymonitor/stm32/blob/master/Software/Sombrero_VE_STM32full/Src/main.c"
click node_radio_monitor "https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT_RFM69/Src/main.c"
click node_rfm69 "https://github.com/openenergymonitor/stm32/blob/master/Software/RFM69/Src/main.c"
click node_mbus "https://github.com/openenergymonitor/stm32/blob/master/Software/MBUS/Src/main.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_blink,node_adc,node_dma,node_hal toneBlue
class node_emon,node_emon1ct,node_emon_temp,node_phase,node_emon3ct,node_emon3cb,node_emon3cb2,node_emonvet,node_multi,node_sombrero_mini,node_sombrero_full toneAmber
class node_radio_monitor,node_rfm69,node_mbus toneMint
```

## Components

### Board Basics

- [Blink](https://github.com/openenergymonitor/stm32/blob/master/Software/Blink/Src/main.c): `Software/Blink/Src/main.c`
- [ADC Example](https://github.com/openenergymonitor/stm32/blob/master/Software/ADC/Src/main.c): `Software/ADC/Src/main.c`
- [DMA Example](https://github.com/openenergymonitor/stm32/blob/master/Software/DMA/Src/main.c): `Software/DMA/Src/main.c`
- [STM32 HAL](https://github.com/openenergymonitor/stm32/blob/master/Software/ADC/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h): `Software/ADC/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h`

### Energy Measurement

- [Emon Example](https://github.com/openenergymonitor/stm32/blob/master/Software/Emon/Src/main.c): `Software/Emon/Src/main.c`
- [Single CT](https://github.com/openenergymonitor/stm32/blob/master/Software/Emon1CT/Src/main.c): `Software/Emon1CT/Src/main.c`
- [CT with Temperature](https://github.com/openenergymonitor/stm32/blob/master/Software/Emon1CT_ds18b20/Src/main.c): `Software/Emon1CT_ds18b20/Src/main.c`
- [Phase Angle](https://github.com/openenergymonitor/stm32/blob/master/Software/Emon1CT_phase_angle/Src/main.c): `Software/Emon1CT_phase_angle/Src/main.c`
- [Three CTs](https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT/Src/main.c): `Software/Emon3CT/Src/main.c`
- [CB Three CTs](https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT_CB/Src/main.c): `Software/Emon3CT_CB/Src/main.c`
- [CB Three CTs v2](https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT_CB_v2/Src/main.c): `Software/Emon3CT_CB_v2/Src/main.c`
- [VET Monitor](https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT_VET/Src/main.c): `Software/Emon3CT_VET/Src/main.c`
- [Multichannel Monitor](https://github.com/openenergymonitor/stm32/blob/master/Software/emonTxshield_dBC/Src/main.c): `Software/emonTxshield_dBC/Src/main.c`
- [Sombrero Mini](https://github.com/openenergymonitor/stm32/blob/master/Software/Sombrero_CB_STM32mini/Src/main.c): `Software/Sombrero_CB_STM32mini/Src/main.c`
- [Sombrero Full](https://github.com/openenergymonitor/stm32/blob/master/Software/Sombrero_VE_STM32full/Src/main.c): `Software/Sombrero_VE_STM32full/Src/main.c`

### Communications

- [Radio Monitor](https://github.com/openenergymonitor/stm32/blob/master/Software/Emon3CT_RFM69/Src/main.c): `Software/Emon3CT_RFM69/Src/main.c`
- [RFM69 Example](https://github.com/openenergymonitor/stm32/blob/master/Software/RFM69/Src/main.c): `Software/RFM69/Src/main.c`
- [MBUS Reader](https://github.com/openenergymonitor/stm32/blob/master/Software/MBUS/Src/main.c): `Software/MBUS/Src/main.c`

## Connections

- Sombrero Full → STM32 HAL: calls ADC APIs (evidence: `Software/Sombrero_VE_STM32full/Src/main.c`)
- Sombrero Mini → STM32 HAL: calls ADC APIs (evidence: `Software/Sombrero_CB_STM32mini/Src/main.c`)
