USB-C PD laboratory power supply - Page 1
Forum section: electronics / projects

author: MaTkEOxjC
author_rank: Contributor
timestamp: February 14, 2019, 12:53:27 am
content: USB-C PD is quite nice and will become more and more available. Some people have already played around with it. (e.g.https://hackaday.io/project/20424-pd-buddy-sink)Wouldn't this be an interesting basis for a minimalist laboratory power supply?* output voltage range could be dependent on PD profiles (design choice), 0-30V would probably be preferable (I'd like to include a usable 24V range)* dedicated port for power and usb controls* use a dc-dc converter followed by a linear regulator to smooth out the ripple* isolated design would be nice but increases complexity* implementing features in software (CC, CV, current trip...) would be niceAs target audience I'd expect EE students and similar people (I'm one myself in my masters study). So certification should not be needed (sell it as development), BOM cost should be less than 50€What are your thoughts about this?

author: David Hess
author_rank: Super Contributor
timestamp: February 15, 2019, 02:55:29 am
content: I was thinking about this the other day in connection with designing a smart charger for AA and AAA cells.Quote from: MaTkEOxjC on February 14, 2019, 12:53:27 amIf a switching converter is used, then the PD profile could set the maximum output power instead of voltage or current.QuoteThis is usually a waste of time if the switching regulator is designed for low noise unless fast transient response is required.QuoteI would not do it without isolation.

author: alex-sh
author_rank: Regular Contributor
timestamp: February 15, 2019, 11:22:46 am
content: @MaTkEOxjCI have this USB-PD Buddy sink, which I am using to charge my laptop on a go from a 28650mAh power bank.I have used it to power little projects, but there are a few drawbacks:- In order to change voltage, you have to enter DFU mode by rebooting the module.- Putty or other program has to be used- you cannot power the module and monitor parameters without PD Buddy WyeBasically, this has been designed to "set-up-and-forget-it".To have a proper PSU, it has to be completely designed in my view.Personally, I think unless you explicitly use USB-C PD (laptop? power bank?) to power the project, there is no benefit using it.Voltage cannot be more than 20V (Personally I'd rather have 24V max) or less than 5V and there are many other limitations.I have another small power supply on LM2577, which I can power from a battery, PSU, USB port and I see very little benefit developing anything based on USB-C PD. A good filtering is not a big deal - darlington pair, LC or Pi would do job very nicely.

author: MaTkEOxjC
author_rank: Contributor
timestamp: February 16, 2019, 12:31:40 am
content: Quote from: David Hess on February 15, 2019, 02:55:29 amHow would you suggest the isolation? At the moment I can only think about on the USB data lines or with an isolated ADC, both options are quite expensive. I need to get the voltage and current on the output. Two µC with isolation in between is kinda lazy.Or how are you doing the feedback at your charger?

author: David Hess
author_rank: Super Contributor
timestamp: February 16, 2019, 02:10:37 am
content: Quote from: MaTkEOxjC on February 16, 2019, 12:31:40 amWell, that is where it gets interesting. There are a number of transformer isolated switching regulator topologies which are suitable for a general purpose power supply. Most come down to following the transformer with a buck inductor and these might be considered a buck converter with an additional impedance conversion which allows a higher output voltage from a lower output voltage. They of course have the usual problem of having to support discontinuous conduction mode at low output currents unless synchronous rectification is used but some designs drive the synchronous rectifier across the isolation barrier so that is not completely infeasible. If you can come up with a suitable non-isolated design, then you can always add a transformer to it and get a free impedance transformation as well.Having a microcontroller on either side of the isolation barrier would not bother me at all but I think this depends on where the control circuits for the switching regulator are. I would tend to use one microcontroller to negotiate the USB PD and another for everything else because this allows for an integrated USB PD solution if it exists.If the switching control circuits are on the primary side, then the usual arrangement of optocoupled feedback is the usual control method.Higher performance will require a switching preregulator and linear output stage.QuoteI mean I would not do a power supply without USB to output isolation. For a battery charger, no isolation is needed unless it has a data output like serial or another USB port. I am not very happy with the user interface on my MH-C9000 smart charger so I occasionally consider how I would design something better from scratch and being about to use a USB PD source (or power over ethernet?) might be a nice feature.

author: bloguetronica
author_rank: Frequent Contributor
timestamp: February 16, 2019, 12:08:09 pm
content: Hi,If you use an isolated DC-DC converter, you can achieve isolation while also being independent on your USB input. Using a linear regulator after the DC-DC converter, plus a filter in the middle, is definitely a good idea. Your plan is doable. Go for it!Kind regards, Samuel Lourenço

author: EEVblog
author_rank: Unknown
timestamp: February 16, 2019, 12:14:10 pm
content: Quote from: David Hess on February 15, 2019, 02:55:29 amYep, agreed.

author: bloguetronica
author_rank: Frequent Contributor
timestamp: February 16, 2019, 12:51:09 pm
content: Quote from: MaTkEOxjC on February 16, 2019, 12:31:40 amHi,If you need isolation just for an ADC, you may want to consider a CP2130 to bridge the USB to SPI first. The SPI signals, being unidirectional, are a lot easier to isolate. You can then control an SPI controlled ADC via a digital isolator.Sorry for my late response. Didn't read that comment, so I had no idea of what you wanted to achieve. By the way, don't you need a DAC as well? How are you going to control your PSU?Kind regards, Samuel Lourenço

author: MaTkEOxjC
author_rank: Contributor
timestamp: February 16, 2019, 05:19:49 pm
content: Quote from: David Hess on February 16, 2019, 02:10:37 amI'll probably stick to something out of the book, at the moment I'm thinking about a flyback.Two microcontrollers:might be an option, but cost twice, I need software for both, two connectors (end user software update mechanism) or build some kind of isolated update from one µC via the other µC.One actually needs to perform USB communication and PD communication (primary) and forward control data it to the second (converter controller). Feedback has to go the opposite direction. This seems just overly complicated and the wrong idea.Microcontroller on primary and feedback via optocouplers:I need voltage and current. Isolated ADCs are pretty expensive. With optocouplers I need some kind of A-to-D conversion on the secondary side. Normal adc/dac and isolators might be an option.Microcontroller on secondary:Makes USB communication (controlls and firmware update) more difficult. USB isolators are pricey.Linear output stage:Should be doable, needs communication to USB.Quote from: David Hess on February 16, 2019, 02:10:37 amIf you're only using a wall adapter (which should be isolated by itself) it should not be a problem. But assuming some people will have the same device for USB controls and PD power (e.g. from a laptop) means both should probably be isolated, maybe also from each other.I thought about the option to connect multiple in series to increase the total voltage.Quote from: bloguetronica on February 16, 2019, 12:51:09 pmI still need some way to work with PD data, but there are also USB-PD to SPI ICs. Raises the difficulty with firmware updating again.Yep, I need probably two way communication, ADC for voltage/current, DAC for linear output stage.

author: bloguetronica
author_rank: Frequent Contributor
timestamp: February 16, 2019, 05:55:40 pm
content: Quote from: MaTkEOxjC on February 16, 2019, 05:19:49 pmWell, that was a war that I once fought and lost. I went looking for chips to do flyback isolated DC-DC modules/converters/designs, and the solutions commercially available didn't satisfied me. I went for a module that was readily available and worked as well as promised. If you don't need isolation, I'm sure there are plenty of chips out there. But, as I and others suggested, you should go for an isolated design (unless you are building a battery charger, exclusively, and that depends).Quote from: MaTkEOxjC on February 16, 2019, 05:19:49 pmWell, you don't need two micro-controllers. Actually, if you use the CP2130, you can get away with none. You don't need to upgrade the firmware unless you need to change the PID/VID or other descriptors. Anyway, the CP2130 provides an API, and if you use Linux, you can easily do away with libusb. You can always check my FAU200 or FAU201 projects to see how I've implemented some power supplies using this chip. They are isolated, by the way.P.S.: Added the schematics attached.Kind regards, Samuel Lourenço

author: MaTkEOxjC
author_rank: Contributor
timestamp: February 16, 2019, 06:58:28 pm
content: Quote from: bloguetronica on February 16, 2019, 05:55:40 pmWoops, I meant topology wise. I'll probably implement the regulator in software or at least partially in software. But I'm not going to invent another exotic topology (as one of my Professors at the University does xD) Currently reading "Leistungselektronik" (Power electronics) from Franz Zach, German book.Quote from: bloguetronica on February 16, 2019, 05:55:40 pmI really appreciate it. Took a look at your website and schematics, looks very nice!But I'm more of a hardware (and Linux) guy, so enabling the hardware for easy software updates (and more features) is something I'd really like, as design choice.Having the controlls on the board is probably the better choice because USB is not real time. If have a hardware that can measure output voltage and current, I can easily implement features as "trip current" or similar.

author: MaTkEOxjC
author_rank: Contributor
timestamp: February 16, 2019, 07:40:03 pm
content: Quick and dirty design mockupVoltage measurement after the DC/DC to adapt for the linear stage. Linear stage makes final filtering. Afterwards output voltage and current are measured.Errors:* Control data from micro to DC/DC on top is missing.* after the isolated 5v or 3.3v converter a LDO is probably a good choice, for better ADC/DAC performance* power to data isolator is missing

author: bloguetronica
author_rank: Frequent Contributor
timestamp: February 16, 2019, 07:53:07 pm
content: Quote from: MaTkEOxjC on February 16, 2019, 06:58:28 pmThanks! Yes, in that case, you don't want to be dependent on a software that runs on your host PC. You will definitely need local and realtime control, and that only can be implemented by the use of a micro-controller. Still, you can reduce that to one micro, that communicates with the USB via SPI. That micro would also read the voltages and provide local control. It would be located on the isolated side (if you wish to implement isolation).Kind regards, Samuel Lourenço

author: David Hess
author_rank: Super Contributor
timestamp: February 16, 2019, 09:03:39 pm
content: Quote from: MaTkEOxjC on February 16, 2019, 05:19:49 pmThe microcontroller which controls the output voltage and current is on the output side with the ADCs, reference, current shunt, and output connection. The linear optocoupler bridges the isolation barrier to control the switching controller on the input side. I would rather have two microcontrollers than have to bridge the isolation barrier with voltage and current measurements. Having the microcontrollers communicate over a separate isolated link for USB PD status and control is not costly.Quote from: MaTkEOxjC on February 16, 2019, 06:58:28 pmAt most I would rely on the microcontroller for detecting a fault in the analog control loops. Under normal conditions, I would generate analog voltage and current signals for the analog control loops to use and get feedback of actual voltage and current. Inserting the microcontroller into the control loop is a hazard, extra complexity, and potentially limits performance.

author: MaTkEOxjC
author_rank: Contributor
timestamp: February 16, 2019, 10:30:44 pm
content: Quote from: David Hess on February 16, 2019, 09:03:39 pmWhat's bad about bridging the voltage/current measurements? I thought about an ADC with SPI/I2C isolation.Two microcontrollers seems like it rises complexity and cost; flashing firmware via USB will be difficult, having two USB connectors is not really what I wish.I'd like to control over USB full speed, so isolating USB full speed is not really an option (cost wise). Isolating USB PD should not be a problem.Quote from: David Hess on February 16, 2019, 09:03:39 pmThat's actually quite a good safety related consideration.So I need some sort of analog mux, to either re-direct the analog signal from voltage or current measurement to the DC/DC controller.

author: David Hess
author_rank: Super Contributor
timestamp: February 18, 2019, 01:24:47 am
content: Quote from: MaTkEOxjC on February 16, 2019, 10:30:44 pmNo, only one analog control signal across the isolation barrier is required. Output voltage and current are monitored and feedback from both are combined before crossing the isolation barrier.

author: MaTkEOxjC
author_rank: Contributor
timestamp: February 18, 2019, 12:55:53 pm
content: Quote from: David Hess on February 18, 2019, 01:24:47 amAh, got it. I wasn't sure how to feed both back over the same channel (and giving user info about both values). Thanks!(image fromhttps://www.eetimes.com/document.asp?doc_id=1278790)So microcontroller on secondary would allow for direct measurement of V and I (just for user information) and the analog loop would not be compromised. Also using the microcontrollers DAC for setting the output V and I should be possible.The only thing that seems pricey is an ADUM3160 with 5-6€. Just the USB-PD controller needs to stay on primary, but this would only require an I2C isolator (~2€).Anyways, next step for me is to simulate, build and test the flyback circuit alone. Possibly at first without isolation.Adding the microcontroller should be possible afterwards. Just trying to separate the project into steps which make sense.