Hello friends, I hope you all are doing great. Today, I am going to share the new XL4015 CC CV Buck Converter Library for Proteus Simulation. The XL4015 board is the step-down converter makers reach for when a plain voltage regulator is not enough: besides the voltage trimmer it has a second trimmer that sets a current limit, so the same little board can charge a lithium battery, drive a power LED at its rated current or act as a bench supply that cannot burn your circuit. With this library you can run a full Proteus simulation of that board: constant voltage, constant current, the three LEDs that show what it is doing, the losses and the efficiency.
XL4015 CC CV Buck Converter Library for Proteus
Latest version: V1.0 (November 2026, this tutorial)
Other power parts: LM2596 Buck Converter · 18650 Li-ion Battery · INA219 Current Sensor
Helping Tools
- Serial Monitor Advance: a serial terminal window for the UART of your board
- Serial Monitor Expert: the serial monitor with extra debugging tools
- LCD Library for Proteus V3.0: 16x2, 20x4 and I2C LCDs to show your readings
The demo turns the board into a Li-ion charger: it charges our 18650 cell through both phases of a real charge while an Arduino measures the current with an INA219.
NOTICE: Our team has put a lot of effort into these small parts: the bodies, the animation and the pop-ups are all our own design, and you get them free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the motor driver board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the XL4015 CC CV Buck Converter Library for Proteus Simulation:
What Is the XL4015 CC CV Buck Converter?
The XL4015 is a 180 kHz step-down regulator with an internal power MOSFET, good for up to 5 A. The popular board adds a toroid inductor, a Schottky diode, capacitors, and a current loop: a 0.05 ohm shunt resistor in the output's minus line and an LM358 op-amp that compares its voltage with a setting. As long as the load takes less than that setting, the XL4015 regulates the voltage - constant voltage, CV. When the load asks for more, the op-amp takes over the feedback and the board regulates the current instead - constant current, CC.
| XL4015 CC CV buck converter board | |
|---|---|
| Input | 5 - 36 V |
| Output | 1.25 - 32 V (the CV trimmer) |
| Current limit | 0 - 5 A (the CC trimmer) |
| Switching | 180 kHz, internal MOSFET |
| LEDs | CC (current limit), CHG (charging), FULL (charged) |
| Uses | Li-ion and lead-acid charging, power LED drivers, bench supplies |
Constant Voltage and Constant Current
Think of the board's output as a rectangle on a graph of voltage against current. Along the top edge the voltage is fixed at the CV setting and the current is whatever the load takes. Along the right edge the current is fixed at the CC setting and the voltage is whatever the load allows. The working point sits on one of the two edges: a light load lives on the CV line, a heavy load - or an empty battery - slides down the CC line. That is exactly how a lab power supply with a current limit behaves.
Charging a Li-ion Cell
A lithium-ion cell wants exactly this: a constant current until it reaches 4.20 V, then a constant 4.20 V while the current falls away. With CV at 4.20 V and CC at the charge current, the XL4015 does both phases by itself. The charge is finished when the current has fallen to about a tenth of the CC setting - and that is what the third, small trimmer and the FULL LED are for: below that threshold the red CHG LED goes out and the blue FULL LED lights.
The Shunt and the Common Minus
The current is measured in the minus line, between IN- and OUT-. So OUT- is not quite the same as IN-: it sits 0.05 ohm above it, 50 mV at 1 A. That has a practical consequence the board's users often learn the hard way: never join OUT- and IN- outside the board, for example through a common ground wire, or the current bypasses the shunt and the CC limit stops working. The library models the shunt as a real 0.05 ohm resistor between the two pins.
The Converter in the Simulation
Like our LM2596 Buck Converter Library for Proteus, the model is averaged. In CV the output is fed from the input times the duty cycle through the inductor's resistance, stamped as an ideal DC transformer so the input current flows in the circuit, and a regulation loop holds the voltage between OUT+ and the board's ground at VOUT. When the output current reaches IOUT, the model switches to CC: the board becomes a current source of exactly IOUT into OUT+, drawing the matching power from the input, until the output voltage climbs back to VOUT. The losses - the MOSFET, the diode, the switching, the chip and its LEDs - are added on the input side, so the efficiency follows. FULL sets the FULL LED's threshold in percent of IOUT.
Features of the XL4015 CC CV Buck Converter Library for Proteus Simulation
- A real-looking board: the 51 x 26 mm module at its real size with the XL4015, the toroid, the shunt, the LM358, three trimmers and three LEDs.
- CV and CC: the voltage and the current limit by property, the switch between them as the load changes.
- Working LEDs: CC in current limit, CHG while charging, FULL below the threshold.
- Real efficiency: the input current follows the output power and the losses.
- A pop-up: the CC / CV rectangle with the working point, the output over time, eight tiles - graphs, an event log and a check page.
- A complete package: about 1.9 MB with the library, our 18650 cell and INA219, our Arduino UNO V4.0 and the demo, without the source code of the model.
The XL4015 in Proteus
The device is XL4015CCCVTEP in TEPXL4015.LIB, under Modules > Power, with the prefix U and the model TEPXL4015.DLL. Search XL4015, CC CV or buck in Pick Devices. On the left are IN+ and IN-, on the right OUT+ and OUT-. Three properties: VOUT (the CV trimmer), IOUT (the CC trimmer) and FULL (the FULL LED's threshold).
Download XL4015 CC CV Buck Converter Library for Proteus Simulation
Click the button below to download XL4015-CC-CV-Buck-Converter-Library-for-Proteus-v1.0.zip (about 1.9 MB, without the source code of the models):
XL4015 CC CV Buck Converter Library for Proteus V1.0- README.txt: installation, the demo, the wiring, troubleshooting and the limits of the simulation.
- Proteus Library Files:
TEPXL4015.LIB,TEP18650.LIB,TEPINA219.LIBandArduinoV4TEP.LIB. - Proteus Model Files:
TEPXL4015.DLL,TEP18650.DLL,TEPINA219.DLLandTEPARDUINO.DLL. - Arduino Code: the demo sketch (Wire only).
- Proteus Simulation: the demo project, its HEX file and copies of the DLLs.
No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.
How to Install XL4015 CC CV Buck Converter Library for Proteus Simulation
- Close Proteus and extract the whole zip file, for example to your Desktop.
- Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
- Copy the files from Proteus Model Files into the MODELS folder.
- Delete
TEPXL4015.IDXfrom the LIBRARY folder if it is there. - Start Proteus, press P and search for XL4015.
Proteus Simulation of a Li-ion Charger
The demo uses an A4 sheet with our Arduino UNO Library for Proteus V4.0, the XL4015 U1 set to 4.20 V and 1.00 A with its FULL threshold at 10 %, our INA219 from the INA219 Current Sensor Library for Proteus measuring the current, and our 18650 cell from the 18650 Li-ion Battery Library for Proteus, starting at 20 % charge. The cell's battery clock runs 3600 times faster, so each simulated second is an hour of charging. +12V feeds the board; OUT+ goes through the INA219's shunt to the cell's +, and the cell's - goes back to OUT-. The Arduino's monitor is built in, the same window as our TEP Serial Monitor Advance for Proteus. Open XL4015-LiIon-Charger-ArduinoUnoV4.pdsprj.
The Sketch
The sketch reads the INA219's registers directly with Wire. Every 10 ms it takes the cell's voltage and the current, and counts the milliamp-hours in battery time:
volts = ((uint16_t)readReg(0x02) >> 3) * 0.004; // 4 mV a step: the cell's +
amps = readReg(0x01) * 0.00001 / SHUNT_OHM; // + from the charger into the cell
Four times a second it names the phase from the current:
if (amps > CC_AMPS * 0.97) Serial.print(F("CC (constant current)"));
else if (amps > END_AMPS) Serial.print(F("CV (the current tapers)"));
else Serial.print(F("FULL"));
XL4015 Simulation Results
Open the project and press Run. The demo runs 4.0 simulated seconds and took about two minutes on our PC with the pop-up open and the pictures being taken. Click the board for its pop-up. Every number below comes from one simulation run, the demo exactly as it ships.
Constant Current
The board starts aiming for 4.20 V, but the cell sits at about 3.7 V and would take far more than 1 A, so within 2 ms the current reaches the CC setting and the LM358 takes over: CC. The CC and CHG LEDs light. At 0.7 s the board holds exactly 1.000 A while its output sits at 4.05 V, wherever the cell pulls it. It takes 0.377 A from the 12 V supply - 4.53 W in for 4.05 W out, 89.6 % efficient at a 37 % duty cycle. On the monitor the cell's voltage climbs from 3.91 V and the milliamp-hours add up, 251 more each simulated second.
Constant Voltage
At 1.18 s the output reaches the CV voltage. The event log notes it, the CC LED goes out, and the board now holds 4.20 V between OUT+ and its ground while the current falls on its own: the cell's rising voltage leaves less and less difference to drive it. On the monitor the current drops through 0.847, 0.665 and 0.513 A. At 2.2 s it is 0.273 A, with 4.186 V on the output terminals - the 0.05 ohm shunt takes the rest - and the efficiency is 87.3 %. In the pop-up the working point slides left along the CV line of the rectangle.
Full
At 2.87 s the current falls under 10 % of CC, 0.099 A: the red CHG LED goes out and the blue FULL LED lights. The sketch agrees: "Charge complete: 1790 mAh in 2.75 h of battery time". The board keeps holding 4.20 V, and the current keeps fading. By 4 s it is down to 0.036 A, and the efficiency has dropped to 59 % - the board's own few milliamperes are now a large share of the power.
The Graphs, the Event Log and the Check Page
The Graphs page plots the output voltage and current, the input current and the efficiency over the whole charge. The Event log records the switch from CC to CV and the FULL threshold. The Check page sums up the run: the input at 12.00 V, the output at 4.198 V and 0.036 A at the end with 1.000 A the most, 1.18 s in CC and 2.82 s in CV with the FULL LED lit, 90.4 % the best efficiency above 0.2 A, and the chip at 25 C.
The Arduino's monitor tells the same story from the INA219's side: the cell's voltage, the current and the phase four times a second, and the milliamp-hours of the whole charge.
Driving a Power LED
The same board makes an excellent LED driver. A power LED's voltage changes with temperature and from one LED to the next, so feeding it a fixed voltage is risky; feeding it a fixed current is right. Set CV a little above the LED's forward voltage - say 3.6 V for a white 3 W LED - and CC to its rated current, 700 mA: the board sits on the CC line and the LED gets exactly 700 mA whatever its voltage does. The CC LED stays lit to tell you so.
Try It Yourself
- Raise IOUT to 1.25 A, the cell's maximum charge current: the CC phase gets shorter.
- Set FULL to 5 %: the FULL LED lights later, with the cell a little fuller.
- Start the cell at 90 % (SOC 90): the charge begins almost straight in CV.
- Replace the cell with a 4.7 ohm power resistor and set CV to 12 V: the board limits the current at 1 A and the voltage settles at 4.7 V.
- Lower the input to 4.5 V: under the XL4015's 5 V minimum the board does not start, and the pop-up says OFF.
Ideas to Extend the Demo
- A 3S pack charger at 12.6 V with a BMS.
- A dimmable power LED: an Arduino-controlled resistor in the CC trimmer's place.
- A solar charger for a lead-acid battery at 14.4 V.
Your Own Sketches
The demo sketch is in the zip file, and you can change it in the Arduino IDE. New to Arduino? Start with our Arduino Tutorial for Beginners. Export the compiled binary, and set the UNO's PROGRAM property to the new file. Our guide on How to get the HEX file from Arduino shows you where the file ends up.
Things to Know Before Using a Real XL4015 Board
- Set CV first: with no load, turn the CV trimmer to the voltage; then short the output through an ammeter and set CC.
- The minus line: never join OUT- and IN- outside the board - the shunt between them measures the current.
- Cooling: above about 3 A continuous the board needs a fan; the toroid and the diode get hot too.
- Charging: a bare Li-ion cell has no protection - use a BMS or keep an eye on it.
- Headroom: the input must be a couple of volts above the output.
Troubleshooting
- No output: the input under 5 V, or the chip in thermal shutdown.
- The voltage collapses under load: CC - the load wants more than IOUT; the CC LED is lit.
- The current limit does not work on a real board: OUT- and IN- are joined outside the board.
- FULL never lights: the current never falls under FULL % of IOUT - the load is not a battery, or FULL is too low.
- The part is not simulated:
TEPXL4015.DLLis missing from MODELS and from the project folder.
Limitations of the Simulation
- CV and CC, the shunt, the losses, dropout and the thermal shutdown follow the XL4015 datasheet and the board's circuit; the board is our own drawing.
- Our own figures: 0.06 ohm for the MOSFET, 20 ns of switching, 0.03 ohm for the inductor, 30 K/W for the chip on the board.
- Not modelled: the 180 kHz switching itself (averaged), the CC loop's own settling and overshoot, the output capacitor's transient.
- Arduino is a name of Arduino; this library is not made or endorsed by Arduino, Labcenter or the chip's maker.
- Tested in Proteus 8.5 in November 2026 (the demo as shipped). Proteus 7 is not supported.
So, that was all about the XL4015 CC CV Buck Converter Library for Proteus Simulation. I hope it helps you set up your next charger, LED driver or current-limited supply before a real battery or LED is on the line. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!