roberttidey / WifiPowerSupply

Lab power supply using esp8266 and XL4015 buck converter
7 stars 1 forks source link

Kudos - great work! Adoption for more powerful buck boards possible? #1

Open TobiasPSP opened 8 months ago

TobiasPSP commented 8 months ago

Since I did not find any other way of getting in touch, I am abusing the issues section. Robert, this is awesome, I am completely surprised to not see much more activity here. A programmable power supply is a hot topic for many years now, becoming even more interesting with the Li/LiFePo4 batteries and custom charging needs. I haven't yet seen a simple and affordable solution.

I just ordered the parts and in a weeks' time will start playing with your concept. Kudos, and thank you for sharing.

Have you by chance played with other common buck converters that may be able to output more power? I did work with XL4015 buck boards (and many other similar) yet the specs almost never worked. I remember some buck boards that claimed 5A but showed severe voltage breakdown at half that current. So while 2-3A would be fine for my current projects, I guess what people are looking for is a programmable DC source that is good for solid 6-10A.

Any chance your creative concept could be easily copied to a more potent buck board? Many thanks!

roberttidey commented 8 months ago

Hi,

Glad you like this project.

I have used this to supply 4A with no problems. I have not had any failures over several of these I have made I also use the same module in a car battery charger which supplies 4A over long periods without issues.

I do normally stick a little extra finned heat sink on top of the converter chip to help keep it cool and prevent its thermal cutout kicking in.

I haven't tried it with higher power converters myself. In principle the concept would work. The trick would be to find a converter where there is both adjustable output voltage AND current limit. Adjusting the connection from the DACS to suit would be simple. The voltage adjust will be available on all converters but not so many will have the current limits built in. One could add current limit circuitry oneself (e.g. with the current sensing feeding into the voltage adjustment but it makes it simpler if one can use a built in version.

I'll have a look to see if I can see a higher power converter that could be used.

Update:

A quick search showed this might be a suitable candidate.

https://www.ebay.co.uk/itm/314150985602?hash=item4924db9f82:g:mDgAAOSwfHViwrGZ&amdata=enc%3AAQAIAAAA4PRl3WJM0KGCIF9b9d%2FQSZdOpcZvEMAkgaywDKly4gJdN9%2FoyrDLZ2Q3WlpW5Fs3ZICrwJ5fb6ui1vXh4YmYgPe0Bw4K21RHNK6KoeFO2uhHZJjN3k%2F8eEgZ8BFiMy6HKyuK93UQLlibXFvaHG1XxTL15lVXJ2VwCgLFJ2o%2BfuwEBYi3sNeK968jsd5SLT%2F7JMiCaVIWP203mfVmsoynBWHUJBENXVA1qT%2FW8Po%2Bt4Ec%2F%2FK4VH4zViE9lkDbDw0eA3N8e7HTHrKuezCF48PhhmLOroUR9xPqmDFrWo63I482%7Ctkp%3ABk9SR_SMmrCkYw

I'll try to get some further details

Further update.

This is based on XL4016 converter (actually really rated at 8A) but very similar design so should be easy to use in this design with maybe some small adjustments to resistors around DACC ouputs.

TobiasPSP commented 8 months ago

Awesome, and great to hear from you. I can‘t wait for the ordered parts to arrive so I can start playing :-) how about this model: https://de.aliexpress.com/item/1005002473970246.html

it‘s rated 20A and is just around 4 bucks. Realistically it‘s probably a solud 8-10A. It does have two regulators for CC and CV.

roberttidey commented 8 months ago

That looks very similar and may well be XL4016 bases. Like you I would regard the 20A as a bit of Chinese exaggeration.

I am getting one of the standard XL4016 units to check out.

It is rated for up to 40V input so it could be used to give a wider range of outputs if one can find a suitable power adapter with say 32V output.

TobiasPSP commented 8 months ago

I expect the parts to arrive here in 7-10 days so then I'll start playing with the 5A power supply you originally used and find my way into your concept. If in the meantime you get your hands on one of these more powerful supplies, I'm looking forward to exchange our findings and eventually create an adaption.

The beauty of your original solution is that you leave the power supply intact: no soldering or messing around with its internal components. All you do is interface to the power supply via 4 wires at some easy-to-identify-and-connect-to points: three connectors (to the potentiometers), and GND.

So if it turns out that the more powerful supply can be adjusted similarly, I was wondering if we can't come up with a generic solution that simply has a 4-wire interface to any suitable power supply, plus a configurable approach (maybe some small potentiometers to adjust different resistor values if needed for adoption, and a simple and cheap voltmeter display to aid in adjusting).

If this project could turn out to be a general extension module for any power supply of the given architecture, then that would really be awesome, possibly even buck-boost in the future.

roberttidey commented 8 months ago

I have the 4016 (9A) module now and have also got its schematic.

The circuit is very similar to the 4015 and the existing controller can be used effectively unchanged. The connections into the converter to control it are the same but obviously in different physical places on the board.

The differences of the 4016 from the 4015 are : 1) Physically a bit larger with 2 proper heatsinks. Would need a bigger case but still quite small. 2) Current shunt for measuring the current and controlling the constant current mode is 10milliOhm rather than the 50milliOhm on the 4015 module. This reflects partly the higher max current on the 4016. 3) The voltage control is basically the same but the resistor value has been tweaked a bit to give a better range for the potentiometer.

I think the existing values from the DACs would work OK.

If one wanted to increase the voltage range using a higher input voltage e.g. 32V then one would need to change the mini buck converter used to provide the 5V/3.3V internal supply for the control electronics. The existing one is good for a 20V input.

TobiasPSP commented 8 months ago

Excellent news!

My ordered parts arrived, too, and today I am going to start rebuilding your original design. I already have the more powerful buck here, too, so if I succeed with the original setup I‘ll try and adopt it to the new buck as well.

To keep things simple and understandable for me, I‘d like to simplify the software for the ESP8266. Your software is awesome but resembles quite a complex design for a specific use case, including OTA, webserver and data files.

I‘d like to start with the bare essentials, and i.e. hard code the parameterizations for offset and slope, or possibly use one rotary encoder to enter some sort of config menu on button press.

Could you in short explain the fundamentals for offset snd slope parameters? From what I assume, offset is shifting whereas slope adjusts linearity?

Also, in your code I noticed that when there is no parameter file, the software reports that „default encoder values“ are used. Where are these defaults defined? Is this just for default initial CC and CV values?

The default parameter file seems to contain values different from the calibration variable default initialization values. Shouldn‘t the calibration variables default to the values found in the provided sample data file?

What would be a good way of turning power output off? Is there possibly an „enable“ pin on the regulator, or is it sufficient to set CC to 0mA? If all else fails, I would possibly add a mosfet to enable the ESP8266 to turn everything off (which would be great if the setup is used as charger rather than lab power supply).

Sorry for my basic questions, I am trying to wrap my head around your awesome approach and don’t want to do head into the wrong direction.

Many thanks for your great work, looking very much forward to now actually start playing with it!

roberttidey commented 8 months ago

Slope and Offset. When the software reads an adc value then it gets back the 16bit raw reading. This is converted into a real value volts or amps) by multiplying it by the relevant slope and then subtracting off the offset. This allows it to be tuned for accuracy taking into account the tolerance of the resistor values used to get the output voltage fed into the ADC and the value of the current shunt resistor. The same principle applies when generating the values sent to the DACs for controlling the voltage and current controls.

The values in the example file probably should be the same as the defaults in the code but I assumed that people would go through the calibration process anyway.

One could just use the code defaults rather than the config file but it makes the calibration a bit more tedious as one has to recompile and upload every time a change is needed.

There is no enable control on the buck converter. One can drive the output quite low. The converter tries to maintain 1.25V on its feedback pin. Without the external control the potentiometer sets the divider and therefore controls the output voltage. With the DAC output this supplies some of the feedback and therefore lowers the output required to get 1.25V. With the values used I can get the output down to 1.0V, I don't think using the current limit would work. This effectively sends extra feedback voltage in the same way as the voltage control.

If using as a charger then ione should put a schottky diode in series with the output. This protects the converter from the battery voltage (e.g. if the converter is powered down while still connected to the battery. With this then lowering the voltage below the terminal battery voltage would effectively reduce the charging current to zero.

In my 12V lead acid battery charger (in the repositories) which uses the same buck converter I use a schottky diode< The software does not actually drop the charging voltage as a low trickle current into lead acid batteries is benficial evem when fully charged

TobiasPSP commented 8 months ago

Good point re: reverse current protection :-) I just spent unexpected four hours sorting and reorganizing my supplies of DC-DC converters in preparation of this project. I am starting to see converters with different eyes now that we are tweaking them. Before, I did not really care about the controllers. That changed, and this morning, I took the time to identify the controllers and download their data sheets.

Fortunately, I did identify a number of XL4015 so I can get going. Unfortunately, in an effort to order a more powerful converter to play with, I ordered one that physically looks like yours, and has two potentiometers for adjusting voltage and current. When I identified the controller, though, it turns out to be a LM5116.

It is this one: https://de.aliexpress.com/item/1005004347152172.html

Any chance their architecture is similar? Is there something I can look out for? I am going to order some 4015, too, just to be safe.

roberttidey commented 8 months ago

The LM5116 chip is different. The voltage control side is very similar to the Xl4015/6 and could be controlled in the same way with a change in the resistor from the DAC to the feedback pin. The chip itself has inbuilt current monitoring which has a fixed threshold. I suspect the board is using the potentiometer to offset the values from the shunt into the current measuring inputs on the chip and if so then the existing constant current control method would work again with a change in values. It is difficult to be certain without seeing a schematic of the board or physically checking to see if there are resistors between the current shunt and the current monitoring inputs on the chip and how the current control potentiometer is wired to these.

TobiasPSP commented 8 months ago

I understand - they may potentially serve as a future challenge to test how much the concept can be tweaked 🙂 I‘ll focus on the 4015 for now. I did find a 4016 in my collection however that one has just CV and no CC.

roberttidey commented 8 months ago

If you can take a good photo of the rear of the LMS116 board then I may be able to figure out how it is wired.

It is particularly the area around the LM5116 chip itself and surrounding components that is of interest.

TobiasPSP commented 8 months ago

image image

TobiasPSP commented 8 months ago

I hope these pics are sufficient. I am currently building a light-box that hopefully produces better component pics.

TobiasPSP commented 8 months ago

image

TobiasPSP commented 8 months ago

In an effort to focus the schematics on the voltage injection part, I took your schematics from Instructables and removed everything that was not directly related. If you find the time, could you maybe have a look if there are any obvious mistakes? I'd use this to start actually putting things together ;-)

voltage injection fundamentals

roberttidey commented 8 months ago

Diagram looks OK.

On the LM4115 board:

It looks to me like it does not use the LM5116 internal current control circuit but instead uses an external circuit similar to the XL4015/6 which works by feeding into the voltage feedback circuit.

There is a 5 pin ic which doesn't have any markings that I can make out but is probably an op-amp and I suspect its output is going through the schottky diode near it and then probably feeding into the FB (feedback network. If so then it can be probably controlled in the same way as the XL4015. If there is any marking on the IC that hasn't come out then it would be good to have that to confirm the connection.

TobiasPSP commented 8 months ago

I am progressing slowly as I am trying to fully understand and document all steps as part of the learning experience: https://github.com/TobiasPSP/electronics101/tree/main/projects/programmableBuck/voltageInjection

I came across a few questions I couldn't answer myself, maybe you can point me into the right direction:

Many thanks, it's a really exciting learning experience thanks to you and your kind share at instructables :-)

roberttidey commented 8 months ago

I used the differential input for measurement particularly because the voltage across the shunt is quite small and I wanted to avoid errors creeping end due to any small ground differences. One could use single ended if one takes care to avoid these by making sure the connections to the ground points don't introduce offsets.

I'm not sure what you mean by the 0V reference for the current adjustment. The current adjustment potentiometer has a fairly small voltage across it to provide the comparison voltage for the op amp comparison. To control it I use the 470R from the DAC and the 47R tap to 0V. This means the voltage from the across the 47R has a 0 - 300mv range. The tap also means this control voltage has a low source resistance to allow it to override the potentiometer.

TobiasPSP commented 6 months ago

I just wanted to ping back: I spent the remaining weeks and months setting up the website done.land because I felt I needed to organize myself better before I start with the digitally controllable buck converter.

The website now starts to become really functional, and since it is driven off a github repo, it's really simply to collaborate. Should you ever want to publish your own article or content, I' be thrilled. Just let me know.

That said, I am optimistic that I am soon finally be able to dive into your schematics and the buck - all parts arrived meanwhile. Thanks so much for your help!