Try to answer some of the Qs above since my last post;
@Hippy
1. The over voltage concern is that if there is say 18V Vin for a 15V supply , then if at any time (including switch-on) Vout rises above 15V and there is a 2:1 divider limiting ADC1 input to 5V, then ADC1 will see in excess of 5V.
A 5.1 Zener should fix this.
2. 10k/10k is me just taking baby steps. Bench supply at 13+ V, and careful adjustment of setting to ensure ADC1 did not exceed 5V.
Can see no reason why this cannot be scaled to wherever you like.
3. Been thinking about the classic bench supply where you can switch between ranges. There are a few things to consider;
a. when the range changes, the divider values need to change to match.
b. Also the offset at the bottom of ADC4 needs to change as well. e.g. for a 5V range, the 1.25V minimum Vout represents 250 on readadc10. for 10V out, the ADC1 is divided by 2 so the 1.25V minimum Vout appears as 0.625V on the setting side (ADC4) so the minimum ReadADC10 4 value has to be adjusted down to 125.
c. the use of MIN is not a good way to do this as it creates a dead zone on the bottom end of the pot. Adding 125 (or whatever suits the voltage range) works better but then the top level needs to be scaled back to a max of 1023 ~ formula used now (for a 1:1 divider Max Vout10V) is w1 = w1 * 50 / 8 * 7 / 50 + 127 - see code below.
3. Yes there is plenty of heat. Things were getting pretty warm (read hot) on the LM317T at 5Vout and 0.5 load (TO-220 no heat sink). The data sheet graph shows things should be stable and current delivered OK provided Vin - Vout < 12.5V. Minimum current rating is 1.5V but this reduces once Vin - Vout exceeds 15V to a low of 300mA at Vin - Vout = 40V (TO-220 with heatsink).
@Dippy
1. see 1. above
2. No not a droopy supply (bench supply). It seems to have a lot to do with sensing Vout and how the control circuit behaves when there is insufficient voltage. One of the reasons I stepped back to a 10V range was that nothing seemed to be working on a 15V range - all to do with the setting vs the feedback and the control circuit.
@Wapo,
1. Agree on the 1M and 0.47uF. Figure they could be revised down as I figure this is where the lack of response comes from - just takes too long to charge/discharge the gate voltage. Have not fiddled with this too much yet - want to keep things stable until the bigger points are resolved - the old philosophy of only change one thing at a time! Had previously tried 0.33uF and 470K without any significant change in response.
1/1023 represents 0.015V on a 0 - 15V Vout. With an 8mHz clock a relatively short persistent setting is not a big issue as it could theoretically be tweaked up/down by 0.015 every cycle of the program if necessary. Experimentation required to find the optimum trade off between adjustment response and stability.
2. Don't see need to change R1. Regulation only seems to be an issue if Vin does not have enough capacity (V or A).
@Myc,
Don't have that circuit on the National LM117/317 data sheet. It seems that is a significantly different circuit relying primarily on sensing the 300mV drop across the low value resistor in the Vout line. Not sure how applicable that would be to the present circuit.
Where to from here?
A.
It would appear (if the data sheets are correctly interpreted), that;
Vin - Vout should be =< 12.5V to avoid heat increase and current reduction issues.
1.2 to 1.25V is the minimum Vout.
To be certain of good regulation Vin should be => Vout +3V. Dropout is not specifically stated in the datasheet but all tables and examples show Vin 3V higher than Vout.
So,
1.2 + 12.5 = 13.7V
13.7 -3 = 10.7V
This means a Vin of 13.7 could provide a stable 1.25 thru 10.7Vout supply at full current capacity and stability without need for taps/switches etc.
B. Refine input ADC4 formula
C. Refine Gate circuit for response and stability
D. Provide protection for ADC1 (Zener?)
E. Verify if there are any transients at power up and mitigate (e.g. there is a slow turn on circuit in the LM317 datasheet)
F. If > 10Vout is required, develop a dual supply Vin (and Vout) system with ranges from, say,
Vin 13.5V. Vout 1.25 to 10.5
Vin 23.0V. Vout 10.5 to 20.0
To get some overlap,
3 steps(ranges), increase Vin and suffer some current capacity reduction/heat increase, or, accept a lower max than 20V.
On point E.
Vin 13V, Vout set at 5.0V
If the 08M is turned on first and LM317T turned on second, Gate & Vout rise from 0 to the set point at the response rate of the gate circuit.
If the 08M is turned off, and LM317T is left on, ADC1 drops to 1.25V, and Vout rises from 5V to an indeterminate voltage (different values on different tests gave 7 thru 9V) then floats around this level seemingly indefinitely.
With LM317T left on and 08M turned back on, ADC1 rises to the divider value of the current Vout (7 to 9V) i.e. in the test circuit with a 10k/10k divider to 3.5 ~ 4.5V at turn on and then drops along with Vout to set point at the gate circuit rate.
So there seems to be no 08M damaging effects but there is an issue with Vout rising. Presumably this occurs as there is effectively no path to 0V for the Adj circuit as the MOSFET goes to Max R with 0 Gate V.
Present Circuit / Program;
Code:
' +-+---- V+
' +-----+ | |
'08M Leg3 --+ 10k +--->| | 10k Pot
' (ADC4) +-----+ | |
' +-+---- V0
'
'
' +-----+
'08M Leg6 --+ 10k +---------------+
' (ADC1) +-----+ _ |
' 5.1|\ | |
' 0V -----+ >|-----+
' |/ |_ |
' |
' +-----+ | +-----+
' 0V -----+ 10k +--+--+ 10k +--+
' +-----+ +-----+ |
' |
' |
' Leg3+---------+Leg2 |
' Vin---------+ LM317T +-------+--+ Vout
' +----+----+ | |
' Leg1| | |
' Adj | +------+ | |
' +--+ 240R +--+ |
' | +------+
' | LOAD
' +--0.47uF--+
' | | |
' | |Drain |
' +------+ | Gate+---+----+ |
'08M Leg5 --| 1M |--+------+ IRL520 | |
' +------+ +---+----+ |
' |Source |
' | |
' | |
' 0V 0V
'
Code:
#picaxe 08M
'setfreq m8
main:
readadc10 4,w1 'read sensor input voltage (Vin)
w1 = w1 * 50 / 8 * 7 / 50 + 127
'with Vout=10V, ADC4 input adjusted between range of 1.25V/2 to 10V/2
'*50 & /50 improve integer math accuracy (1023/8*7+127=1016 ~ 1023*50/8*7/50+127=1022)
adjust:
readadc10 1,w2 ;read output voltage (Vout)
if w1=w2 then main ;skip if no adjustment required
if w1>w2 then increase
decrease:
high 2 ;set pin2 high to decrease Vout
pause 1 '1ms @ 4mHz 'pause 5 '2.5ms @8mHz
input 2 ;tri-state pin2 and hold Vout
goto adjust
increase:
low 2 ;set pin2 low to increase Vout
pause 1 '1ms @ 4mHz 'pause 5 '2.5ms @8mHz
input 2 ;tri-state pin2 and hold Vout
goto adjust