-->
Ornate Pixels: Electronics

PIC16F72 Pure Sine Wave Inverter/UPS: In-Depth Technical Analysis

This article provides an in-depth technical breakdown of the high-performance PIC16F72-based Pure Sine Wave (PSW) Inverter/UPS design, focusing on the sophisticated control logic, robust protection features, and professional circuit segmentation.


Core System Capabilities (Main Features)

The PIC16F72-based design is engineered as a modern, reliable, and feature-rich UPS/Inverter system, incorporating best practices for power electronics.


Pure Sine Wave (PSW) Output: Delivers superior quality power compared to traditional square wave or modified sine wave inverters, making it ideal for sensitive electronic equipment like computers and medical devices.


Microcontroller Control: All logic, sensing, PWM generation, and fault handling are controlled by the PIC16F72 (U1), ensuring fast and reliable operation.


I2C LCD Display: The LCD1/I2CA module provides real-time status updates and displays clear error codes (e.g., E01, E02).


Safe AC Sensing: Utilizes a PC817 Optocoupler for complete Electrical Isolation of the sensitive PIC controller from the dangerous 220V AC mains.


Ground Separation: The distinct segmentation of the Power Ground (PGND) and Signal Ground (SGND) ensures noise-free and highly accurate sensor readings.


Integrated Circuit Protection Mechanisms

Overload Cut-off: Rapid current measurement via Pin 6 (OL SNS) triggers an immediate PWM shutdown upon detecting an overload or short circuit.


Low-Battery Cut-off: The system monitors battery voltage via Pin 3 (BAT SNS) and shuts down the inverter when the voltage drops below a safe limit.


High-Voltage Protection: Logic to safeguard charging and changeover circuitry when the mains AC voltage exceeds acceptable limits.


MOSFET Gating Protection: Uses the IR2110 driver and "Dead-Time" logic programmed into the PIC to prevent "Shoot-Through" failures where both High-Side and Low-Side MOSFETs are inadvertently turned on simultaneously.


Feedback Fail Protection (E03): Shuts down the system if the inverter output voltage feedback is unstable or missing, ensuring a reliable AVR.


Battery Deep-Discharge Safety Protocol

This critical feature protects the battery from deep discharge, thereby extending its lifespan.

Detection: The PIC16F72 continuously measures battery voltage using the Analog-to-Digital Converter (ADC) on Pin 3 (RA2/AN2), controlled by the BATT_READ routine.


Cut-off Logic (Configurable):

Inverter Mode (Deep Discharge): Cut-off typically set at 10.5V DC.

UPS Mode (Sensitive Load): Cut-off typically set slightly higher at 11.2V DC (selectable via user switch).


Shutdown Process: Upon detecting low battery, the PIC immediately stops the PWM output, pulls Pin 11 (H/L Logic) LOW to completely isolate the power stage, and displays E01: LOW BATT on the LCD.


A standard 800 VA IPS, UPS, or Inverter needs a 12-volt battery, typically around 200 Ah. These batteries are currently quite expensive. To prevent the battery from wearing out quickly, the inverter has a Smart Charging System that handles this automatically. If you want the inverter to shut down automatically when the battery voltage drops to 11 volts, you should install an R29 resistor with a value of 110KΩ instead of the usual 100KΩ. Finally, if you intend to use this unit as a Solar Inverter, make sure you use a high-quality external Solar Charge Controller.


Modular Circuit Design and Parts

Control Logic Board Schematic Circuit Diagram

This is the brain of the inverter, where all sensing, logic, and PWM signal generation occur. It houses sensitive components like the PIC16F72, the I2C LCD, the LM358 sensor conditioners, and the PC817 optocoupler. The schematic filename for this section is: pure-sine-wave-inverter-pic16f72-i2c-control-board-schematic-circuit-diagram.

Detailed circuit diagram of the PIC16F72 control board, showing the microcontroller, LM358, PC817 optocoupler, and I2C LCD connections for Pure Sine Wave Inverter / UPS logic
Figure 1: The Control Logic Board schematic (650VA Circuit Diagram) shows the PIC16F72 microcontroller, all sensing components (ADC pins 3, 5, 6), and the low-power I2C display interface.

Control Board Resistor Value

ResValueRatingResValueRating
R21100K1/4WR22N/A
R233.3K1/4WR2433K1/4W
R254.7K1/4WR2647K1/4W
R271K1/4WR28100K1/4W
R29100K1/4WR3033K1/4W
R31100Ω1/4WR32330K1/4W
R33680Ω1/4WR344.7K1/4W
R354.7K1/4WR362.2K1/4W
R372.2K1/4WR382.2K1/4W

Control Board Capacitor Values

CapacitorValueRating
C14, 17, 20, 22, 23, 28, 31, 330.1µF100V
C16, 18, 19, 24, 27, 351µF50V
C29, C30, C32220µF50V
C25, C2633PFCeramic
C13, C154.7µF50V
C2147µF 50V
C34100µF25V
C35 (Bipoler)1µF450VAC

Control Board Diode Specifications

D18, 19, 20, 21, 22, 23, 24, 25, 26 - 1N4007

D27- 1N4148


Display Module (16X2 LCD with I2C Adapter)

The 16x2 display is essential for monitoring the inverter's performance. It not only enhances the visual appeal of the inverter but also makes the overall setup much simpler. Traditionally, connecting this display directly to the microcontroller board requires complex wiring with 8 to 12 individual wires, which adds unnecessary clutter to the circuit. To eliminate this wiring headache, a low-cost I²C adapter module must be purchased. Using this I²C module, the display can be connected to the board using only four wires (Power, Ground, SDA, and SCL). This drastically simplifies the assembly of your entire project, making it clean and error-free.


Thermal Management (Cooling Fan)

The MOSFETs and other power components in your high-power inverter circuit generate significant heat during operation. It is crucial to use a powerful Cooling Fan to effectively dissipate this excess heat.


The KA7812 IC provided on your board will supply the ideal 12V required to power the fan. You should use a 12V DC brushless fan. The fan's function is to pull hot air out of the inverter casing, which will keep the MOSFET temperatures within a manageable range. This proper thermal management ensures that your circuit remains reliable and offers long-term service. For maximum effectiveness, the fan should be strategically placed directly above or close to the MOSFET heatsink.


Power Stage Board (H-Bridge) Schematic Circuit Diagram

This section handles the high current flow. It features the N-Channel MOSFETs in an H-Bridge configuration, the IR2110 driver ICs, and all protective components like fuses and relays. The distinct separation of PGND and SGND is crucial here. The schematic filename for this section is: ups-inverter-mosfet-ir2110-power-stage-schematic-circuit-diagram.webp

Schematic Circuit Diagram of the Inverter Power Stage featuring IRF3205 N-Channel MOSFETs, the IR2110 high/low side driver, and critical components for H-Bridge power conversion

Figure 2: The Power Stage Board schematic showing the IRF3205 MOSFET H-Bridge, the IR2110 gate driver, and the crucial separation between Power Ground (PGND) and Signal Ground (SGND)


Power Stage Resistor Values

Ref. DesValueRating
R1, R3, R4, R5, R8, R10, R11, R124.7Ω1W
R2, R6, R7, R9, R13, R14 10K1/4W
R15, R166.8K1/4 W
R17, R202.2K1/4W
R18, R191.5K1/4W

Power Stage Capacitor Values

Ref. DesValueRating
C1, C2 (Filter Capacitor)4700µF50V
C3, C6, C7 22µF50V
C4, C5, C8, C9, C10, C110.1µF100V

Power Stage Semiconductor and List

ComponentValueRating
U1, U2 (Driver)IR2110DIP
U3A (Op-Amp)LM358DIP
TransistorNumber
M1, M2, M3, M4IR3205N
Q5, Q6BC547BJT
DiodeValueRating
D1, D5, D9, D10, D111N40071W
D2, 3, 4, 6, 7, 8, 121N4148
D14, D15, D16, D1715 Volt1W


High-Power Output Section for 1500VA Solar Inverter Systems

Circuit diagram showing the high-current output section of a 1500VA UPS/Inverter using 16 N-Channel MOSFETs (MOSFET-1 to 16) connected in parallel to form an H-Bridge.

Figure 3: The expanded 1500VA Inverter Output Stage, illustrating how 16 MOSFETs are connected in four parallel branches to manage high current.


Notice in Figure 1 (the 650VA inverter circuit diagram) that there are 4 MOSFETs (M1-M4) used, 2 in each channel. There is no difference in signal input, output, or feedback management between this circuit diagram and Figure 3 (the 1500VA inverter circuit diagram). The core principle remains the same; only the number of MOSFETs is increased. For high-power applications, especially in a 1500VA Solar Inverter system, the standard H-Bridge must be scaled up to handle the significantly increased current loads that often come from solar input or high battery discharge.


The power stage is expanded from a 4-MOSFET configuration (typical for 650VA units) to an array of 16 N-Channel MOSFETs (M1 to M16) instead of four MOSFETs. As shown in Figure 3, these 16 MOSFETs are organized into four parallel channels (two channels for each leg of the H-Bridge). The signal switching pulse is input to the gate terminal of each MOSFET by a separate resistor. This parallel arrangement is essential to equally distribute the high current and minimize heat generation per transistor, ensuring the overall stability and high efficiency required for a reliable Solar Inverter. The gate drive signals coming from the IR2110 driver (from IC Pin-1 and IC Pin-7) are split to control the respective banks of parallel MOSFETs.


Transformer Winding and Design Specifications


The heart of any high-performance Pure Sine Wave inverter is its custom-designed transformer. Based on the standard design data (as shown in the schematic provided), we must first distinguish between the 12 Volt and 24 Volt systems.

Custom winding specifications for 600VA to 1500VA Sine Wave UPS transformers, showing Core numbers, stack height, and turns data for 12-Volt and 24-Volt battery systems.

Figure 4: Finalized and verified custom transformer winding data for 600VA (12V) and 1500VA (24V) Inverter systems, accounting for core material quality.


For the 12 Volt System (e.g., 600VA to 800VA): The low-voltage primary winding (Coil-1) is constructed with only 11 Turns (TRN), using heavy-gauge wire (e.g., 3 parallel strands of 12 SWG) to handle high battery current. The high-voltage secondary winding (Coil-3) uses 368 Turns of 20 SWG wire to output 220 Volt AC at the output.


For the 24 Volt System (e.g., 1200VA to 1500VA): The low-voltage primary (Coil-1) increases to 17 Turns to accommodate the 24 Volt input, still using 3 parallel strands of 12 SWG wire. The secondary winding (Coil-3) is designed with 279 Turns of 17 SWG wire, maintaining the 220 Volt AC output requirement.


Feedback Winding (Coil-2) Analysis: The dedicated feedback winding, essential for the PIC16F72's voltage sensing and regulation, uses 7 Turns of 26 SWG wire in both the 12 Volt and 24 Volt systems. When 220 Volt AC is applied to the secondary winding, the voltage measured across this feedback coil will be approximately 3.5 Volt to 4 Volt AC. This low voltage is then rectified and filtered to provide the necessary low DC feedback signal to the microcontroller's ADC pin.


Verification of TPV (Turns Per Volt): Your personal measurements confirm that when 220 Volt AC is applied to the secondary winding:


The 12 Volt transformer primary outputs 7 Volt AC, confirming the desired Turns Per Volt (TPV) ratio for the push-pull configuration.


The 24 Volt transformer primary outputs 14 Volt AC, which is also accurate for a 24 Volt input PWM system.

Inverter Capacity vs. MOSFETs and Voltage

The circuit diagram illustrates a scalable design principle based on the inverter's power rating. For a 650VA system, a total of 4 MOSFETs are used (2 in each channel), and the supply voltage must be 12 Volts. Scaling up to an 850VA capacity requires a total of 8 MOSFETs (4 in each channel), still operating at 12 Volts. For high-power applications like a 1500VA system, the circuit scales up further, utilizing 16 MOSFETs (8 in each channel), and the required operating voltage is 24 Volts. To ensure maximum battery lifespan and efficiency across all these configurations, it is highly recommended to use a high-capacity battery, ideally rated at 200 Ampere-Hour (Ah).


Technical Explanation of Circuit Logic

Once the schematic images (Control Board and Power Board) are uploaded, a detailed explanation is required to highlight key design decisions:
Ground Separation: Explicitly show the single-point connection (Star Grounding) between the PGND and SGND near the battery negative terminal.
PC817 Logic: Detail the Emitter-Output configuration on Pin 2, confirming that AC presence results in a HIGH signal to the PIC.


Inverter Operation on Battery Power

When operating on battery power (Mains AC absent):

PWM Activation: The PIC16F72 (Pin 14) initiates the generation of the 50Hz Pure Sine Wave PWM pulses.
Power Activation: Pin 11 (H/L Logic) is pulled HIGH, enabling the H-Bridge via the IR2110 drivers.
Continuous Monitoring: The PIC constantly monitors Pin 3 (BAT SNS) and Pin 6 (OL SNS) via ADC for low-battery and overload conditions.


H-Bridge MOSFET Gating and Safety

Ensuring longevity and reliability of the power stage:

IR2110 Driver: Translates the PIC's low-power PWM signal into a high-current gate drive signal to turn the MOSFETs ON/OFF rapidly.


Dead-Time: The PIC's code includes a microsecond-level delay (Dead-Time) logic. This prevents the simultaneous conduction of MOSFETs on the same leg of the H-Bridge, eliminating the risk of destructive "Shoot-Through" current spikes.


Ground Integrity: Isolating the SGND from the PGND ensures the PWM signals reaching the IR2110 are clean and free from power-stage noise.


Load Protection and Overcurrent Trip

The system's rapid overload detection is key to protecting itself and the load.

Detection: The output current is sensed via a Shunt Resistor or Current Transformer. This signal is conditioned and amplified by the LM358 op-amp.
Measurement: The conditioned signal feeds into the PIC's Pin 6 (OL SNS) for ADC reading.
Trip Logic: If the ADC reading exceeds the pre-set threshold, the PIC takes immediate action: shuts down PWM (Pin 14), disables the power stage (Pin 11 LOW), and displays E02: OVERLOAD on the LCD.

Grid Restoration Changeover (INV-MODE)

(When Utility Power Restores)

Event: The 220V AC mains power returns.

Detection: The PC817 Optocoupler is activated, causing the PIC16F72's Pin 2 to receive a HIGH signal (Emitter-Output Logic).


Changeover: The PIC instantly:
1. Stops the PWM and power stage.
2. Activates the Mains Relay to switch the load to utility power.
3. Initiates the battery charging process.

Mains Failure Changeover (UPS-MODE)

(When Utility Power Fails)

Event: The 220V AC mains power fails (power cut).


Detection: The PC817 Optocoupler deactivates, causing the PIC16F72's Pin 2 to receive a LOW signal.


Changeover: The PIC instantly:
1. Deactivates the Mains Relay.
2. Initiates PWM generation and enables the power stage (Pin 14, Pin 11).


Speed: As a true UPS, this changeover must occur in under 10 ms to ensure sensitive loads remain powered.


Smart Battery Charging Process

Control: The charging current is monitored via Pin 4 (CHG_I_READ). The PIC regulates the charging process by altering the PWM Duty Cycle, controlling the current through the main power transformer.
Benefits: The code logic allows for multi-stage charging (Bulk, Absorption, Float, and Trickle Charge) to prevent Over-Charging and maximize battery lifespan.

PWM Signal Generation and AVR

PSW Generation: The PIC16F72 utilizes its CCP1 Module (Pin 14) to generate the 50Hz Pure Sine Wave PWM signal.


Lookup Table: The PIC accesses a pre-stored Sine Wave Lookup Table in its memory. It reads values from this table during each cycle to dynamically adjust the PWM duty cycle, thereby constructing a smooth, clean sine waveform.


AVR (Automatic Voltage Regulation): The feedback voltage received on Pin 5 (Inv-FB) allows the PIC to automatically adjust the PWM duty cycle in real-time, keeping the 220V AC output voltage stable despite load or battery voltage fluctuations.


Troubleshooting and Diagnosis

Basic System Verification

Power Check: Verify +5V using a multimeter between Pin 7 (SGND) and Pin 8 (VDD).

Clock Check: Confirm the 16MHz oscillation across Pin 9/10 (XTAL) using an oscilloscope or frequency meter.

ADC Check: Verify that the proportional DC voltage for the battery is correctly reaching Pin 3 (BAT SNS) from the LM358 output.


Fault Code Analysis

Use the LCD codes for targeted repair:
E01 (LOW BATT): Check the input signal to Pin 3 and the LM358 conditioning circuit.
E02 (OVERLOAD): Test the Shunt Resistor and the signal path to Pin 6.
E03 (FB FAIL): Crucially, check the connection on Pin 5 (Inv-FB) and ensure the feedback is coming from a dedicated auxiliary winding of the main power transformer.


Changeover Functionality Test

Test the PC817 circuit by powering the mains ON and OFF, observing the clean logic level change (HIGH/LOW) on Pin 2.


PIC16F72 Inverter Control Code (with I2C LCD)

To Our Readers: We have finalized the specialized C code for the PIC16F72 Pure Sine Wave Inverter. This file maintains the core functionality of the circuit, including the PWM, AVR (Automatic Voltage Regulation), and essential protection logic. Crucially, the code is integrated with the logic required for the 16x2 LCD via an I2C Adapter, matching the updated circuit diagram you have been following. To complete your project successfully, please download the file below and use it with your preferred compiler (e.g., MikroC or equivalent). Download the Code Here: [Download the Code File].

No comments:

Powered by Blogger.