Introduction: DIY ESP32 Based Dual Phase Interleaved MPPT

About: I make diy and electronics based projects.

This project is an MPPT solar charge controller based on the ESP32-S3 microcontroller. For those unfamiliar with MPPT, it stands for Maximum Power Point Tracking.

MPPT is a technique used to maximize the power output of photovoltaic (PV) panels by adjusting the load on the panel to match the point where its output power is maximized. This is achieved by monitoring and analyzing the current and voltage output of the PV panel, and then adjusting the load accordingly. By implementing MPPT, this project aims to significantly improve the efficiency of solar charging systems and maximize the amount of energy generated.

This project is inspired by Angelo Casimiro's MPPT project. Checking out Angelo's Instructables is a good idea, as they cover many things about MPPT. 

However, my MPPT is a downgraded version, and testing is not yet complete. Therefore, some features are still missing. For example, the code does not yet include the cooling fan and navigation buttons for the screen, although provisions for them have been made on the PCB. These features can be easily added in the future.

Step 1: MPPT Solar Charge Controller Specifications

  • Input: Maximum Open-Circuit Voltage (VOC): 100V
  • Output: Maximum Charging Current: 30A and Maximum Battery Bank Voltage: 30V
  • MPPT Algorithm: Perturb and Observe
  • Conversion Efficiency: Approximately 95% (Not fully tested)
  • Topology: Dual Phase Interleaved Buck
  • Protections: Input Overvoltage Protection, Output Overvoltage Protection, Over Current Protection, Overtemperature Protection
  • Additional Features: Auto Disconnect PV Panel at Night, Auto Disconnect PV Panel on Abnormality, 1.3-inch OLED Display for Real-time Data

Step 2: Interleaved Buck Converters: Power and Efficiency Enhancement

This MPPT controller utilizes a dual-phase interleaved buck topology. This means it uses two identical buck converters connected in parallel, sharing the load and offering several advantages over a single-phase buck converter.

Benefits of Interleaved Buck Converters:

  • Reduced Input and Output Ripple: By sharing the load, the interleaved buck converter significantly reduces both input and output current ripple. This translates to cleaner power delivery and less stress on connected components.
  • Higher Efficiency: Lower ripple currents lead to lower switching losses, significantly increasing overall conversion efficiency. This means you get more usable power from your solar panels.
  • Improved Thermal Performance: By distributing the heat generated across two converters, the interleaved topology prevents excessive heating in any single component, enhancing thermal stability and reliability.
  • Increased Current Capacity: Interleaving effectively doubles the current capacity compared to a single-phase buck converter, enabling support for higher charging currents and larger battery banks.

Asynchronous buck converters can be less efficient than synchronous ones. However, using an interleaved buck design allows for improved efficiency in asynchronous converters. Overall, the use of a dual-phase interleaved buck topology in this MPPT controller contributes to its efficiency, performance, and overall reliability.

PWM Generation and Phase Shifting

This MPPT controller utilizes the ESP32's LEDC library to generate the necessary PWM (Pulse Width Modulation) signals for controlling the buck converters. The PWM frequency is set to 39kHz, ensuring efficient power delivery and minimal ripple.

To achieve the required 180-degree phase shift between the two buck converters, the library's "hpoint" parameter is utilized. In this case, a value of 1023 is assigned to the hpoint parameter, resulting in a 180-degree offset between the two PWM signals. This ensures synchronized operation of the interleaved buck converters, maximizing efficiency and minimizing current ripple.

Step 3: Schematic and Components Used

Now let’s take a look at the schematic and components used.

This is the link to easyeda (oshwlab), you can view and edit the schematic and PCB here and also view the Bill of materials.

Main Switching Buck:

  • Q1 and Q2: These are the two main MOSFETs responsible for switching in the buck converter. While the intended MOSFETs for the buck converter are the TK72E12N1 or equivalent, featuring a voltage rating exceeding 100V and ideally boasting low RDS(on) and gate charge, I am currently utilizing STP150N10F7s due to the temporary unavailability of the preferred option.
  • D1 and D2: These are high-power Schottky diodes responsible for freewheeling current during the off-cycle. Equivalent options include TST30H120CW C0G, SBR30A120CT, and STPS30SM120ST.

Input and Output Capacitors:

  • C1, C2, C3, and C4: These capacitors handle input and output filtering. Low-ESR (Equivalent Series Resistance) capacitors are recommended for optimal performance.

Inductors L1 and L2:

These inductors store energy during the on-cycle and release it during the off-cycle, contributing to smooth current flow. The specific core used in this project is the 0077932A7 core.

If you're using a different core than the 0077932A7, you can utilize online resources to ensure proper operation. Websites like Pigeonsnest or Angelo Casimiro's (Tech Builder) Excel saturation calculator allow you to verify the saturation current for your chosen core.

Once you've confirmed the core's capabilities, use online calculators like coil32 to determine the number of turns required for your desired inductance value (60uH in this case). For the 60uH inductor, 25SWG five enameled copper wires were twisted together (Litz wire) to minimize the skin effect. Approximately 40 turns were then wound around the core.

Voltage Measurement:

R7, R8, R9, R10, and R11: These resistors form voltage divider circuits responsible for measuring both input and output voltage of the MPPT controller.

Current Measurement with TMCS1100A2(U1) and LM4040DELT-2.0(U3)

This project utilizes the TMCS1100A2 Hall effect current sensor for precise current measurement. The advantage of TMCS1100A2 lies in its dedicated external pin for setting the zero current voltage. This is crucial because traditional Hall effect sensors typically set their zero current voltage at half the supply voltage. For example, a 5V supply would result in a 2.5V zero current voltage, which fluctuates with any variations in the supply voltage.

To address this, the project incorporates the LM4040DELT-2.0 voltage reference IC. This dedicated reference IC provides a stable and accurate voltage to set the TMCS1100A2's zero current voltage precisely to 2.048 volts, ensuring consistent and reliable current measurement regardless of supply voltage fluctuations.

Safety First: Disconnecting PV with an Automotive Relay

This project prioritizes safety by employing a (RLY1) 30A automotive relay to automatically disconnect the photovoltaic (PV) panel under two circumstances:

  1. Nighttime: When darkness falls, the relay disconnects the PV panel to prevent unnecessary power drain and potential damage from reverse current flow.
  2. Anomaly Detection: If the system detects any abnormal conditions, such as overvoltage, overcurrent, or MOSFET short, the relay swiftly disconnects the PV panel to safeguard the system and prevent potential harm.

Isolated MOSFET Drive: TLP250H (U4, U5)

The project utilizes the TLP250H isolated MOSFET driver for safe and reliable control of the high-power switching elements. And two B1212S dc to dc isolated converter used to power MOSFET driver, which is crucial for asynchronous buck converters. To drive the MOSFETs efficiently, a dedicated isolated DC-DC power supply is necessary to provide the voltage required across the source and gate terminals.

Precise Measurement with the ADS1115 ADC: Buyer Beware!

This project relies on the accurate voltage and current measurements provided by the ADS1115 analog-to-digital converter (ADC). However, when purchasing an ADS1115 breakout board, it's crucial to choose a trusted source. Unfortunately, the initial board acquired for this project contained an ADS1015 instead of the intended ADS1115. This resulted in inaccurate readings and required manual replacement with the genuine ADS1115 to ensure reliable measurements.


The MPPT controller utilizes two dedicated voltage regulators for efficient power distribution:

  • LM2596HVGR-ADJ (U2): This regulator provides a stable 12V output, powering the cooling fan and relay.
  • AP62301Z6-7 (U8): This regulator supplies a precise 3.3V output, powering the ESP32 microcontroller, ADS1115 ADC, and TMCS1100 current sensor.

Step 4: PCB Fabrication

After completing the PCB design, I began fabricating the circuit board using a double-sided copper clad board. If you're unfamiliar with making double-sided PCBs, I actually made a video on the process! You're welcome to check it out if you'd like. After assembling the SMD components and vias, I applied conformal coating for protection and then inserted the through-hole components one by one.

To properly mount the MOSFETs on the heatsink:

  1. Apply solder paste: Apply thermal paste to both the MOSFET tab and the heatsink contact area.
  2. Mica insulation: Place a mica insulator sheet between the MOSFET tab and the heatsink.
  3. Insulated washer: Use an insulated washer on the screw that goes through the MOSFET tab. This will ensure electrical isolation from the heatsink.

These steps are crucial for preventing electrical short circuits and ensuring optimal heat dissipation from the MOSFETs.

Step 5: Code

After connecting the OLED display to the MPPT controller and the USB-to-TTL chip to a PC, I programmed the ESP32 with parameters for a 12V lead-acid battery. Here is the link to download the code:- https://drive.google.com/drive/folders/1DfFzyiLAgiqUb3dumHGUQ7Gs9fqhkOxj?usp=sharing

Step 6: Testing

Once programmed, a 12V 35Ah battery was connected to the designated terminal. It's crucial to connect the battery first and avoid disconnecting it during operation. Asynchronous buck converters require a load on the output to regulate the voltage Following the battery connection, I configured my power supply to deliver 30V and 5A, simulating the output of a solar panel.

The MPPT controller will continuously monitor for abnormalities. If no anomalies are detected, Within the 10-second delay the relay will engage, activating the MPPT and initiating the charging process. The OLED display will then provide real-time information, including: Input Voltage, Output Voltage, Input Current, Input Power, Production Today: Tracks the cumulative energy generated by the MPPT controller for the current day, Production Total: Shows the total energy generated by the MPPT controller since its initial operation.

If an anomaly is detected during operation, the MPPT controller will take appropriate action, such as disconnecting the PV panel or adjusting the charging parameters, to protect the system and ensure safe operation. Hopefully I will add more features to this MPPT like 4 stage charging for lead acid battery, user interface for changing the parameters, etc.

And Finally, A huge shout-out to Angelo Casimiro! His MPPT project was my go-to reference throughout my own project. His meticulous work and clear explanations were invaluable resources.


Anything Goes Contest

Participated in the
Anything Goes Contest