control DC-DC converter with PWM - Page 1
Forum section: electronics / beginners

author: geppa.dee
author_rank: Contributor
timestamp: October 30, 2013, 05:55:22 pm
content: Hi everybody.I'm a programmer by formation and trade but lately I've been trying to learn electronics. Like many, I've got myself a few Arduinos and had a blast programming them and learning how to connect and use various sensors, actuators, storage devices... etc.I would now like to control the output of a DC-DC converter module. Like for example this one:http://www.ti.com/product/ptn04050c, using, again, an Arduino.The problem (for my limited knowledge) is that that module (and many similar to it) is controlled by varying a resistance (applied between GND and on of its pins).My question is: Is there any way to use a PWM output from an Arduino to drive it ?(I thought about using a DPOT and talk I2C or SPI to it but its output is discrete and I would like continuous.)Many thanks in advance for any help.

author: Jon86
author_rank: Frequent Contributor
timestamp: October 30, 2013, 07:39:17 pm
content: I don't understand the problem with the DPOT?And I can't see there being a way to do it with pwm, I think if it wants a resistor, you're going to have to use one. Unless you can have some kind of workaround with a transistor and filtering and all that, but I can't see that being reliable...

author: geppa.dee
author_rank: Contributor
timestamp: October 30, 2013, 09:52:29 pm
content: The problem(s) thatI seewith using a DPOT is that it is just a bunch of fixed resistors. It outputs discrete (stepped) resistance values, depending on how many internal resistors it has. I would like to be able to control the DC-DC converter as close to continuously as possible, like a regular, linear POT would. I know the Arduino's "analog output" is also discrete but is has more resolution (8bit) than the DPOTs I have at hand and could be made to have more from what I've read. Alternatively, a separate DAC could be used to get even more resolution.And second, I would like to be able to vary the DC-DC converters's output rapidly, to create, for example "voltage ramps" in short spans of time and I'm not sure that talking to a DPOT over a serial connection would be fast enough or leave time for other work to the uC.

author: alxnik
author_rank: Regular Contributor
timestamp: October 30, 2013, 11:10:13 pm
content: PWM and a filter cap produces linear voltage although it's stability is open to debate. Probably good enough for your application. Connect this to a n-mosfet and you are done. I don't see why it wouldn't be reliable, maybe not accurate/stable enough. Try simulating it with LTSpice to test the theory and then breadboard it. No matter what, at least you will gain more experience.

author: Jon86
author_rank: Frequent Contributor
timestamp: October 31, 2013, 10:40:10 am
content: Quote from: geppa.dee on October 30, 2013, 09:52:29 pmGet some higher resolution DPOTs, they're not expensive... And as long as you don't buy the crappiest ones ever made, it'll be fast enough.But if you want to to try the PWM method, go for it, LT SPICE it and see what happens, but when it's built up you need to make damn sure that your output signal is clean. That PWM could give you some real problems if you're not careful.

author: geppa.dee
author_rank: Contributor
timestamp: October 31, 2013, 12:44:48 pm
content: Quote from: alxnik on October 30, 2013, 11:10:13 pmThank you for your answer alxnik.I don't know why smoothed PWM voltage would be unstable nor have I doubted it's reliability.It's stable and reliable enough for my needs when used to light/blink/dim a small LED and sourcing power from the uC or to drive a transistor and source from an external line for higher power than the uC can safely source.I'm guessing this second usage pattern is what you're suggesting but...I don't thinkit's equivalent to what I was asking for.You see... I have this converter module. I feed it power within its rated input voltage range, adjust it with a POT to the desired output voltage and connect a load with a resistance such that it would not go over the converter's rated output current and power. And it works perfectly. If I then connect a different load, with a different resistance, but still within the converter's rated output current and power, it keeps working just fine and keeps the voltage setting. It's a switching converter, so it's fairly efficient too. Compact as well. All advantages as far as I'm concerned. So I want to use this (or similar) module as the power source for my load. All I want from my uC (Arduino or otherwise) is to adjust the converter module as I program it. Essentially I want to build a smart/programmable POT from an Arduino.WhatI thinkyou're suggesting is to effectively reproduce the existing converter's design but substituting it's switching IC with my uC...I know far from enough about circuit design and EE in general to trust myself to do that at this time.Obviously... I don't know enough to even build the "smart POT" butI thinkit would be an easier endeavor... hence me asking here.To be honest, I thought it would be a fairly known design pattern for someone in the know. When I say pattern I mean... like when you want to drive a relay with a digital out pin from an uC... the recipe is generally the same... resistor, transistor, relay + diode... done. The values (and quantities) may vary but the pattern is generally the same. I thought there would similarly be a recipe (even if more complex) for substituting a POT with a uC PWM output.Still hoping...Jon86, many thanks for taking a little interest.Quote from: Jon86 on October 31, 2013, 10:40:10 amOh I know DPOTs are not that expensive... not if you don't want them to be "log" scale and suitable for audio and be called PGA2310...those sort of are...And I know I could control them fast "enough"... The problem, as far as I'm concerned is that digital communication takes time... send some bits, wait some time, send some more bits, wait some more time... the protocol is irrelevant... be it I2C, SPI... or CAN or RS232... it's a very long operation compared with setting a PWM value out on a pin and forget about it... do other stuff while the uC timer takes care of maintaining the duty cycle until such time as the external device that I wanted to control has time to read (measure) it.This is why I'm trying to find a way to use the PWM... because it's fire and forget, until I want to change the value. Meanwhile though... the uC can do other things instead of kissing the bits goodbye as they go out on some bus (if I may use a comedic licence here).Regarding the "LT-SPICE/go for it" part... I haven't yet learned how to use LT-SPICE.And, even ignoring that... I don't understand the suggestion. I have voltage out (PWM) on one hand... and "resistance in" on the other... simulated or not... how do you suggest I... "connect" them?All I want the PWM to do is control a converter module. Not be the switching element in a DC-DC converter itself.

author: tszaboo
author_rank: Super Contributor
timestamp: October 31, 2013, 01:41:38 pm
content: Quote from: geppa.dee on October 30, 2013, 09:52:29 pmSo put two of them in series in rheostat mode, they can also be different nominal value ones. With a 10K-100K 8 bit you get ridiculous amount of steps.

author: Jon86
author_rank: Frequent Contributor
timestamp: October 31, 2013, 01:49:54 pm
content: Converting the voltage output to a 'resistance' is going to be the challenge. You can kind of do it with a transistor/MOSFET and some resistors, but it's going to be a challenge to get a real linear resistive output. And I guess you're going to need to find out how much current is flowing through that pin and what kind of voltage ranges. It's probably going to be quite a bit of trial and error.Also I think you're misunderstanding the whole communication thing, sending out 8 bits via SPI is really not going to take long, and with PWM there's going to be some amount of settling time before it reaches a nice stable voltage.

author: alxnik
author_rank: Regular Contributor
timestamp: October 31, 2013, 02:09:46 pm
content: Accuracy/reliability has to do that PWM is not designed for that. You might find that it is slow to react to changes (given the capacitive load) and might not be exactly linear if you filter it. Nevertheless, it's a perfectly good solution.On the resistance substitution, this is what I am talking about. You should connect the output of the (filtered) PWM tou the gate of a N-mosfet, the drain to the pin of the controller and the source to ground. If then mosfet is fully switched on (5V for logic level mosfets) then the resistance of it is Vds (from the datasheet of the mosfet) usually less than 1ohm. If the mosfet is fully switched off, the resistance is infinite. So by varying the pwm you can control the resistance of the controller pin to ground. However this will need some experimentation as the mosfet probably is not linear.LTSpice is not very intuitive, but you can be up and running in a day or so if you check some tutorials/howtos on the internet, that's how I learned it.

author: Jon86
author_rank: Frequent Contributor
timestamp: October 31, 2013, 02:18:17 pm
content: Also, bear in mind that the resistance isn't going to change as soon as you get some duty on the PWM, it's going to take a couple of volts before the mosfet starts turning on, so that'll reduce your resolution to start with.Take a lot of time to design your filter, it's going to be a trade-off between response time and output noise.