Skip to the content.

Software

Purpose and Scope

The electronic load system is a versatile testing device designed to simulate various electrical loads for power supply testing, battery characterization, and other electronic component validation. It operates in multiple modes (Constant Current, Constant Voltage, Constant Resistance, Constant Power) and provides precision control through both a local lcd interface and a remote web interface.


System Capabilities

Feature Description
Operating Modes Constant Current (CC), Constant Voltage (CV), Constant Resistance (CR), Constant Power (CW)
User Interfaces Local LCD interface and web-based remote interface
Precision Control Digital control of load parameters with real-time feedback
Thermal Management PID-controlled fan with temperature monitoring
Data Monitoring Real-time voltage, current, power, resistance, and temperature measurements
Time Tracking Energy consumption measurement and session uptime tracking

High-Level System Architecture

  %%{ init: { "flowchart": { "defaultRenderer": "elk" } } }%%

  flowchart LR
  subgraph subGraph0["User Interface"]
      direction TB
          C1["Encoder Reading"]
          C["User Interface"]
          C2["LCD Display Update"]
          C3["WebServer Communication"]
    end
  subgraph subGraph1["Power Control"]
      direction TB
          D1["ADC Reading"]
          D["Power Control"]
          D2["Parameter Calculation"]
          D3["DAC Configuration"]
    end
  subgraph subGraph2["Monitoring and Protection"]
      direction TB
          E1["Temperature ADC Reading"]
          E["Monitoring and Protection"]
          E2["Fan Control"]
          E3["Overload Protection"]
    end
      A["Start"] --> B["System Initialization"]
      B --> C & D & E
      C --> C1 & C2 & C3
      D --> D1 & D2 & D3
      E --> E1 & E2 & E3

Key Components & Data Flow

  %%{ init: { "flowchart": { "defaultRenderer": "elk" } } }%%
  
  flowchart TD
  subgraph s1["Acquisition"]
          ADC["ADC: Voltage, Current, Temp"]
          RTC["RTC: Timestamp"]
          Enc["Encoder + Button"]
    end
  subgraph Control["Control"]
          MCU["ESP32"]
          FSM["FSM"]
          PID["PID Control (Fan)"]
    end
  subgraph s2["Generation"]
          DAC["DAC"]
          SW["Analog Switches"]
    end
  subgraph s3["Visualization"]
          LCD["LCD"]
          WS["WebSocket"]
          LED["Integrated LED"]
    end
      ADC --> MCU
      RTC --> MCU
      Enc --> MCU
      MCU --> FSM & PID & LCD & WS & LED
      FSM --> DAC & SW
      PID --> FAN["Fan"]

Main Loop Operations

The main control loop performs several critical operations during each iteration:

  sequenceDiagram
      participant Main as "Main Loop"
      participant Meas as "Measurements"
      participant FSM as "FSM"
      participant Fan as "Fan Control"
      participant UI as "UI Updates"
      participant WS as "WebSocket"
      loop Each loop iteration
          Main->>Meas: Read voltage, current, and temperature
          Note right of Meas: Calculate power, resistance
          Main->>FSM: Run FSM with updated measurements
          Note right of FSM: Execute mode-specific operations
          FSM-->>Main: Update outputs (DAC, relays)
          Main->>Fan: Update PID controller
          Note right of Fan: Adjust fan speed based on temperature
          Main->>UI: Update LCD screen
          Main->>WS: Send status updates
      end

Operating Modes

Each mode uses specific DAC settings and switch configurations, managed by the FSM.


User Interfaces

LCD Interface

LCD Interface Screenshot

Web Interface

LCD Interface Screenshot - Desktop LCD Interface Screenshot - Mobile
Desktop Mobile

Control & State Management


Hardware Components

Component Class Purpose
Digital-to-Analog Converter DAC Controls load level via gate voltage
Analog-to-Digital Converter ADC Measures voltage, current, temperature
Analog Switches AnalogSws Configures mode-select relays
Cooling Fan Fan & PIDFanController Maintains safe temperature
Real-Time Clock RTC Tracks time for energy & uptime
LCD Display LVGL_LCD UI
Rotary Encoder Encoder User input for parameter selection

Development Environment


Conclusion

The electronic load system offers a modular and extensible platform for testing power supplies, batteries, and electronic components. With four operating modes, dual user interfaces, real-time feedback, and robust thermal management, it serves both educational and professional applications as a versatile test instrument.