Very simple DAC - 2 solutions here

KTarke

Senior Member
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)

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.
 

LizzieB

Senior Member
Forming outputvoltage with pwm is usually done by using R/C-bridges. They are not reliable, the capacitance causes delays etc.
But "Melanie's" circuit does rely on an R/C filter. The op amp voltage doubler is incidental, aside from helping the R/C filter by acting as a high impedance input buffer, there's no R/C avoiding magic there that I can see.
 

cactusface

Senior Member
Simple DAC...

Hi,
Yes sounds very interesting, but as JJ says where's the schematic or a few connection details. I always wanted to do this when using the Z80, but never made it. I do now have a couple of MAX518's that I want to use, Maxim say their I2C compatible, so may give them a try soon! These have 2 8 bit DAC's each.

Anyone used the Max518 or any digital pots with I2C interface. I would be thankful for any ideas or code..

Regards
Mel.
 

MartinM57

Moderator
So Circuit 1 is just showing variable voltage because your voltmeter is measuring a variable mark:space ratio 0-10V PWM signal??

So when measuring say 1.5v, it's actually something like a 1:6 mark:space ratio PWM varying from 0 to 10v??

So if the thing you're interfacing with expects a 0v/1.5v signal, you're going to subject it to 10v peak??
 

KTarke

Senior Member
Hi,
Yes sounds very interesting, but as JJ says where's the schematic or a few connection details. I always wanted to do this when using the Z80, but never made it. I do now have a couple of MAX518's that I want to use, Maxim say their I2C compatible, so may give them a try soon! These have 2 8 bit DAC's each.

Anyone used the Max518 or any digital pots with I2C interface. I would be thankful for any ideas or code..

Regards
Mel.
I answered to JJ about the circuits. Didn't bother to put them in as pictures, since neither of them are my desing... I told, where the schematics can be found.

I haven't (yet) used a external dac-CHIP, tried first to find out, do I have to... (I don't have to, if simpler solutions are good enough)

Not just the same chip, but Westaust55 has written something about dig-pots and chip-dac's , here:
http://www.picaxeforum.co.uk/showthread.php?t=14686
 

KTarke

Senior Member
So Circuit 1 is just showing variable voltage because your voltmeter is measuring a variable mark:space ratio 0-10V PWM signal??
Voltmeter shows output voltge, and Picaxes lcd shows (corresponding) pwm DUTY -value. Duty value in this case is 0-400 (depends on prosessor, processors speed and chosen freguency for pwm. Can be calculated with wizard, that can be found from the Picaxe programming editor)
To learn more, read Picaxe manual2 ,pwmout and pwmduty -commands.

So when measuring say 1.5v, it's actually something like a 1:6 mark:space ratio PWM varying from 0 to 10v??
In THIS case (when the whole range is 0 to 10V, and duty is 0-400, 1,5V would be 10V/400 * 1,5V = 60.

So if the thing you're interfacing with expects a 0v/1.5v signal, you're going to subject it to 10v peak??
I would recommend this:
-Use the mosfet-solution (found in Picaxe manual3, page 7)
-Set the maximum Vdd voltage to Your application to 1,5V (use voltage divider from Picaxes Vdd)
-Use pwm-command on Picaxe , calculate the duty. For example, if You get duty 100% = 400 ,as I did, You get a good resolution 1,5V/400 = 0,004V!

This way the circuit can NEVER give Your application overvoltage! (because Vdd = the greatest voltage given to Your app. ,is 1,5V)
 

KTarke

Senior Member
But "Melanie's" circuit does rely on an R/C filter. The op amp voltage doubler is incidental, aside from helping the R/C filter by acting as a high impedance input buffer, there's no R/C avoiding magic there that I can see.
I am not a electronics engineer, but still I don't think, that in this circuit, condensators make a big difference. (TRIED WITHOUT THEM!)
I think. that in this case condensators only "smoothen" things...
(can be wrong, but tried without, anyway)
That kind of op-amp -circuit is a "voltage follower", and when used with external Vdd, can be used as "voltage multiplier"

I , too, don't think that op-amps are a "wonder, that solves all things", but sometimes can be usefull...

It depends on the device driven, but "the rule of thumb" is that high output impedance is better... and THERE op-amp helps.

What I said, comes only from experience, that's why I asked comments from the wiser...:)
 

MartinM57

Moderator
I am not a electronics engineer...
Errr....that seems to be true I'm afraid.

Your "Raw PWM" only appears as a varying DC voltage because your voltmeter is (mathematically) integrating the incoming voltage (pretty close to averaging it) - if you looked at it on a 'scope it would just be a 0-10v periodic signal with a certain mark:space ratio. More "mark" = higher apparent dc voltage; more "space" = lower apparent dc voltage. You are NOT producing a varying dc voltage, despite what you see on your meter...
EDIT:however, if the equipment you're controlling takes the same view of the world as your multimeter, you may get some success in controlling it - but you are not creating variable dc (i.e. steady) voltage

You are also confusing traditional mark:space ratios that describe a PWM signal with the "synthetic" duty values that you need to put into the PICAXE PWM command.

Have a look at http://en.wikipedia.org/wiki/Pulse-width_modulation

Producing real steady state dc voltages from a PICAXE requires either:
- an R-C low pass filter and a PWM signal from a single pin (maybe incorporating a voltage doubler as your circuit 2, but as above, those Rs and Cs in that circuit are giving the steady state dc voltage)
- an R-2R ladder (http://en.wikipedia.org/wiki/Resistor_ladder) connected to a number of pins
- a DAC chip with some sort of serial or parallel interface
 
Last edited:

MartinM57

Moderator
...or the forthcoming PICAXE 20M2 (? - I think that's the number) that has, IIRC, an internal 5 bit DAC i.e. 32 different steady state DC output values
 

hippy

Technical Support
Staff member
I would recommend this:
-Use the mosfet-solution (found in Picaxe manual3, page 7)
-Set the maximum Vdd voltage to Your application to 1,5V (use voltage divider from Picaxes Vdd)
-Use pwm-command on Picaxe , calculate the duty. For example, if You get duty 100% = 400 ,as I did, You get a good resolution 1,5V/400 = 0,004V!
I'm not sure I really understand this, nor how to convert the MOSFET diagram in the PICAXE Manual into what you are actually using.

It seem to me ( as it seems to others ) that you are simply generating a variable duty rate PWM which will be putting a 0V or Vdd signal directly into what you are controlling. That it may work is because the controlled equipment will have some capacitance and probably acts as the RC which you haven't included externally.

How well that will work in practice depends on the controlled equipment's circuitry. It will be affected by the PWM frequency as well as the duty cycle, it will be hard to tell what ripple may be on the signal the equipment receives and the translation of PWM duty to internal voltage may not be linear.

The theory that capping the PWM to Vdd will make it safe for a system which expects up to Vdd sounds plausible but is not necessarily guaranteed. There may be inductances and the like which have no impact when driven from a moderately changing DC control voltage, but put in a higher frequency 0V / Vdd switching signal then those inductances and so on may come into play.

Some PC-style fans can be speed controlled by varying their operating voltage up to 5V but put 0V / 5V PWM directly into them ( or via a MOSFET ) and some will not work.
 

LizzieB

Senior Member
That kind of op-amp -circuit is a "voltage follower", and when used with external Vdd, can be used as "voltage multiplier"
Actually what is shown there is an op-amp used as DC coupled buffer/amplifier. High input impedance, low output impedance, DC voltage gain.

A "voltage multiplier" is a bunch of diodes and caps that generate a DC voltage much higher than the AC input.

I , too, don't think that op-amps are a "wonder, that solves all things", but sometimes can be usefull...
Au contraire mon ami, I do think op-amps are a wonder that solves almost anything. My issue was with that circuit being presented as one that did not involve RC filtering.

It depends on the device driven, but "the rule of thumb" is that high output impedance is better... and THERE op-amp helps.
I think you mean a high INput impedance is better, which is often the case. A high OUTput impedance is rarely an advantage, unless it involves electric shock.
 
Last edited:

KTarke

Senior Member
Errr....that seems to be true I'm afraid.

Your "Raw PWM" only appears as a varying DC voltage because your voltmeter is (mathematically) integrating the incoming voltage (pretty close to averaging it) - if you looked at it on a 'scope it would just be a 0-10v periodic signal with a certain mark:space ratio. More "mark" = higher apparent dc voltage; more "space" = lower apparent dc voltage. You are NOT producing a varying dc voltage, despite what you see on your meter...
EDIT:however, if the equipment you're controlling takes the same view of the world as your multimeter, you may get some success in controlling it - but you are not creating variable dc (i.e. steady) voltage

You are also confusing traditional mark:space ratios that describe a PWM signal with the "synthetic" duty values that you need to put into the PICAXE PWM command.

Have a look at http://en.wikipedia.org/wiki/Pulse-width_modulation

Producing real steady state dc voltages from a PICAXE requires either:
- an R-C low pass filter and a PWM signal from a single pin (maybe incorporating a voltage doubler as your circuit 2, but as above, those Rs and Cs in that circuit are giving the steady state dc voltage)
- an R-2R ladder (http://en.wikipedia.org/wiki/Resistor_ladder) connected to a number of pins
- a DAC chip with some sort of serial or parallel interface
Again, by experience only, not by "engineering skills", all equipment that do something according to 0-10V input, works the same way as a digital voltmeter...
They DO the adjusting according to input VOLTAGE, no matter ,what is the signals shape!

What are You telling anyway? That the whole thing is useless, because it does not produce 100% steady DC?
 

KTarke

Senior Member
...or the forthcoming PICAXE 20M2 (? - I think that's the number) that has, IIRC, an internal 5 bit DAC i.e. 32 different steady state DC output values
Forthcoming things are here not now! We have to play with the cards that we have in the hand.

In the (near or far) future, it is nice, if there will be a Picaxe with internal dac...

On the other side, when a new model comes, all programs have to be re-written, commands AGAIN works all the diiferent way.

Like to stick with one type, and find all the needed solutions for that one...
 

KTarke

Senior Member
I'm not sure I really understand this, nor how to convert the MOSFET diagram in the PICAXE Manual into what you are actually using.

It seem to me ( as it seems to others ) that you are simply generating a variable duty rate PWM which will be putting a 0V or Vdd signal directly into what you are controlling. That it may work is because the controlled equipment will have some capacitance and probably acts as the RC which you haven't included externally.

How well that will work in practice depends on the controlled equipment's circuitry. It will be affected by the PWM frequency as well as the duty cycle, it will be hard to tell what ripple may be on the signal the equipment receives and the translation of PWM duty to internal voltage may not be linear.

The theory that capping the PWM to Vdd will make it safe for a system which expects up to Vdd sounds plausible but is not necessarily guaranteed. There may be inductances and the like which have no impact when driven from a moderately changing DC control voltage, but put in a higher frequency 0V / Vdd switching signal then those inductances and so on may come into play.

Some PC-style fans can be speed controlled by varying their operating voltage up to 5V but put 0V / 5V PWM directly into them ( or via a MOSFET ) and some will not work.
Since I am no engineer, just TRY things out, some of this stuff goes over my head.
Those ventile-turning.motors, I am talking about, don't care much about vawe-forms (they can be "set" from a battery, as from a un-regulated powersource, merely the VOLTAGE counts) I think, as made for industrial use ,they assumably have some input-filtering.

If someone wants to dimm a ligth, control a dc- motor etc. WHAT exactly is the meaning of waveform?? It works, no matter of frequency or if Dc has a Ac-component in it.
IF it does NOT work, then one can start thinking with waveforms...

Seems, that I have to myself try controlling one ventile-motor with a simple mosfet, to know better.

From the feedback, I don't now know, is the "ways" I offered all-obsolete, or usefull. ??

I am thinking also, what would be the dac-controlled thing that DOES NOT tolerate some fluctuation in wave-forms...

SO, is pwm-dac (any kind) ,obsolete or not? I would very much like to know...
 

MartinM57

Moderator
What are You telling anyway? That the whole thing is useless, because it does not produce 100% steady DC?
No, I'm just trying to tell you that PWM'ing a FET, varying the PWM mark:space ratio and seeing different voltages with your multimeter does not mean that you have built a Digital to Analogue converter, in the accepted use of that phrase.

PWM'img a FET, varying the PWM mark:space ratio and using the result to control the power through a motor, hot wire, bulb etc is a perfectly good technique - just please stop trying to call it a DAC because of what you see on your voltmeter :)
 

KTarke

Senior Member
No, I'm just trying to tell you that PWM'ing a FET, varying the PWM mark:space ratio and seeing different voltages with your multimeter does not mean that you have built a Digital to Analogue converter, in the accepted use of that phrase.

PWM'img a FET, varying the PWM mark:space ratio and using the result to control the power through a motor, hot wire, bulb etc is a perfectly good technique - just please stop trying to call it a DAC because of what you see on your voltmeter :)
OK. Terminology is not clear to me ; I have THOUGHT, that any circuit, that converts a digital output from a uP, to a analog value, can be called DAC...
On the other hand, pwm-command produces a semi-analog output? ,not fully digital. (so , I am not converting from digital to analogue...)

I was pointing out, that maybe these simple circuits could replace a "real" dac-chip, at least in some applications.

Seems ,that I have to run tests with "real world apps", to find out, is it working, or not.
 

Dippy

Moderator
KTarke, have a think about PWM. "Pulse Width Modulation".

Basically a square wave shape where you can control the ratio of High to Low time - (mark:space ratio or duty% - call it what you will).
If you viewed what you were doing on an Oscilloscope you would see exactly what Martin is saying.
Fine for motors and lighting LEDs etc. but would be no good as a DC reference for peripherals.

"On the other hand, pwm-command produces a semi-analog output?"
- NO. It's a pile of high/low on/offs.
It only becomes an analogue signal when you 'smooth' it - like the rectifier after a mains transformer.
A simple R-C can do this or a more complicated Op-amp based rectifier.
The op-amp has the advantge of being able to 'buffer' it so that it is less load-dependent.
Neither will be 100% smooth, but you can get very good results if you don't need the pseudo-DAC to respond rapidly.

As said by Martin, your 'average' Multimeter, will be 'averaging' the signal it receives.
The higher the frequency then the 'smoother' your rectified signal will be and a buffered design will be far better.
All this has been covered many times over many years.

There was some work on using a MOSFET as a PWM-controlled resistor some time ago. It used feedback and apparently worked quite well within limits.

A true DAC will output a fixed DC level (discrete values) based on the digits you throw at it, whether serially or parallel.

The closest you could get to a true DAC without using a DAC chip would be a frequency-voltage converter chip.

So, dig out your Oscilloscope and do some testing. It's very educational.
 

MartinM57

Moderator
On the other hand, pwm-command produces a semi-analog output?
No, just a digital (two values, 0v and some Vdd) pulse stream. At any one time, the voltage is 0v or Vdd - which is not an analogue (or semi-analogue) voltage, unless you do something like RC filter it
 

KTarke

Senior Member
I'm not sure I really understand this, nor how to convert the MOSFET diagram in the PICAXE Manual into what you are actually using.
Here is the circuit I used:



And here is a principle-drawing of a device , I wan't to control.



As You can see, there is inbuilt conditioning for the input signal.
I have years ago tried it: I can feed 5V from an (poorly regulated) wall-wart adapter to the input line, and the actuator goes nicely to the midway-position.
 

Dippy

Moderator
"As You can see, there is inbuilt conditioning for the input signal."
- No, sadly I can't see a signal conditioning circuit.

I can see a "positioning circuit" - but I can't see a specification or schematic, which can often, be quite important.

And I can see that you want to do this simply.

So, maybe just try rectifying your MOSFET circuit.
Discussing true DACS is maybe overcomplicating your task for you.
I would use a different technique myself, but you know more about this mysterious device and electronics than I.
I'm sure you'll get it working so good luck.
 

hippy

Technical Support
Staff member
What wasn't immediately clear is that the circuit is shown for driving a motor, hence the (M), and you're not driving a motor but delivering a 'control voltage' according to your description.

I guess you are creating this 'control voltage' by putting the controlled device in place of the motor as the MOSFET's high-side load.

I'm sure everyone believes you when you say your scheme works for controlling this device, it's really the terminology which is an issue; you are not generating an analogue voltage in any manner of form, have not created a DAC. That this control scheme works with this product as supplying a voltage would is really just good fortune and may not be applicable to other devices.

In fact, you are most likely keeping the 'control voltage' line at 10V and switching the 'control voltage 0V' line on and off. This seems to work for this product but it is not a generic solution.
 

MartinM57

Moderator
I'd also be sure I understood the subtleties of the "0-10v 4-20ma" label against the control signal - are you aware that "4-20ma" control circuits are a special design that are CURRENT driven and NOT voltage driven? And hence your circuit may not be appropriate anyway.

Another wikipedia for you ... http://en.wikipedia.org/wiki/Current_loop
 

BeanieBots

Moderator
KTarke, as you say, your knowledge is mainly based from experience and it would appear that experience is limited to a small range of devices.
Your observations come from a particular device but as the others have tried to explain, it is not the case in general.

Consider a mechanical equivalent.
Lets say you want to move a car using a force.
You could apply an even force over a period of time. For example by pushing.
Alternatively, you could apply a lot of short duration high forces just like the explosions which push the pistons in the engine do. This is how most cars work and it works very well.

However, care must be taken when using short duration high forces.
For example, you could push the car by putting your hands on the back window. If however, you were to repeatedly strike the window with a hammer, then the car would break rather than move.

The same is true for PWM voltages.
Sometimes you can "get away" with it. Sometimes you cannot.
To KNOW when it is OK and when it is not requires an understanding of both PWM AND the device that is receiving it.

Please take note of the advice the others have given you. It is all correct.
 

KTarke

Senior Member
I have admitted, that know nothing about DESIGNING circuits, my experience comes from using them...

And in the fist post I ASKED for opinions, if these are usefull ,or not.

Now, the simple mosfet circuit has been doomed.

Does one always have take to take the "engineers way" ,and add more chips, perhaps another processor, and always a LOT more components and cables,
OR can things sometimes be simple ?


No-one has commented the other one, is the op-amp circuit obsolete ,too??
 

westaust55

Moderator
I'd also be sure I understood the subtleties of the "0-10v 4-20ma" label against the control signal - are you aware that "4-20ma" control circuits are a special design that are CURRENT driven and NOT voltage driven? And hence your circuit may not be appropriate anyway.

Another wikipedia for you ... http://en.wikipedia.org/wiki/Current_loop
Seems that what KTarke has is a positioner as used for a valve.

From my past (limited) experience with instrumentation of this nature in industrial plants, some of these devices can accept either a 4-20mA current signal or a 0-10Vdc (and in some cases also something like 1-5Vdc).

Would think that the positioner is expecing a smooth current or voltage and a PWM based signal will make the positioner logic "think" that it is to travel rapidely between the two limits but it cannot react that fast and ultimately does nothing as a result.

As has already been suggested, some form of integration/filtering with an RC network may help.


An "straight" Op-Amp circuit will amplify the PWM to some new voltage level but in a simple form/circuit cannot smooth the output. It would just be a PWM signal with amplification.
You can use the Op-Amp in an integration circuit. Have alook at:
http://www.allaboutcircuits.com/vol_3/chpt_8/11.html
But try the R-C components on the PWM output first.
 
Last edited:

KTarke

Senior Member
I'd also be sure I understood the subtleties of the "0-10v 4-20ma" label against the control signal - are you aware that "4-20ma" control circuits are a special design that are CURRENT driven and NOT voltage driven? And hence your circuit may not be appropriate anyway.

Another wikipedia for you ... http://en.wikipedia.org/wiki/Current_loop
I DO know, what is the difference between vontage- and current-loop controls!

Did YOU notice, that the picture was PRINCIPAL. There is shown several driving voltages: 24V OR 110V OR 220V , as well as two inputs : 0-10V OR 4-20mA
 

Dippy

Moderator
Htarke, I think, in fairness, people were a little confused by your initial posting.
I, for one, have seen the methods you outlined in Post#1 many times. I'm sure others have too.
I didn't know whether there was something new in what you had proposed - therefore I kept out of it.

"Does one always have take to take the "engineers way" ,and add more chips, perhaps another processor, and always a LOT more components and cables,."
- if by the "engineers way" you mean the sensible, reliable, best and safe way, then YES.
If you want a proper job then you have to do a proper design. Simple.

If you are being slightly ironic (I know the feeling) and saying the "over-the-top engineers way" - then no, not necessarily.
The sophistication depends on the application.
As BB has said many times; sometimes you can 'get away' with simpler design if the App isn't crucial.


"...OR can things sometimes be simple ?"
Yes, things can often be very simple - BUT it depends on the application.
And you didn't provide any details until recently.
Drip-drip feeding of information often results in ambiguous and slow replies.
Some controllers I have seen can take a PWM direct - so can't be more simple than that can it?

Speaking for myself, I know NOTHING of the device you are using or how it will behave with different 'quality' of signal.

A PWMd FET is NOT a DAC, but with a few mods (as mentioned several times) it could be made into something that is suitable. An op-amp version (I said before) could produce better results.
Do you understand the effects of RC on a PWM signal? Do you understand rectification?
 

KTarke

Senior Member
Htarke, I think, in fairness, people were a little confused by your initial posting.
I, for one, have seen the methods you outlined in Post#1 many times. I'm sure others have too.
I didn't know whether there was something new in what you had proposed - therefore I kept out of it.

"Does one always have take to take the "engineers way" ,and add more chips, perhaps another processor, and always a LOT more components and cables,."
- if by the "engineers way" you mean the sensible, reliable, best and safe way, then YES.
If you want a proper job then you have to do a proper design. Simple.

If you are being slightly ironic (I know the feeling) and saying the "over-the-top engineers way" - then no, not necessarily.
The sophistication depends on the application.
As BB has said many times; sometimes you can 'get away' with simpler design if the App isn't crucial.


"...OR can things sometimes be simple ?"
Yes, things can often be very simple - BUT it depends on the application.
And you didn't provide any details until recently.
Drip-drip feeding of information often results in ambiguous and slow replies.
Some controllers I have seen can take a PWM direct - so can't be more simple than that can it?

Speaking for myself, I know NOTHING of the device you are using or how it will behave with different 'quality' of signal.

A PWMd FET is NOT a DAC, but with a few mods (as mentioned several times) it could be made into something that is suitable. An op-amp version (I said before) could produce better results.
Do you understand the effects of RC on a PWM signal? Do you understand rectification?
Thank You Dippy, for clearing comments.

In the first post I gave no further data, what is it that I want to control, for two reasons:
-I wanted to know, if those circuits were usefull IN GENERAL.
-0-10V input is used in industrial devices only, an those almost always have some protection/conditioning in the input.

There are valve-adjusters both with slow and fast movement . "Fast" in this case means the speed from open to close is only seconds, when the slow ones use a minute.
Still, the fast ones react "fast" too, but fast here means 0,5-1 second (if the input voltage rises, and goes back down IN 0,5 sec. time, nothing is done)
Haven't "reverse engineered" ,HOW this is accomplished, but anyway, no problem with waveforms therefore...

I underderstand the principle of R/C -circuits, but not enough to calculate a suitable one.
 

Dippy

Moderator
Do you know the input specification of the device?

- Assuming the device was physically not connected to anything important of course....

I'd breadboard a simple RC (probably with an NPN+PNP or NPN+Pchan).
Test it with a 'scope. Try a few values until I got something pretty smooth.
Obv you could add another RC stage, though the more RC you shove then the slowe the response.

Put a wee resistor on the output and stuff it into the device and 'scope it.
If the scope showed the PWM re-appearing you'd have to change values or use an op-amp buffer.
A sensible person might do something else but I'm too impatient and unsensible (or maybe insensible) to faff about :)

If that didn't work, move on to Plan B.
 

KTarke

Senior Member
Do you know the input specification of the device?

- Assuming the device was physically not connected to anything important of course....

I'd breadboard a simple RC (probably with an NPN+PNP or NPN+Pchan).
Test it with a 'scope. Try a few values until I got something pretty smooth.
Obv you could add another RC stage, though the more RC you shove then the slowe the response.

Put a wee resistor on the output and stuff it into the device and 'scope it.
If the scope showed the PWM re-appearing you'd have to change values or use an op-amp buffer.
A sensible person might do something else but I'm too impatient and unsensible (or maybe insensible) to faff about :)

If that didn't work, move on to Plan B.
The input spesifications on those industrial devices are VERY commonly told in the manuals... I think that 0-10V input is standardized.
Only maximum overvoltage to the input is often told (usually max 15V, a few seconds).
Once a controller was broken, and I made a "manual" adjust: battery pack and a potentiometer (easier to adjust ,than by hand mechanically, one have to turn over a 100 revs to close the valve)
I had in the car a cheap dvm, and tried to measure ,how much current the input draws from the batteries... the cheap dvm did not show so small currents! (<0,5mA)

I thank You very much for shearing Your knowledge off the circuit-desingning side, which is unknown to me.
 

BeanieBots

Moderator
In the first post I gave no further data, what is it that I want to control, for two reasons:
-I wanted to know, if those circuits were usefull IN GENERAL.
-0-10V input is used in industrial devices only, an those almost always have some protection/conditioning in the input.
.
It is for those very reasons that your suggestion was shot down (politely).
Any design should always be kept as simple as possible but whenever information is missing is should NEVER be assumed.

A 'general' design must be just that. General. That is, capable of being suitable for ALL applications. If the application requires a DC 0 - 10v signal then a GENERAL solution must provide just that and not ASSUME that the application can accept a PWM signal which just happens to average out at the desired voltage.

DESIGN involves taking ALL situations into account and producing a solution appropriate to the application. Without information about the application, it is IMPOSSIBLE to design for it. Experimentation may well produce a solution that works (today) but there is no way of KNOWING if that solution will work reliably the following day. It may be stressing the other device. You simply don't KNOW because you do not have any data.

Smoking a cigarette will not kill you on the spot so can you therefore conclude that smoking is OK and not harmfull?
Most people can eat peanuts with no ill effects, so is it OK to put peanut oil in ALL food?

"It worked on the bench" are the famous words of many a red-faced engineer!
 

KTarke

Senior Member
It is for those very reasons that your suggestion was shot down (politely).
Any design should always be kept as simple as possible but whenever information is missing is should NEVER be assumed.

A 'general' design must be just that. General. That is, capable of being suitable for ALL applications. If the application requires a DC 0 - 10v signal then a GENERAL solution must provide just that and not ASSUME that the application can accept a PWM signal which just happens to average out at the desired voltage.

DESIGN involves taking ALL situations into account and producing a solution appropriate to the application. Without information about the application, it is IMPOSSIBLE to design for it. Experimentation may well produce a solution that works (today) but there is no way of KNOWING if that solution will work reliably the following day. It may be stressing the other device. You simply don't KNOW because you do not have any data.

Smoking a cigarette will not kill you on the spot so can you therefore conclude that smoking is OK and not harmfull?
Most people can eat peanuts with no ill effects, so is it OK to put peanut oil in ALL food?

"It worked on the bench" are the famous words of many a red-faced engineer!
I thank You VERY much for straightening me!
I consider me as a person, who usually explains TOO much... but sometimes everyone falls into "expecting" things.
This time I tried, what would the wiser tell me, were my thoughts usefull, or not.
I am sorry, if lack of information caused immediate "shootdown"/wondering overall.

I was myself pretty shure, that the industrial components " take" whatever s**t they are given (designed reminding the knowledge, that the ENVIRONMENT always causes noise/glitches)

That is why, I left out information, to get feedback, if those setups were good for SOMETHING ELSE,too.

Now, I , and all others ,have got a lot good links/hints, how to make those (my simple, no-good) ideas a LOT better, and usefull.

So, the thread has served it's purpose, and well!

I thank all You, who have given good advice.

As I have (in other threads) before mentioned, I always like simplicity (=as few components, as possible). That comes from 30 years work in the industrial (automation) environment, installing equipments and correcting problems...
In my opinion, every extra component is a "antenna for trouble" and every extra inch of cable is even more problematic...
 

BeanieBots

Moderator
Your thread has indeed served a good purpose.
It has inspired thought and debate which is what forums are all about.

Just another quick issue.
You need to be very careful with 'general'.
0 to 10v is indeed an industry standard and MANY (not all) can cope with less than ideal values/ripple/noise.

Consider a voltage controlled constant current LED driver.
They can respond to demand signals very quickly. Quick enough to produce images when scanned. Any ripple or PWM would have a very significant effect on such a device because they are actually designed to react to such an input. This includes postioning devices such as the mirror driving motors used to scan lazers to create pictures.
Not everything is slow;)
 

womai

Senior Member
Well, not quite. The output amplifier is rail-to-rail, that means it can go close to (but not above) the supply voltage. So even with gain=2 you will never be able to exceed 5V output (if you supply the chip with 5V).

Actually my personal favorite is the MCP4822 (not 4922), it has two channels (as opposed to one) and an internal reference. Really easy to use, I slap it in whenever I need a simple DAC. Only thing to keep in mind, the internal reference of 2.048V means output is 4.096V max (with gain = 2), but that's easy to scale up or down with an external op-amp.

Wolfgang
 

westaust55

Moderator
Analogue Output without external chips

Now we are going full circle. :eek:

Back at Post 1, KTarke stated:
If we don't look at adding an external dac-chip (that is covered well by Westaust55)
In other words he was referring to my DAC’s 101 Tutorial here: http://www.picaxeforum.co.uk/showthread.php?t=14686

There I have code for the MCP4821/4822. The MCP4921/4922 uses exactly the same program code but uses an external voltage reference. Forum member Janne also gave a program example for theMCP4921/22.

If you get back to the original idea per post 1, as I read it, KTarke was originally trying to present a different way to achieve an analog output that is not using an external chip as his own project.

Thus as I see it, Martin57's information about the microchip App Not
http://ww1.microchip.com/downloads/e...tes/00538c.pdf
was more in line with the orignally sought concept.

Maybe KTarke could reconfirm the present goal.
that is, with or without an External chip ?
 
Top