Elektor January/February 2026 (Extract)

Page 1


Volume 52, No. 543

January & February 2026

ISSN 1757-0875

Elektor Magazine is published 8 times a year by Elektor International Media b.v. PO Box 11, 6114 ZG Susteren, The Netherlands Phone: +31 46 4389444 www.elektor.com | www.elektormagazine.com

Content Director: C. J. Abate

Editor-in-Chief: Jens Nickel

For all your questions service@elektor.com

Subscription rates: Starting December 1, 2025, the print membership (Gold) will cost €144.95 per year for a one-year subscription. The digital membership (Green) will be €99.95 for a one-year subscription and €169.95 for a two-year subscription.

Become a Member www.elektormagazine.com/membership

Advertising & Sponsoring

Büsra Kas

Tel. +49 (0)241 95509178 busra.kas@elektor.com www.elektormagazine.com/advertising

Copyright and Liability Notice

© Elektor International Media b.v. 2026

The circuits described in this magazine are for domestic and educational use only. All drawings, photographs, printed circuit board layouts, programmed integrated circuits, digital data carriers, and article texts published in our books and magazines (other than third-party advertisements) are copyright Elektor International Media b.v. and may not be reproduced or transmitted in any form or by any means, including photocopying, scanning and recording, in whole or in part without prior written permission from the Publisher. Such written permission must also be obtained before any part of this publication is stored in a retrieval system of any nature. Patent protection may exist in respect of circuits, devices, components etc. described in this magazine. The Publisher does not accept responsibility for failing to identify such patent(s) or other protection. The Publisher disclaims any responsibility for the safe and proper function of reader-assembled projects based upon or from schematics, descriptions or information published in or in relation with Elektor magazine. For our full terms and conditions, please refer to our website.

Print

Senefelder Misset, Mercuriusstraat 35, 7006 RK Doetinchem, The Netherlands

Jens Nickel

International Editor-in-Chief, Elektor Magazine

Battery Zoo

When I started at Elektor in 2005, I quickly got to know Thomas Scherer, one of our most regular authors. Thomas had the honor of being an Elektor editor in the golden era of electronics, the 80s, before most of the young technics nerds started programming computers instead of tinkering with components. So Thomas knew a lot more than I did (and still does, I am afraid); his specialty was LEDs and lighting, as well as power supplies and batteries. Throughout the years, Thomas reported extensively about different battery technologies, amongst them very promising ones, working in science labs. Now, in 2026, Thomas is my natural choice to write an article about different (lithium) battery types and their pros and cons (page 20). However, we both have to state, that there weren’t many sensational shifts in the last few years. For lithium

batteries, the NMC cells have still the best specs you can find on the market, and they have to be handled with care, so to say. In a webinar, Thomas warned me and the others to regularly charge these, to prevent very bad consequences. The next week, I made a list of all power banks and in-built NMC-batteries I have in my household. As I do a lot of tinkering with mobile equipment, I identified more than 60 (!), so I carefully numbered them.

In this edition, we have of course much more to offer, beginning with the ingenious low-noise power supply (page 6) from my colleague Ton Giesberts, who also started long before me at Elektor. Other quite interesting projects include a very power-saving sensor node, an adjustable and flexible DC load, a grid frequency meter, and much more! <

BU ZZZ Around ........

“Power tech is back in Europe. Vulcan Energy’s renewable lithium for EVs, ICECAP thermoelectrics, and BTRY batteries show promise, facing the challenge of scale.”

Udo Bormann — Marketing Manager

“Good power design goes beyond components and simulations. It comes down to precise, well-documented engineering decisions.”

Vieira

“Power and energy tech will advance fast via smarter power electronics, AI optimization and scalable renewables.”

C. J. Abate — Content Director

Gerstendorf

Saad Imtiaz, Alina Neacsu, Dr. Thomas Scherer, Jörg Starkmuth, Clemens Valens, Brian Tristam Williams | Regular Contributors: David Ashton, Stuart Cording, Tam Hanna, Ilse Joostens, Prof. Dr. Martin Ossmann, Alfred Rosenkränzer | Graphic Design & Prepress: Harmen Heida, Sylvia Sopamena, Patrick Wielders | Publisher: Erik Jansen | Technical Questions: editor@elektor.com

International Editor-in-Chief: Jens Nickel | Content Director: C. J. Abate | International Editorial Staff: Hans Adams, Asma Adhimi, Roberto Armani, Eric Bogers, Rolf
(RG), Ton Giesberts,
The Team

Low-Noise Lab Power Supply (1)

A Quiet Source for Sensitive Circuits

Sensor Node v2.0 (2)

Validation and Power Optimizations

Graphical Grid Frequency Meter

Grid Quality 68 Adjustable USB-C Power Source Turn Your USB-C Charger Into an Adjustable Power Supply

Simple Charger and Capacity Tester With Two Cheap “Off-the-Shelf” Modules

Smart Color Detector with AI Voice and Playback

PbMonitor v2.0 Introduction to the Updated Battery Monitoring System

Precision Picoammeter (2) Assembling, Calibration, and Test 110 Sound Card as Signal Generator PC as DCF77 Test Transmitter

Adjustable USB-C Power Source Turn Your USB-C Charger Into a Power Supply

Adjustable Electronic Load Static +

DC Load 26

18 STM32 Edge AI Contest 2025 The Winners

52 Peak Current Load SMD Ferrites More Resilient Against Current Peaks

60 Energy Harvesting Set to Accelerate IoT and IIoT Use Cases How Energy Harvesting Frees IoT from the Grid

BONUS CONTENT

Check out the free Power & Energy bonus edition of Elektor Mag!

> Voltage Monitoring With a Microcontroller

> Solar Energy for Electronics

> Wiring and Calibration of a 10-µA High-Side Current Sensor

> Infographics: Power and Energy

www.elektormagazine.com/ power-energy

Next Editions

Elektor Magazine March & April 2026

As usual, we’ll have an exciting mix of projects, circuits, fundamentals, and tips and tricks for electronics engineers and makers. Our focus will be on Embedded & AI.

> Scrutiny: Open-Source Debugging Tool

> BLEnky: Bluetooth Low Energy Made Easy

> Programming: AI creates a Library

> Generating Signals with RP2040 PIO

> Hey, Elektor: AI Voice Recognition

> Counting Faces with a MaixCam

> Symmetrical DC load

> Audio Transceiver Board: Tuning Clocks

Elektor Magazine’s March & April 2026 edition will be published around March 11, 2026

Arrival of printed copies for Elektor Gold members is subject to transport.

Low-Noise Lab Power Supply (1)

A Quiet Source for Sensitive Circuits

This fully analog, adjustable, medium-power symmetrical power supply contains no switching or digital components. It provides an output voltage adjustable between 0 V and ±22 V, and an output current adjustable from 0 A to 1 A. Because it avoids any form of switching circuitry, the design delivers extremely low noise. To display both output voltages and currents, four miniature moving-coil panel meters are used.

Most modern laboratory power supplies and AC adapters employ switch-mode techniques. Even the best examples inevitably exhibit high-frequency ripple and other switching artefacts on their output, which can interfere with the testing of sensitive analogue circuits and disturb low-level measurements. To overcome this, the concept here is a completely analogue power supply. Although less efficient than its switch-mode counterparts, the reduced efficiency is of little importance for test-bench use and ensures cleaner, more reliable measurement results.

Because many analogue circuits require a symmetrical supply, this design delivers positive and negative output voltages of equal magnitude. A small amount of adjustment is available to compensate for any imbalance. Naturally, a variable current-limit function is also included.

Analog Meters

To maintain a completely analogue concept, four miniature moving-coil meters display output voltages and currents ( Figure 1 ). Although their accuracy and resolution are limited, their advantage is that they do not require an auxiliary power supply. Each current meter is placed inside the regulator’s feedback loop, so its internal resistance does not affect the output voltage.

Three Transformers

To minimise heatsink size, the PSU’s input voltage should ideally track the output voltage. Taking into account voltage drops across rectifiers, filter inductors, fuses, ripple on the smoothing capacitors, and regulator dropout,

Figure 1: Old-school moving-coil panel meters do not require an auxiliary power supply and do not contribute any noise.

the input must be at least 3.5 V higher than the output. Only a switch-mode solution could achieve this efficiently — but that would defeat the object of the design.

A more practical analogue alternative is to use a power transformer with several secondary voltages and switch to a higher voltage when required. Two secondary windings are the minimum; three are better, significantly reducing the heat-sink size. Using separate heatsinks for each output stage further improves cooling and simplifies construction.

Instead of a single transformer with six secondary windings that would be hard to

find, three identical encapsulated toroidal transformers are used. They are mounted on a dedicated board that also carries the relay circuitry for switching the appropriate secondary voltage. This modular approach simplifies construction and allows the transformer board to be located separately from the main PSU board.

An overview of the complete low-noise power supply is shown in Figure 2. As you can see, the PSU is built around three separate circuit boards: a mains filter board, a transformer board, and a voltage regulator board. We’ll begin our detailed walkthrough in the upperright corner — with the mains filter.

The Mains Filter

Mains voltage carries a wide range of noise and interference. For a low-noise power supply, it must therefore be carefully filtered. In most cases, common-mode interference is more severe than differential-mode noise, the latter of which can often be removed with a simple RC or LC low-pass filter. To enhance common-mode noise suppression, this design employs two common-mode chokes instead of one.

The circuit is conventional, see Figure 3 . Capacitors C3…C6, which connect the mains lines to earth, are Y-type capacitors. Capacitors C1 and C2, connected across the live

Figure 2: High-level overview of the low-noise power supply.

Batteries Today

Technology and Differences in Lithium Batteries

Lithium batteries power everything from smartphones to electric cars, but not all chemistries are created equal. Discover how today’s battery technologies differ — and which innovations are set to reshape energy storage in the near future.

Batteries are indispensable in the technological development of humanity. Without them, there would be no mobile availability of electrical energy. Not only for smartphones and laptops, but especially for electric cars and solar storage units, batteries are critical components on which capacity, weight, volume, stability, and price depend. Enough reason to highlight them in Elektor.

Batteries also undergo, fortunately, the changes of time and have become ever better through technical development. Everyone has them, and in every household, they appear in surprisingly high numbers. Even in my single-family house, the number of devices with batteries is remarkable. Telephones: 4, smartphones: 3, smartwatches: 2, remote controls: 8, smoke detectors: 5, flashlights: 5, radiator thermostats: 10, and measuring devices: 7. In addition, there are two e-bikes, an e-scooter, as well as the ordinary lead battery of the

car, which perhaps may soon be fully electrified alongside the acquisition of a solar storage unit. There is also a supply of button, AA, and AAA cells. A wild mix of well over fifty batteries of different types, as is common in most modern households. Nothing works without batteries nowadays. Elektor has also dealt with this topic several times. The first Elektor article on lithium batteries [1] is already more than 40 years old!

Terminology and History

As is well known, everything began with a frog whose muscles twitched when in contact with different metals, as Luigi Galvani discovered in 1780 [2]. He had thus unknowingly constructed the first “galvanic cell,” as Alessandro Volta discovered in 1792 when he heard about Galvani’s experiments. He recognized that this was (contact) electricity. This marked the birth of the so-called primary cell, which generates electrical energy through chemical

processes. Just eight years later, he built the so-called Voltaic Pile — a stack of copper and zinc plates with a porous material in between, soaked with a liquid electrolyte (Figure 1). The multiple repetition in the stack (to form a battery, in the original sense of the word) was, as it still is today, for increasing the voltage. These early scientists were immortalized terminologically through Galvanism (the study of the conversion of chemical energy into electrical energy) and the Volt as the unit of electrical voltage in the history of technology.

It did not take long until Johann Wilhelm Ritter invented a rechargeable form in 1803, thereby creating the so-called secondary cell. After another 50 years, Wilhelm Josef Sinsteden invented the lead-acid battery. Not long after, such batteries became fundamental as “central batteries” in telephone exchanges for operating the first telephone networks. By around 1900, there were already a number of early electric cars based

Figure 1: Historical Voltaic Pile (Source: Luigi Chiesa, CC BY-SA 3.0 [7]).

on large and heavy lead batteries (Figure 2), which is why internal combustion engines prevailed for over 100 more years.

Because of history, scientifically oriented technicians speak of primary cells when they are not rechargeable and consume or chemically alter their materials to the point of cell uselessness while generating electricity. They speak of secondary cells when the cell is constructed so that the chemical changes are electrically reversible, meaning the cells can be recharged. In addition, there is a usage that distinguishes between accumulators (from Latin accumulare = to collect) and batteries, although the latter term derives from French battre = to beat, and as batterie originally referred to a series of ready-for-action cannons, and in the transferred sense, simply a series. However, this is not a true contradiction, since all cell types can be connected “in series.”

In English-speaking countries, the term “battery” is usually used indiscriminately when several cells connected in series or even individual cells are meant. Incidentally, the term is still used in a military context for cannons. There is no distinction made between primary or secondary cells. In the course of ongoing internationalization, this broad term has spread over the last decades, and so even in Germany, people now almost exclusively speak of “batteries.” This has always been the case for car batteries; today, still, 90% lead-acid batteries. The terminology is similar in the Netherlands. Even in France, where there is a distinction between pile (small battery) and batterie (large battery), this process of generalization seems unstoppable. Since there is only a single circuit symbol anyway (Figure 3), the following will generally refer to batteries.

Criteria

The different types of batteries differ mainly in the chemistry used (i.e., the different materials for the electrodes and the electrolyte). Details of the internal construction and the design also play a role. Different properties are prioritized for different applications. For small mobile

devices like remote controls, primary cells such as the earlier zinc-carbon and today’s alkaline-manganese types are usually used. These “disposable items” are, aside from the ecological aspect, largely unproblematic and will not be further discussed in this article. The following focuses primarily on secondary cells, with an emphasis on lithium batteries due to their importance.

For smart, mobile devices, due to the relatively high energy consumption caused by their microcontroller, small size (or more precisely: the energy/volume ratio, the so-called volumetric energy density in Wh/l) is the decisive factor, so that a single

battery charge lasts through the day. This property is also important for electrically powered vehicles, since, for example, electric cars with energy reserves from 20 to over 100 kWh would otherwise have to transport a lot of built-in space that would not be available for passengers or the trunk. However, for electric cars, other criteria are also relevant: foremost is stability, understood as the number of charging cycles until a defined energy storage capacity (usually 80 or 75% of the new value) is reached. Also noteworthy is the ratio of energy to weight, the so-called gravimetric energy density in kg/l. A Tesla Model Y, weighing about 2 t including a 100-kWh battery made up of almost 5,000 individual cells, is heavier than the old Lohner-Porsche with its 24-kWh lead-acid battery. The battery here makes up about 1/3 of the total weight, and the weight determines, among other things, features like acceleration performance and energy consumption during operation. Last but not least, cost also plays a huge role, since the lithium currently required for all electric car batteries is expensive and accounts for the lion’s share of the additional costs compared to comparable combustion engine cars. Fast-charging capability is also a crucial marketing point. This is quite understandable, as it makes a practical difference whether you need only 10 or a lengthy 45 minutes to recharge after 300 km to continue your trip. For comparison: the Lohner-Porsche needed several days to charge, providing a range of 50 km.

Figure 2: The 1.8 t Lohner-Porsche, powered by four hub motors with 1.5 kW each, from 1900. On the left, next to the driver, is Ferdinand Porsche.
Figure 3: One for all. Electronics knows only a single circuit symbol for primary or secondary cells, symbolizing the polarity of the electrodes with lines of different lengths.

Adjustable Electronic Load

Static + Dynamic DC Load

The advantages of using an adjustable DC load for power supply testing are clear: There is no need to work with a collection of different load resistors, as the desired load current can be conveniently set. If the load also offers the capability of adjustable, rapid load transients, it becomes possible to test the source’s dynamic response as well.

For dynamic capabilities, an electronic load must at least be able to switch back and forth between two adjustable values. For this, the circuit needs to contain a kind of function generator. This is quite a bit of electronic effort, which you might want to avoid if you only need such features a few times a year.

You can easily reduce this effort by using a function generator — something every electronics enthusiast who works with audio signals or other analog electronics already has — to make the current flow dynamic. The load then only needs a control input, and its circuitry is greatly simplified. In addition, an external function generator offers another advantage: it usually provides not only square waves at the output, but also sine and triangular waveforms, allowing for additional measurement possibilities. A function generator used for this is perfectly suited if the lower and upper voltage values (and thus the current) can be set independently. Otherwise, these values can also be calculated from the amplitude and offset of the generated signal.

Principle

Based on these considerations, the circuit complexity is kept within limits. Figure 1 shows the block diagram. A 5-V voltage regulator acts as a reference voltage source for the static current setting via potentiometer. A relay switches between the static value of the potentiometer and the input for the function generator. The following Bessel filter limits the rise and fall time of the control generator signal to reasonable values. Its output signal controls the output stage, the controllable current source.

This project features two of these output stages, which can also be connected in parallel to double the current. Each is rated for 5 A, providing a maximum current of 10 A in total. If 5 A or less is sufficient, equipping just one output stage is enough.

The output stages are designed as voltage-controlled current sources, which sense the flowing current as a voltage drop across a shunt resistor. The voltage drop is then amplified tenfold and supplied to the control circuit as the actual value. At the measurement output, the current from both output stages appears as a voltage, which can be viewed with an oscilloscope.

Circuit

Figure 2 shows the implementation of the block diagram with actual connected components. The 5-V reference voltage comes from the integrated voltage regulator IC7. With P2 (plus R2), the maximum voltage of the potentiometer connected to K4 is set. A multi-turn potentiometer simplifies calibration of the static current. Since the output stages are designed for 500 mV/A control, a load current of 5 A should result in a maximum voltage of 2.5 V across R4. This means that the external function generator should be able to deliver a peak voltage of at least 2.5 V to a 50 Ω load, as it is loaded here by R3 for impedance matching.

Figure 1: The block diagram of the electronic load.

Figure 2: Due to the external function generator, the actual circuit of the electronic load is not particularly complex.

Graphical Grid Frequency Meter

Monitor Grid Quality

Not only since the total power outage on the Iberian Peninsula last spring has the quality of electrical power supply come into the public eye. The grid frequency is a good indicator of the balance between the energy fed into a power grid and the energy demanded. This measuring device displays the course of the grid frequency and disturbance events over max 24 hours on an e-paper display.

Grid frequency and grid voltage are important indicators for the load on an interconnected grid. Within such a grid, the frequency and phase of the generating components must be exactly the same. If deviations occur, the generators start to “work against each other,” which in extreme cases can lead to severe damage or failure of the grid or parts of it. This highly dynamic system of many generators and millions of consumers must therefore be constantly monitored and kept in balance.

Due to increased and decentralized feeding in of renewable wind and solar energy, this task has become significantly more complicated and harder to balance. This is particularly noticeable on Sundays and public holidays with changing wind and solar conditions. Although — or precisely because — the grid load is lower due to less industrial electricity consumption, and rapidly changing weather conditions cause alternating surpluses or shortages of electricity, the frequency keepers struggle to maintain balance. The fluctuations are now bringing the grid to the limits of the set tolerances more often than in the past, when primarily continuous generators like hydro, coal, and nuclear power fed into the grid.

Since the beginning of the major solar and balcony power plant boom, the volatility of grid frequency has visibly changed. I was able to follow the major blackout in parts of Spain and Portugal on April 28, 2025, so to speak, “live.” As Figure 1 shows, the grid load increased sharply at 12:33 pm, and the grid frequency fell by 0.3%, with values of ±0.4% already considered critical. Long-term, larger fluctuations, as Figure 2 shows, occur more frequently and are quite unproblematic.

Figure 1: Start of the blackout in Spain, viewed with a resolution of 5 s (a) or 1 s (b).
Figure 2: Frequently occurring long-term fluctuations, here from March 20, 2025.

No matter whether you track the frequency of the European interconnected grid at an outlet in Germany, France, or Italy, the curve progression will be the same at any given time. This means you can follow live anywhere in the grid how the grid quality is currently doing. A small note: There are also independent sections of the European interconnected grid that are decoupled by DC conversion and have their own phase positions.

Grid Frequency Meter With Pico and E-Paper

After a simple LED bar for monitoring grid frequency in Elektor 01/2012 [1] and an extended version in Elektor 05/2014 [2] for continuous frequency recording on a PC, here comes a standalone device for continuous grid frequency monitoring. The idea came about when the first inexpensive e-paper displays with fast image build-up and higher resolution came onto the market. These displays offer excellent contrast, use little power, and retain their display even after a power outage. If the installed storage capacitor to bridge power failures runs empty, the frequency curve remains visible.

An initial version of the grid frequency meter was built with an ATmega1284 in a DIP40 package, which is the only member of the ATmega series that offers 16 KBytes of SRAM, enough to buffer display and frequency data. However, a recording loop of 24 hours has only been possible since the project switched to the Raspberry Pi Pico with 264 KBytes of SRAM.

My observation of the grid frequency has been running continuously since August 2019, with the display handling the second-by-second updates well. Compared to an unused sample, the display has only become a little grayer.

The Display Content

The curve in the display area (Figure 3) represents the grid load in a way that is easy and intuitive to grasp. Values above the center line mean a high load and values below mean a low load. Or the other way around, the upper half shows the (too) low frequency and the lower half the (too) high frequency.

The course of the grid frequency is almost never smooth and constantly oscillates around the ideal value of 50 Hz. In a 50-Hz grid, a deviation of ±0.1% can be considered normal (tolerable); only above ±0.4% does it become critical. If a constantly smooth frequency curve exactly at the ideal value on the center line is ever displayed, you probably have a PV system with battery storage currently running in emergency mode.

1. Time Base and Time Range of the Display Area.

The time bases can be switched by pressing and holding the buttons.

Table 2: Time Bases and Display Ranges. Time Bases

2. Error Counter

These are displayed as needed for missing, abnormal, or faulty half-waves. The causes of disturbances can be switching operations in power plants and substations, as well as large consumers, though these are rather rare. Much more frequent are local deformations of the voltage curve in the household grid. Switched-mode power supplies, inverters, switching on and off large loads cause spikes that disrupt grid frequency measurement and can trigger the error counter. These events are counted and shown as vertical lines over time (see Figure 4). As error events gradually drop out of the buffer, the counters are reduced; once they are back to zero, they are no longer displayed.

If such disturbances occur more or less frequently or in clusters, it seems advisable to look for the cause. The author’s household banned a cheap Chinese inverter and a simply, brutally regulated electric blanket because they caused massive grid disturbances and made meaningful grid frequency measurement impossible. However, the laser printer, which is only occasionally used, was allowed to stay, even though switching its heating element on and off also caused disturbances. In older house installations, loose screw and clamp contacts in distribution boards may also become noticeable by increased error rates when under load.

Table 1: Grid Frequency at High, Balanced, and Low Load.
The display elements marked with green dots in Figure 3 mean:
Figure 3: Display content and controls.
Figure 4: An error event is indicated by a vertical line.

Adjustable USB-C Power Source

Turn Your USB-C Charger Into an Adjustable Power Supply

Unlike legacy versions, the USB-C standard has introduced significant improvements, with an intelligent voltage and current management protocol and a significant increase in maximum transferable power. This design allows you to control a latestgeneration USB-C charger and use it as an adjustable power supply. Let’s see how.

USB-C chargers are becoming the standard today. USB Type-C is a universal charging and data transfer standard that has become widely adopted. The chargers support high power delivery — up to 100 W — thus being able to charge phones, tablets, and laptops.

The standard [1] describes the USB Power Delivery  (PD) protocol that allows USB-C devices to negotiate power requirements and ensure flexible and efficient charging. A former article in Elektor [2] described an early version of a PD Sink Controller with which one could make a USB-C charger deliver several discrete voltages.

According to the latest standard, a USB charger can deliver any voltage between certain limits. In this article, a circuit with one of the latest PD Sink Controllers is described

that — together with a USB-C charger — can work as an adjustable power supply.

Background

The standard describes four different PDOs (Power Delivery Object):

> Fixed PDO

> PPS (Programmable Power Supply) PDO

> Fixed EPR (Expanded Power Range) PDO

> AVS (Adjustable Voltage Supply) EPR PDO

Regular PDOs may deliver voltages up to 20 V. EPR PDOs can deliver voltages in a range of 15…40 V. Currently, USB-C chargers for delivering more than 20 V are not very common. Therefore, the circuit presented here operates only with fixed and programmable PDOs.

A PD sink controller communicates with the USB-C charger for programming the wanted output voltage and current limit. After conducting market research, I found an advanced IC capable of performing that function and communicating effectively according to this latest protocol. It is the AP33772S, a USB PD3.1 EPR Sink Controller by Diodes Incorporated, which has an I2C interface [3][4]. In my design, this chip is controlled by a user via a small microcontroller with attached rotary encoder.

Circuit

The schematic of the Adjustable USB-C Power is illustrated in Figure 1. The circuit is following the guideline suggested by the manufacturer of the AP33772S, except that only one MOSFET is used in this design. Here, the current is flowing only in one direction, current limitation is performed by turning off the MOSFET. The AP33772S is set up via the I2C bus. A PIC18F04Q40 by Microchip takes care of this. A rotary encoder allows for user input, and a small I2C-controlled OLED display is provided to show setup or output values.

The output voltage shown on the display is obtained by measuring it with the internal A/D converter of the microcontroller. This is done by sampling the voltage from the divider network made by the precision resistors R11

Figure 1: Schematic diagram of the Adjustable USB Power Source.

and R12, set to 1/8 of the circuit’s output voltage. This allows not exceeding 5 V at the A/D converter input of U2. Furthermore, in the digital world, the division ratio of 1/8 is ideal, since division or multiplication by a factor of eight requires only shifting a binary number by three positions.

The current is measured by the PD controller, through the shunt resistor R5 (5 mΩ), and read by the processor via the I2C bus. R6 (0 Ω in this design) has to match the release of U1; for the former generations of this chip, it should be 100 Ω. You can just check that on the datasheet [4]. R7 is the VOUT resistor of U1 for sensing the output voltage at the source of Q1, the series MOSFET switch.

D2 indicates the actual status of the EPR sink controller (Table 1). The presence of output voltage is indicated by the green LED D3.

Table 1: LED Pin of AP33772S.

State LED Indication VOUT Comments

INIT N/A OFF VBUS attached and AP33772S initialization

CHARGING 4-seconds Breathing ON Successful negotiation or entering of Non-PD Mode; charging start MISMATCH Full Light OFF VSELMIN mismatch (VREQ < VSELMIN)

MOISTURE 2-seconds Flicker OFF Abnormal impedance detected

FAULT 0.6-seconds Flicker OFF OVP, OCP, UVP or OTP occurs

Power Supply

As long as the 5.1 kΩ resistors (R1 and R2) are present at lines CC1 and CC2, a USB-C charger will deliver 5 V at start-up, so that the controller chip can operate. The presence of input voltage will be indicated by the blue LED D1. From the datasheet of AP33772S, one can see that this IC has an LDO regulator on board that will deliver 5 V with a maximum current of 30 mA. The processor and the display module absorb a current that’s just around 5 mA, so it can be supplied from here without problems. Even when the output voltage of the charger is adjusted as low as 3.3 V — the minimum supply voltage of the display — everything will still work properly.

J2 is the ICSP connector for programming the PIC. It is combined with J3 on the PCB, since either one or the other has to be used. In fact, J3 is bridged during normal operation of the circuit to supply the microcontroller U2. Note that jumper J3 must be disconnected during programming of U2, since U1 might not deliver sufficient current during this process.

Hardware

Figure 2 shows both sides of the PCB carrying the circuit. Besides the programming

connector, the display, and the encoder, all parts are SMDs. The USB-C connector and the AP33772S IC have to be soldered either in an oven or on a hot plate. In my case, the latter was used. The board fits in a small, low-cost RL6105 Hammond enclosure.

Firmware

The firmware, written in assembler, is simple, and available for downloading at [5], along with the Gerber files for the PCB. After setting up the ports, some timers, two logic cells, and three interrupts are enabled. The main program loop consists only of NOPs.

The first interrupt senses the rotation of the encoder. The second is asserted if the switch is pressed during a short or a longer (2 s) period, and the third is once per second activated by a timer. The latter is only active when the output is active. It reads and displays output voltage and current.

Operation

At power up, the PD controller reads all possible PDOs of the charger. Those of a typical USB-C charger are shown in Figure 3. At start-up or after a reset, the first PDO is active. This is for compatibility with the legacy USB chargers.

Turning the encoder knob shows all PDOs in sequence. The first three are fixed PDOs (first three screenshots in Figure 3). The last two are programmable; one of them is shown at the bottom right in the same picture. The option to program a voltage is shown as a voltage range on the display.

Component List

Resistors

(0805, unless differently noted)

R1, R2 = 5.1 kΩ

R3 = 10 kΩ

R4, R8, R9 = 100 kΩ (1206)

R5 = 5 mΩ (1206)

R6 = 0 Ω (see text)

R7 = 100 Ω

R10 = 10 kΩ NTC

R11 = 9.1 kΩ, 1%

R12 = 1.3 kΩ, 1%

R13 = 1 kΩ

Capacitors

(0805, unless differently noted)

C1, C3 = 10 µF (1206)

C2, C4 = 100 nF (1206)

C5 = 1 µF

C6…C8 = 100 nF

C9 = 10 nF

C10…C12 = 1 nF

Semiconductors

U1 = AP33772SDKZ

U2 = PIC18F04Q40-SL

U3 = OLED display 0.91”

Q1 = SI4164DI N-Ch. MOSFET

D1 = LED blue (1206)

D2 = LED red (0805)

D3 = LED green (1206)

Miscellaneous

SW1 = Rotary encoder with switch

J1 = USB-C connector

J2 = Header, 6 pin

J3 = Jumper

Banana socket, red, panel mount

Banana socket, blue, panel mount

Case (Hammond RL6105)

Knob

PCB

Figure 2: The populated PCB with the LCD mounted on the rear side.
Figure 3: Different PDO examples — fixed ones and adjustable (bottom right).

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.