STM32 MPPT Solar Controller Design: Current Sense Amplifier (INA186 )

 MPPT Solar Charge Controller & INA186 Design Summary

Hardware Design & Simulation Engineering Document

1. Project Overview

This document provides a comprehensive technical overview of the open-source Maximum Power Point Tracking (MPPT) Solar Charge Controller. The hardware platform is designed to optimize photovoltaic (PV) power extraction and manage battery charging efficiency under dynamic solar irradiance levels.


The first part STM32 MPPT Solar Controller Design: Power Supply & DC/DC Converter covers the power supply circuit connected to the PVA panel port, the DC-to-DC converter stage and battery connection port.


The complete development stack is implemented within the Proteus Design Suite, utilizing:


  • Schematic Capture: Circuit design, nets declaration, and parameter mapping.

  • ARES PCB Layout: High-current trace routing, ground plane isolation, and layer stackup configuration.

  • VSM Studio: Integrated SPICE co-simulation and firmware verification environment.



2. Key System Architecture & Components

The system architecture integrates a dedicated 32-bit controller, synchronous half-bridge power stage, robust protection circuitry, and precision current monitoring.


STM32 MPPT Solar Controller Design: Current Sense Amplifier Created by ee-diary.net STM32F103C8 ST ee-diary.net VSS VDD BOOT0 NRST PA0-WKUP OSCIN_PD0 OSCOUT_PD1 PB8 PA2 PA1 PA3 PA4 PB9 PA5 PA6 PA7 PA8 PA9 PB10 PA10 PB0 PB1 PB2 PB3 PB11 PB4 PB5 PB6 PB7 PB12 PB13 PB14 PB15 PA11 PA12 PA13 PA14 PA15 PC13_RTC PC14-OSC32_IN PC15-OSC32_OUT VDDA VBAT VSSA VSS_2 VDD_2 VSS_3 VDD_3 U1 STM32F103C8 R1 10k C1 100nF C2 100nF C3 100nF C4 100nF R2 10k C5 100nF C6 1uF R3 330 D1 LED-RED 1 2 J1 CONN-H2 D2 SS14 VR1 VARISTOR C7 10nF LS_DRV C8 560uF C9 560uF C10 1uF C11 100nF Q1 IPA045N10N3G Q2 IPA045N10N3G Q3 IPA045N10N3G R4 3.3 R5 3.3 D3 SS14 D4 SS14 HI 5 LI 6 VSS 7 VDD 1 HB 2 HO 3 HS 4 LO 8 U2 LM5101 D5 1N4148 R6 3.3 +12V C12 2.2uF R7 3.3 C13 100nF L1 53uH C14 2.2nF R8 4.7 R9 4.7 C15 0.22uF C16 0.22uF C17 680uF R10 2m C18 680uF 1 2 J2 CONN-H2 INA186 2 4 5 6 1 3 U3 INA186A1 R11 10 C19 1nF R12 10 R13 1k C20 1nF


Subsystem

Hardware Component

Design Function & Parameters

Microcontroller

STM32F103C8 (ARM Cortex-M3)

High-speed PWM generation, MPPT control algorithm execution (Perturb & Observe / Incremental Conductance), system state tracking.

Gate Driver & Power Stage

LM5101 Half-Bridge Driver + Power MOSFETs

High-frequency gate driving with integrated bootstrap circuit; controls high-side and low-side N-channel power MOSFETs.

Protection & Rectification

SS14FL / SS14 Schottky Diode

Reverse current prevention from battery to PV array during low-light conditions; transient protection paired with an S05K82G5 Varistor for input surge absorption.

Current Sensing

INA186A2 / INA186 + $2\text{ m}\Omega$ Shunt Resistor

Low-noise, bidirectionally capable voltage-output current sense amplifier measuring drop across a ultra-low $2\text{ m}\Omega$ current sense resistor.

Current Sensing Circuit Architecture & Low-Noise Signal Conditioning

The exact signal chain from the shunt resistor to the microcontroller is structured as follows:


  1. Shunt Sense Stage (R10 - 2 mΩ): The output charging current passes through the 2 milliohm (2 mΩ) low-side/high-side current sense resistor (R10) placed in series with the output rail (before the output filter capacitors C15–C18 and battery terminal J2), generating a small differential voltage proportional to load/charging current ($V_{\text{sense}} = I \times 2\text{ m}\Omega$).

  2. Input Differential RC Low-Pass Filter (R11, R12, C19): The differential voltage across R10 is routed via Kelvin connections through two 10 Ω series input filter resistors (R11 on the non-inverting input pin 4 / IN+ and R12 on the inverting input pin 5 / IN-) with a 1 nF differential filter capacitor (C19) bridged directly across the amplifier inputs. This differential RC network ($R_{\text{diff}} = R11 + R12 = 20\,\Omega$, $C19 = 1\text{ nF}$, yielding a differential cutoff frequency $f_c = \frac{1}{2\pi (20\,\Omega)(1\text{ nF})} \approx 7.96\text{ MHz}$) suppresses high-frequency switching transients and RF noise from the synchronous buck converter before amplification while maintaining low bias-current offset error.

  3. INA186 Current Sense Amplifier (U3 - INA186A1): U3 (INA186 / INA186A1, fixed gain of 25 V/V in the A1 variant or 50 V/V in the A2 variant, powered from the 3.3 V rail with GND reference on pin 2) amplifies the filtered differential shunt voltage into a clean, single-ended ground-referenced analog voltage on pin 6 (OUT). Its ultra-low input offset voltage, low quiescent current, and high common-mode rejection ratio (CMRR) prevent switching-node common-mode steps from corrupting current readings.

  4. Output Post-Amplifier RC Filter (R13, C20) & STM32F103C8 PA2 ADC Interface: The amplified output from pin 6 of U3 passes through a single-ended RC low-pass filter consisting of a 1 kΩ series resistor (R13) and a 1 nF shunt capacitor (C20) to ground ($f_c = \frac{1}{2\pi (1\text{ k}\Omega)(1\text{ nF})} \approx 159.15\text{ kHz}$). R13 and C20 serve both as an anti-aliasing / switching-ripple filter and as a charge-bucket reservoir to drive the sample-and-hold capacitor of the STM32F103C8 internal 12-bit ADC without voltage droop. Finally, the conditioned analog signal connects directly to pin PA2 (ADC12_IN2) of the STM32F103C8 microcontroller, providing accurate, low-noise current feedback required by the MPPT control algorithm (Perturb & Observe / Incremental Conductance) to compute instantaneous output power ($P = V \times I$) and track the maximum power point reliably.



3. Custom Modeling & Validation in Proteus

Because high-precision component models are often missing from standard CAD libraries, custom models and SPICE definitions were authored specifically for this project in Proteus.

Custom Component Library & SPICE Models

  • INA186A2 Current Sense Amplifier: Created custom schematic symbols and pinouts corresponding to the SC70-6 / SOT-563 packages. Developed behavioral SPICE sub-circuits matching the amplifier's $50\text{ V/V}$ fixed gain, low offset voltage, and common-mode rejection performance.

  • SS14 / SS14FL Schottky Rectifiers: Modeled forward voltage drops ($V_F$), thermal derating parameters, and junction capacitance to evaluate reverse recovery loss within the simulation.

  • The following video shows how the SS14 spice model-based simulation part was created and simulated in proteus.


  • Power MOSFETs: Incorporated full switching and parasitic conduction models to accurately analyze switching transition losses and gate drive current requirements.

  • How to Test N-MOSFET Spice Model Quickly? note explains with video how to install and simulate IPA045N10N3G N-Channel MOSFET.e

Circuit Troubleshooting & VSM Simulation

  • Pin Mapping & Net Integrity: Corrected floating inputs, non-standard power pin assignments, and power-rail connections across the Proteus VSM schematic canvas.

  • Signal Condition Verification: Simulated load transients to verify the response of the INA186 current sense amplifier across the $2\text{ m}\Omega$ shunt. Validated that the output voltage remained clean and proportional without driving the internal STM32 ADC into saturation.



4. Next Steps & Verification

To complete hardware release readiness, the following validation tasks are scheduled:


  1. Proteus Load & Noise Simulations:

    • Run full-sweep transient simulations under variable load profiles to verify INA186 signal-to-noise ratio (SNR) across the $2\text{ m}\Omega$ current-sense shunt.

    • Evaluate filter network response at the INA186 inputs to mitigate high-frequency switching noise originating from the buck converter stage.

  2. ARES Layout Optimization:

    • Finalize trace widths and copper pours in ARES for high-current paths ($PV+$, $BAT+$, and power grounds).

    • Implement strict Kelvin connection routing (four-wire differential routing) from the $2\text{ m}\Omega$ sense resistor directly to the INA186 inputs to eliminate copper trace resistance errors.


Tutorials on STM32 MCU:

Post a Comment

Previous Post Next Post