| Electronics > Beginners |
| PWM for LM317 - how to increase resolution? |
| << < (4/9) > >> |
| Zero999:
Do you actually understand how this works though? Would you know how to select the resistor values for different voltages? If you're interested I can show you, but it will have to wait until the weekend, unless someone beats me to it. |
| joeyjoejoe:
So I used your math/logic to recalculate the values for a 1.2V range of 3.4-4.6 volts to increase the resolution to something near the resolution of the 10 bit ADC. However, I'm not totally clear on how you came up with the schematic. I am at a wedding all weekend myself, so Sunday I should be able to spend some more time on it. Any keywords I can search for on YouTube to learn would be good, but half is probably understanding the LM317? R1/R2 form a voltage divider which I can try to read up up, but R3 is a mystery to me. I guess I'm not totally sure on what part of the schematic is "compressing" the PWM to 1.5V. |
| Zero999:
The LM317 is really an op-amp, a voltage reference and a large Darlington pair transistor. The 0V of the op-amp is connected to the regulator's output, which is why it needs a certain minimum load current to work properly: without it, the op-amp won't have enough power. The inverting input is connected to the output and the non-inverting input to the adjust pin via a 1.25V band gap voltage reference, which is biased by a 50µA current source connected to the input pin. The tiny 50µA bias current can be ignored for most applications, because it's small, compared to the current flow in the resistors. The op-amp adjusts its output voltage to alter the current flowing through the Dartington pair, to try to keep the voltages at both of its inputs the same. Because, the voltage reference holds the voltage on the non-inverting input at 1.25V above the voltage on the adjust pin, causing the op-amp to set the output to 1.25V above the adjust pin, forcing the adjust pin to different voltages will also change the output, which will sit at 1.25V above the adjust pin. For example, if the adjust pin is tied to 0V, the output will be 1.25V, if it's tied to 1V, it will output 2.25V. In an ordinary LM317 circuit, there are two resistors: R1 and R2. Because R1 is across the output and adjust pins and the LM317 keeps the voltage across it at 1.25V, the current through R1 will also be constant, because it has a fixed voltage across it. One off the applications of the LM317 is a constant current source, which relies on this fact: the circuit can be found using a search engine. R2 is also in series with R1, so any current flowing through R1, also flows through R2. Suppose R1 is 125Ohms, the current through it will be equal to VREF/R = 1.25/125 = 10mA. If R2 = 125R, the voltage across it will also be 1.25V and the output voltage will be 1.25 higher, giving a total output voltage of 2.5V, if R2 = 500R, then the voltage across it = 500*0.01 = 5, so the voltage on the output will be 5+1.25 = 6.25V. The formulae are listed below. VREF = 1.25V IR1 = R1/VREF = R1/1.25 IR2 = IR1 VR2 = R2*IR2 VOUT = VR1+VR2 Put the above equations together and the formula for the calculating the ouptut voltage in the standard LM317 circuit can be derived. Now we need to look at how the other circuit converts the PWM signal to 0V to 1.5V, then later we'll examine how the two circuits fit together. A potential divider can be modelled as a voltage source, with a series resistance equal to both of the resistors connected in parallel. VIN = 5V R1 = 5k6 R2 = 2k4 VOUT = VIN*R2/(R1+R2) = 5*2.4/(5.6+2.4) = 1.5V ROUT = (R1*R2)/(R1+R2) = (5.6k*2.4k)/(5.6k+2.4k) = 1.68k Putting this back into the other circuit, assuming the PWM duty cycle is 0% so zero volts. The output voltage, can be calculated using the standard LM317 formula: VOUT = 1.25*(1+1680/1200) = 3V When the PWM is at 100% of 5V, the potential divider will appear as 1.5V, again in series with 1.5V, so the output voltage simply increases by 1.5V to 4.5V I hope you can see that the PWM is still filtered by the capacitor, but the R in the circuit is now 1k68, rather than 1k, so now the potential divider works like a 1k68 resistor in series with a variable 0 to 1.5V voltage source, connected to the adjust pin of the LM317. |
| joeyjoejoe:
Ahhh, that first picture for the voltage divider blew my mind a bit, so now it is more clear what you were referring to! :) Thanks so much! So the values I've come up with is R3 = 933ohm, and R1 = 7.6k, which should change this to work from 3.5v to 4.7v. Perhaps you can double check the math? Just watched a very cool EEVBlog video this weekend on Capacitance Multiplier, and one of the use-cases was for smoothing PWM values! I'll check the ripple on my PWM to see if that's something I need to look at, although he mentioned in his video a bit about RC causing too big a voltage drop for a large R value, but since all I'm doing is adjusting the LM317, which is 50-100uA, I'm probably ok with a simple but large RC filter... |
| exe:
--- Quote from: joeyjoejoe on September 03, 2018, 03:15:07 pm ---Just watched a very cool EEVBlog video this weekend on Capacitance Multiplier, and one of the use-cases was for smoothing PWM values! --- End quote --- I don't think it is suitable here. Emitter follower (that's what capacitor multiplier really is) without negative feedback is prone to, e.g., temperature drift because of BJT. You wanted to increase accuracy and resolution, but you will loose both. Just breadboard it to see the problem. Capacitor multiplier is more like a pre-filter when you need to remove high freq harmonics (which a normal LDO cannot do) and don't care about DC accuracy. |
| Navigation |
| Message Index |
| Next page |
| Previous page |