How bigfanofyours/weather-and-garden-monitoring-on-stm32 works
Project type and purpose
• This is an embedded IoT system integrating:
• A bare-metal STM32F407VET6 microcontroller application (Core + Drivers folders).
• An ESP8266 NodeMCU WiFi module running Arduino sketches (ESP folder).
• A TFT LCD touchscreen interface (ILI9341 + XPT2046).
• Purpose: display data on a portrait-mode TFT, accept touch input, fetch/parse JSON over WiFi, render dynamic content (“Day”, “Night” screens).
File structure
• Top-level “Core” directory:
• Inc/: MCU headers (main.h, cJSON.h, display/touch driver headers).
• Src/: Bare-metal application code (main.c, display modes, cJSON parser, syscalls, startup).
• Startup/: CPU startup assembly.
• “Drivers” directory:
• CMSIS and STM32_HAL libraries used by Core.
• “ESP” directory:
• ESP_Sensor and ESP_Requester Arduino sketches.
• ArduinoJson library for JSON handling on ESP8266.
README for additional insights
• MCU runs at 168 MHz (HCLK), 8 MHz external crystal.
• SPI2 → XPT2046 touchscreen controller (raw coordinate sampling).
• FSMC → ILI9341 TFT display (16-bit parallel bus).
• USART (raw) → ESP8266: send URLs, receive JSON—no AT commands.
• ESP8266 flashed via Arduino IDE; default RX/TX pins.
a. Main components
• STM32F407 MCU
• Bare-metal firmware (HAL, cJSON, GUI modules)
• XPT2046 Touch Controller (SPI2)
• ILI9341 TFT LCD (FSMC)
• ESP8266 NodeMCU WiFi module (USART)
• External Web Server / Internet
b. Relationships and data flows
1. User touches screen → XPT2046 → SPI2 → MCU → firmware interprets coordinates.
2. MCU firmware builds URL request → USART → ESP8266.
3. ESP8266 connects to WiFi → HTTP request → Internet/Web API → JSON response.
4. ESP8266 receives JSON → USART → MCU.
5. MCU firmware parses JSON via cJSON → updates Day/Night UI → FSMC → TFT.
c. Architectural patterns and design principles
• Hardware-abstraction layer (STM32 HAL/CMSIS) isolates peripherals.
• Modular GUI: separate Day.c, Night.c display routines.
• JSON parsing on MCU and ESP: cJSON on STM32, ArduinoJson on ESP.
d. Key technologies/frameworks
• STM32 HAL (Drivers/STM32F4xx_HAL_Driver)
• CMSIS (Drivers/CMSIS)
• cJSON (Core/Src)
• ArduinoJson (ESP/libraries)