Trying to build a constant current power supply for a laser diode here. I don't think I can use an off the shelf one because of the large 10A max current and because the current has to be controlled electronically by PWM.
So, I will design a buck converter. But I don't know if it's better to build one based on a microcontroller or use a dedicated chip like TI's simple switcher?
For software people like me, a microcontroller solution will be more familiar and have the fewest components - one chip to rule them all. I've searched for other people's experience on this and it seems quite feasible according to Olin's response
Can I use a microcontroller to control the output voltage of a switching powersupply?
The main downside to me is that I can't drive a MCU directly from a 24V source, so I will have to add another regulator. But even that might be simpler than using a dedicated switching chip.
I'm also afraid about fault tolerance. A MCU clearly has way more components inside that can fail. If the switcher fails in the on state, that can burn out the laser diode or worse, start a fire. To mitigate that, I was thinking of installing a watch dog timer, combined with a fuse for the laser.
-------------------update----------------------------- My first LM5117 circuit using nichrome wire for testing; potentiometer for adjusting switching frequency (output voltage has strong dependence on it)
-
\$\begingroup\$ This question is sort of vague because there's no one correct answer. I'll provide an answer but don't expect to be an absolute truth. \$\endgroup\$user103380– user1033802017年07月18日 21:32:22 +00:00Commented Jul 18, 2017 at 21:32
-
\$\begingroup\$ Many of the dsPICs have a hw fault/disable line direct to the PWM core on die, so you can halt switching from an external supervisor. Also you need a high clock rate to obtain a high PWM resolution \$\endgroup\$sstobbe– sstobbe2017年07月19日 00:51:44 +00:00Commented Jul 19, 2017 at 0:51
2 Answers 2
SMPS controllers are, simply put, designed to do the SMPS conversion. Your microcontroller is not. For example, current controlled two-loop controller design is common garden these days but trying to implement CMC with microcontroller would get dicey. You have these two control loops which interact.. And as pointed out, consequence of a bug in the firmware is smoke and perhaps fire.
If I designed this, I'd definitely go with an external switch synchronized buck SMPS controller. Your current is too high for an integrated solution. Instead of texas simpleswitcher, you could try something like LM5117 from Texas (Actually a Linear part). Their webench tool makes it a breeze to design the associated circuitry including feedback loop.
You can do entirely analogue control by simple expediency of resistor + capacitor PWM-to-DC converter and use an opamp to manipulate the SMPS feedback to achieve the current level you want. 10 amps is a bit problematic as you'd have already 10W over a 100mR sense resistor.. In this case a current sense transformer could be appropriate. Essentially just a couple of opamps to amplify the current sense signal and use the PWM signal as a reference to create a feedback loop to adjust the output voltage. You'll want to limit the opamp bandwith to avoid oscillating, think tens of Hz, not kiloherz. It is of course perfectly possible to create a stable feedback with higher bandwith but it requires proper analysis.
If you're not confident on your analogue design skills, you can use a simple microcontroller to control the feedback loop bias circuit and to measure the PWM duty cycle (or just use the RC circuit as suggested). This opens you up to problems with software glitches burning down your circuit thought.
-
\$\begingroup\$ Alright, I just ordered some LM5117s to try. It has a constant current mode (figure 35), but the trick is how to control the current electronically. I think I have a solution. The error function is 0.8 - Vfeedback, so I will use an opamp in difference mode Vfeedback = 10 (Iout * Rsense = 0.047 * Asense=10) - 14 Vcontrol. This way, the operating points will be: Vcontrol = 3.3 -> Iout = 10A and Vcontrol = 0V -> Iout = 0.17A. Thanks for encouraging this solution - I do need to get more analog literate. \$\endgroup\$Yale Zhang– Yale Zhang2017年07月19日 08:40:58 +00:00Commented Jul 19, 2017 at 8:40
-
\$\begingroup\$ I didn't actually realize this has built-in current monitor output.. Well, the principle is the same as having output current sense would have been except it can handle the triangle wave from the current sense resistor. 47mR would dissipate 4.7W so you probably want smaller resistor for the current sense. For trying how your analogue circuit might work, ltspice is useful for a "dry run". You don't need the SMPS model for that, it's enough to verify the opamp you want to use gives the expected 0.8v output to the FB at your current setpoint. \$\endgroup\$Barleyman– Barleyman2017年07月19日 09:04:33 +00:00Commented Jul 19, 2017 at 9:04
-
\$\begingroup\$ I got my LM5117 test circuit to work (see picture)! No adjustable current control yet. It just occurred to me that it would be slightly simpler to use a voltage control chip like LM3150 which would not need a resistor & capacitor for the emulated current ramp. Any comment? I also realized it's better for a cutting laser to be pulsed (to reduce heating of uncut material). Both the LM5117 and LM3150 have ways to disable the regulator, so I was thinking of using that to pulse it @500Hz, 50% duty cycle. Will the regulator be fast enough to do that? \$\endgroup\$Yale Zhang– Yale Zhang2017年07月24日 09:50:05 +00:00Commented Jul 24, 2017 at 9:50
-
\$\begingroup\$ That's 2ms cycle time so 1ms active time. You should be able to get something like 20kHz cross-over frequency but usually start-up time is much more than that. In fact soft start is a desirable feature. Mosfet switch in series with the load should do it but then you have to handle your current sense so it won't try to regulate voltage to max as it can't raise the current to 10 amps. \$\endgroup\$Barleyman– Barleyman2017年07月24日 12:45:53 +00:00Commented Jul 24, 2017 at 12:45
Well as you mentioned, the microcontroller has a dominant advantage of ease of use (because of the ability to program it) when you want it to behave as switches for particular components for your machine.
The main advantage of having a microcontroller is the ability to make things conditional and intelligent based on how the user perceives data to be sufficient for what they're trying to accomplish. With a microcontroller, you are able to predict and perform behavior instead of relying on the electronic switch to do it for you and thus you could really prevent error within the machine.
Some disadvantages I can think of is cost or programming error. The cost of a microcontroller can get pretty expensive. You can probably make your own circuit for a much cheaper price because those Arduino/Beaglebone/Raspberry Pi modules can get pricey. Programming can also be disadvantage. What if you accidentally messed up on your code and then you distribute the product to your client? Programming can also take longer to perform than circuit analysis.
Explore related questions
See similar questions with these tags.