Close

Linearized output

A project log for Low-Cost Programmable Power Supply

Chinese "LM2596 DC/DC buck converter with voltmeter" + "some wires" + "Forth" = "programmable power supply"

thomasThomas 03/26/2017 at 08:580 Comments

With the interpolation routine from the last log entry linearizing the DCDC converter output is simple. It doesn't really matter how the function looks like: the grid point density can be adjusted to match the second derivative. In a first example, I simply used a voltmeter and the interactive Forth console to map PMW values to the output voltage. It turned out that between 0 and 1V the function is less smooth, and I inserted an extra grid point. Also, below 20mV I couldn't reliably control the output voltage (after all, a bias to the feedback ground of an LM2596 is a hack :-) ), so I set the last grid point to 469/20mV.

I decided to represent the voltage in units of mV, and created the following table with 14 grid points:

FILE NVM
CREATE vptab
14 ,
469 20 , , 451 500 , , 434 1010 , , 401 2000 , ,
367 3010 , , 333 3990 , , 297 5010 , , 261 5990 , ,
222 7010 , , 183 7990 , , 141 8990 , , 97 9990 , ,
50 11000 , , 0 12000 , ,
RAM HAND

The mapping of output voltage to PWM is simple:

FILE NVM
: mV vptab @inter pwm ;
RAM HAND

By typing eg. 7500 mV I get an output voltage of 7.53V, which is more accurate than I had ever expected. I observed some drift, but as there is nothing like reference voltage source, what can you expect?

Here are more examples:

5000 mV -> 5.02V
3700 mV -> 3.73V
3300 mV -> 3.35V
2800 mV -> 2.83V

Through the saturation feature of @inter the following works, too:

15000 mV -> 12.00V
-10000 mV -> 0.03V

Once more: level up!

Discussions