# mluna030/real-time-temperature-sensing-system architecture

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

- Interactive diagram: https://gitdiagram.com/mluna030/real-time-temperature-sensing-system
- Repository: https://github.com/mluna030/real-time-temperature-sensing-system

## Overview

This is PIC18F4620 firmware for real-time temperature monitoring and fan control, with a TFT interface and user setup screens. The documented operating workflow is sensor readings over I2C, temperature-based fan control using PWM, and live display over SPI; UART provides debugging. Time, alarm, and heater-temperature setup are additional user-facing stages. The excerpts show screen rendering and setup-to-device calls, but not the main loop or all dispatch wiring, so those connections are omitted rather than inferred.

Main entry points: [`I2C_support.c`](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/I2C_support.c) (Sensor and RTC access), [`Main.c`](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Main.c) (Application firmware), [`Main_Screen.c`](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Main_Screen.c) (Live status screen), [`Setup_Time.c`](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Setup_Time.c) (Time setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Firmware control"]
  node_firmware["Application firmware<br/>[Main.c]"]
  node_fan_control["Fan and PWM<br/>[Fan_Support.c]"]
  node_interrupts["Interrupt handling<br/>[Interrupt.c]"]
  node_utilities["Firmware utilities<br/>[Utils.c]"]
end

subgraph group_devices["Hardware interfaces"]
  node_i2c_device["Sensor and RTC access<br/>[I2C_support.c]"]
  node_i2c_bus["Software I2C bus<br/>[I2C_Soft.c]"]
end

subgraph group_display["TFT presentation"]
  node_display_driver["ST7735 driver<br/>[ST7735_TFT.c]"]
  node_screen["Live status screen<br/>[Main_Screen.c]"]
end

subgraph group_settings["User settings"]
  node_time_setup["Time setup<br/>[Setup_Time.c]"]
  node_alarm_setup["Alarm setup<br/>[Setup_Alarm_Time.c]"]
  node_heater_setup["Heater threshold setup"]
end

node_temperature_sensor[("DS1621 sensor")]
node_rtc[("DS3231 clock")]
node_fan(("Cooling fan"))
node_user(("Device user"))
node_uart(("UART diagnostics"))

node_firmware -.->|"reads via I2C"| node_temperature_sensor
node_firmware -.->|"controls with PWM"| node_fan
node_firmware -.->|"updates readings"| node_screen
node_firmware -.->|"logs diagnostics"| node_uart
node_i2c_device -->|"uses bus routines"| node_i2c_bus
node_i2c_device -.->|"reads temperature"| node_temperature_sensor
node_i2c_device -->|"reads and writes"| node_rtc
node_screen -->|"renders with"| node_display_driver
node_user -.->|"sets clock"| node_time_setup
node_time_setup -->|"writes and reads time"| node_i2c_device
node_time_setup -->|"initializes on exit"| node_screen
node_user -.->|"sets alarm"| node_alarm_setup
node_alarm_setup -->|"reads clock"| node_i2c_device
node_alarm_setup -->|"initializes on exit"| node_screen
node_user -.->|"sets threshold"| node_heater_setup
node_heater_setup -->|"reads clock"| node_i2c_device
node_heater_setup -->|"draws setup screen"| node_display_driver

click node_firmware "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Main.c"
click node_fan_control "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Fan_Support.c"
click node_interrupts "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Interrupt.c"
click node_utilities "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Utils.c"
click node_i2c_device "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/I2C_support.c"
click node_i2c_bus "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/I2C_Soft.c"
click node_display_driver "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/ST7735_TFT.c"
click node_screen "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Main_Screen.c"
click node_time_setup "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Setup_Time.c"
click node_alarm_setup "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Setup_Alarm_Time.c"
click node_heater_setup "https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Setup_Heater_Temp.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_firmware,node_fan_control,node_interrupts,node_utilities,node_user toneBlue
class node_i2c_device,node_i2c_bus,node_temperature_sensor,node_rtc toneAmber
class node_display_driver,node_screen toneMint
class node_time_setup,node_alarm_setup,node_heater_setup toneRose
class node_fan,node_uart toneIndigo
```

## Components

### Firmware control

- [Application firmware](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Main.c): `Main.c`
- [Fan and PWM](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Fan_Support.c): `Fan_Support.c`
- [Interrupt handling](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Interrupt.c): `Interrupt.c`
- [Firmware utilities](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Utils.c): `Utils.c`

### Hardware interfaces

- [Sensor and RTC access](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/I2C_support.c): `I2C_support.c`
- [Software I2C bus](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/I2C_Soft.c): `I2C_Soft.c`

### TFT presentation

- [ST7735 driver](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/ST7735_TFT.c): `ST7735_TFT.c`
- [Live status screen](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Main_Screen.c): `Main_Screen.c`

### User settings

- [Time setup](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Setup_Time.c): `Setup_Time.c`
- [Alarm setup](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Setup_Alarm_Time.c): `Setup_Alarm_Time.c`
- [Heater threshold setup](https://github.com/mluna030/real-time-temperature-sensing-system/blob/main/Setup_Heater_Temp.c): `Setup_Heater_Temp.c`

### Other components

- **DS1621 sensor**
- **DS3231 clock**
- **Cooling fan**
- **Device user**
- **UART diagnostics**

## Connections

- Application firmware → DS1621 sensor: reads via I2C (evidence: `README.md`)
- Application firmware → Cooling fan: controls with PWM (evidence: `README.md`)
- Application firmware → Live status screen: updates readings (evidence: `README.md`)
- Application firmware → UART diagnostics: logs diagnostics (evidence: `README.md`)
- Sensor and RTC access → Software I2C bus: uses bus routines (evidence: `I2C_support.c`)
- Sensor and RTC access → DS1621 sensor: reads temperature (evidence: `README.md`)
- Sensor and RTC access → DS3231 clock: reads and writes (evidence: `I2C_support.c`)
- Live status screen → ST7735 driver: renders with (evidence: `Main_Screen.c`)
- Device user → Time setup: sets clock
- Time setup → Sensor and RTC access: writes and reads time (evidence: `Setup_Time.c`)
- Time setup → Live status screen: initializes on exit (evidence: `Setup_Time.c`)
- Device user → Alarm setup: sets alarm
- Alarm setup → Sensor and RTC access: reads clock (evidence: `Setup_Alarm_Time.c`)
- Alarm setup → Live status screen: initializes on exit (evidence: `Setup_Alarm_Time.c`)
- Device user → Heater threshold setup: sets threshold
- Heater threshold setup → Sensor and RTC access: reads clock (evidence: `Setup_Heater_Temp.c`)
- Heater threshold setup → ST7735 driver: draws setup screen (evidence: `Setup_Heater_Temp.c`)
