Saturdays project, dac's...
0-10V output is needed to control various equipment.
Output voltage has to be rail-to-rail, and with good resolution.
If we don't look at adding an external dac-chip (that is covered well by Westaust55) ,there is still pwm-command...
If one is carefull, the command itself should not cause problems (?)
(reserving timer)
Forming outputvoltage with pwm is usually done by using R/C-bridges. They are not reliable, the capacitance causes delays etc.
Here comes first circuit, it is as simple as it can get!
It is almost the same circuit that can be found in Picaxe manual3 ,page 7 , EXEPT that I added a resistor (10K) between picaxe output and mosfet gate.
And there HAS to be a pulldown (12k)! If pulldown is missing, output voltage can rise from 0V during Picaxe boot.
In my test, 10V was given to load from an external regulator. There is a very small lamp as a "artificial load".
The second circuit is also quite simple. Uses cheap LM358 as a voltage doubler. (doubles Picaxes output Voltage)
Circuit can be fed from 12-38V supply! There is a adjust-trimmer to set the maximum output exactly to 10V. Nice circuit from Melanie, can be found here:
http://www.picbasic.co.uk/forum/showthread.php?t=245
(remember to add the 12k pulldown to this circuit ,too)
Results:
Both circuits do very smooth from 0 to 10V.
Had now "at home" any real device ,that uses 0-10V input, so tests were done only by relying on a multimeter. Had to later test with a real valve-adjusting-motor.
Code:
At 4Mhz speed Picaxe and 10kHz pulse, the wizard gave duty 0-400. Quite good resolution... (10V/400 = 0,025V)
Here is the code I used in testing (commented)
I need comments, is there "downsides"/something to concider, when using these circuits.
0-10V output is needed to control various equipment.
Output voltage has to be rail-to-rail, and with good resolution.
If we don't look at adding an external dac-chip (that is covered well by Westaust55) ,there is still pwm-command...
If one is carefull, the command itself should not cause problems (?)
(reserving timer)
Forming outputvoltage with pwm is usually done by using R/C-bridges. They are not reliable, the capacitance causes delays etc.
Here comes first circuit, it is as simple as it can get!
It is almost the same circuit that can be found in Picaxe manual3 ,page 7 , EXEPT that I added a resistor (10K) between picaxe output and mosfet gate.
And there HAS to be a pulldown (12k)! If pulldown is missing, output voltage can rise from 0V during Picaxe boot.
In my test, 10V was given to load from an external regulator. There is a very small lamp as a "artificial load".
The second circuit is also quite simple. Uses cheap LM358 as a voltage doubler. (doubles Picaxes output Voltage)
Circuit can be fed from 12-38V supply! There is a adjust-trimmer to set the maximum output exactly to 10V. Nice circuit from Melanie, can be found here:
http://www.picbasic.co.uk/forum/showthread.php?t=245
(remember to add the 12k pulldown to this circuit ,too)
Results:
Both circuits do very smooth from 0 to 10V.
Had now "at home" any real device ,that uses 0-10V input, so tests were done only by relying on a multimeter. Had to later test with a real valve-adjusting-motor.
Code:
At 4Mhz speed Picaxe and 10kHz pulse, the wizard gave duty 0-400. Quite good resolution... (10V/400 = 0,025V)
Here is the code I used in testing (commented)
Code:
init:
#picaxe 28X1 ' 5V model , 4MHz
dirsc = %00000010 ' pwm pin 1 as output
pwmout 1, 99, 0 ' "port ON here" . Wizard gave period =99 @10kHz and 4Mhz Picaxe
pause 500
main:
for w1 = 0 to 400 ' wizard gave 100% @ duty=400
pwmduty 1,w1
pause 250
serout 7,N2400,(254,1)
serout 7,N2400,(#w1)
next w1
pause 10000 ' output stays on still 10 seconds
end ' when program ends, output drops to 0
I need comments, is there "downsides"/something to concider, when using these circuits.