| Electronics > Beginners |
| PWM for LM317 - how to increase resolution? |
| << < (8/9) > >> |
| joeyjoejoe:
Okay. I should have done this sooner, a picture is worth a thousand words :) Here's what I'm trying to smooth out. Note PWM freq is 2kHz. Yellow is the pure PWM output. Blue is between R1 and R2. Purple is the output of the LM317. |
| mikerj:
This is one of those cases where you'd be far better off filtering the PWM and then buffering it, since you need to drive into a low impedance. This also means you can use a multi-pole filter to provide low ripple without making the response very sluggish. Another point here is that the LM317T has a minimum load current to meet the datasheet regulation performance. Normally this is achieved by making R3 a low value, 120 or 240 ohms is common (120 ohms is needed to meet worst case 10mA spec.). With 1k2 as shown in the diagrams here, the minimum load will not be met if nothing else is connected to the regulator output. That said the scope shows some very sharp edges on the output ripple. If you were seeing residual ripple on the adjust pin then you would expect to see a sawtooth waveform here, so it's quite likely you are seeing some of the PWM signal being superimposed on the output. This will happen if you don't have a really good, low impedance ground connection to connect the regulator circuit back to the PWM source. |
| joeyjoejoe:
I do have a 410ohm resistor as a dummy load going to ground. I originally had a buffer, but I believe Hero thought it would work better without, or that maybe I would need a different op-amp then the 358. |
| Zero999:
I don't see who this ripple is a problem for a battery charger. If you connect a battery to the output, you'll find it will be attenuated hugely. Yes, a buffer is unnecessary, if the circuit can be designed with the impedance of the potential divider in mind. The problem with adding a buffer is it needs to be able to pull the LM317 all the way down to 0V, which the LM358 can't do. An alternative is to use an op-amp which can sink a reasonable amount of current, such as the MCP6021. What values are you using for R1, R2 and R3 now? It's possible to put another RC circuit before the potential divider, but its impedance needs to be taken into account. For example, in first circuit I posted R1 = 5k6, R2 = 2k4 and R3 = 1k2, R1 can be split into two resistors, of 2k and 3k6, which total 5k6 and a capacitor added to 0V. The scaling factor of the potential divider is not altered, but the output will be smoother, since it has another stage of filtering. |
| joeyjoejoe:
Okay, things are looking aweeeesome! Blue is ADJUST. Magenta is the output voltage. :) I wanted to make sure I cleaned up what I could without any major load, as I spent a few hours tinkering with code to realize it was likely the ADC picking up noise. Now I can rule that out. At 0% PWM, I'm seeing ~3.55v, and 100%, ~4.7V :) I think the noise floor of my desk is 200mV though. So I won't get too hung up on that for now :) Plus a bread board won't help. I can run V1 of a PCB with some test points to see how much tighter I can get things. |
| Navigation |
| Message Index |
| Next page |
| Previous page |