Shop OBEX P1 Docs P2 Docs Learn Events
Suggestion: DAC or RC (resistor, capacitor) to produce vRef — Parallax Forums

Suggestion: DAC or RC (resistor, capacitor) to produce vRef

courtenscourtens Posts: 101
edited 2013-01-24 08:33 in General Discussion
I am still somewhat new to electronics, so please forgive me if I sound ignorant.

I need to solve the following next challenge in my application.
These are the requirements:
  • I need to produce a reference voltage (vRef) that varies from 4 to 10 volt
  • vRef is on an isolated separate circuit (behind an opto-isolator)
  • vRef is controlled by a Propeller chip
  • I have 24 Vdd available to power vRef
  • It is critical that vRef is very steady and that it can be changed within 1/10 of a second from 4 to 10 or from 10 to 4V.

I am trying to solve this by using a RC (resistor capacitor combination) and a PWM from the Propeller, instead of the DAC chip approach (as this would require some sort of additional power supply.) Trying to get this to work with an RC, I found that this should be almost doable using a high-speed optocoupler (25Mbs).

But -- is this the best way to do this?

I found this in a different forum http://www.edaboard.com/thread201943.html but could not get LC logic to work.

Any suggestion are welcome!

Thank you very much.

Comments

  • frank freedmanfrank freedman Posts: 1,983
    edited 2013-01-21 20:41
    Not being one to err on the side of simplicity, you could always take a 10 volt or higher fixed Vref source into an LTC8043 Multiplying DAC and be able to set your desired Vref within a 4096 step range by sending the 12bit value. Note that the output is current out, and would need an op amp to convert current to voltage (I used a cheap NTE928S single supply op amp). Played with this using a signal gen for Vref and a 4096 bit ramp from the prop, but I don't think I posted any pictures of it in operation. There are other chips that can do the conversion to voltage as well.
  • kwinnkwinn Posts: 8,697
    edited 2013-01-21 22:11
    The simplest I can come up with is a 3 terminal variable voltage regulator with 2 resistors between the adj pin and ground. With both resistors in the circuit you get 10V out, with the optoisolator shorting one resistor you get 4V out. A precision regulator and 1% or better resistors would give a stable and accurate output and rapid switching.
  • stamptrolstamptrol Posts: 1,731
    edited 2013-01-22 05:02
    The two previous responses give workable solutions.

    However, perhaps you could give us a bit more detail on what your project is trying to achieve. The reason I am looking for more detail is that usually you want Vref to be the one thing in your system that you can count on being what it is supposed to be.

    If you agree to move Vref around between 2 or more values, you potentially introduce instability which may make your system less precise/accurate than would otherwise be achievable.

    Cheers,
  • courtenscourtens Posts: 101
    edited 2013-01-22 08:56
    Thank you for all your helpful suggestions.

    kwinn: will your approach required 3 I/Os? I am not too sure I understand your suggestion too well. And what about the heat?

    More details to my application:
    The vRef controls the brightness (intensity) of a flash (strobe) which is part on a film transfer system. So it is very important that the intensity can be held constant, once set. This is why I do like the 12bit precision that a DAC brings, in theory at least (I never used one before.)

    This is what I came up with, but the problem with this approach is that the vRef is either fast enough but ripply; or too slow and more steady. I guess I will need to compromise if using this. The only way to cut down on the ripples is by having a fast optocoupler.

    vref.gif


    Thank you for your continued help!

    This is the code to do an "Import" on the electronic circuit simulator java applet: http://www.falstad.com/circuit/

    $ 1 5.0E-6 13.097415321081861 60 5.0 43
    w 880 288 768 288 0
    r 528 368 528 432 0 1200.0
    w 528 288 448 288 0
    g 528 464 528 512 0
    t 464 448 528 448 0 1 -11.274911143780775 -1.2 100.0
    p 880 352 880 288 1
    r 304 384 304 448 0 180000.0
    r 304 448 304 512 0 15000.0
    R 304 384 304 352 0 0 40.0 24.0 0.0 0.0 0.5
    g 304 512 304 560 0
    R 304 448 240 448 0 2 1000.0 1.2 0.0 0.0 0.19
    g 768 368 768 416 0
    x 45 173 111 176 0 10 top left corner
    x 730 209 933 215 0 24 to strobe 4-10 vRef
    x 66 280 283 286 0 24 PWM from Propeller
    g 448 352 448 400 0
    R 448 224 448 192 0 0 40.0 24.0 0.0 0.0 0.5
    r 448 288 448 352 0 100000.0
    r 448 224 448 288 0 8200.0
    w 304 448 464 448 0
    w 528 288 528 368 0
    c 544 246 624 246 0 1.0E-6 15.119996188726418
    l 624 246 704 246 0 0.075 -5.921189464667502E-20
    r 704 246 784 246 0 56000.0
    c 768 288 768 368 0 4.9999999999999996E-5 10.074911143900778
    w 528 288 768 288 0
    x 65 309 270 315 0 24 Duty Cycle 25-75%
    x 70 374 173 380 0 24 72% = 4V
    x 67 405 183 411 0 24 19% = 10V
    x 73 449 206 455 0 24 Optocoupler
    o 10 32 0 39 5.0 5.36870912E7 0 -1
    o 5 64 0 34 20.0 9.765625E-5 1 -1
    665 x 392 - 5K
  • stamptrolstamptrol Posts: 1,731
    edited 2013-01-22 10:22
    Heres a possible solution using an LTC1451 DAC which can be controlled with a serial data stream.

    http://www.systronix.com/Resource/LTC1451-2-3_12-bit_DACs.pdf

    You may have to use a buffer op-amp on the output to get to 10 volts, but that's not too hard to do.

    Cheers,
  • kwinnkwinn Posts: 8,697
    edited 2013-01-22 13:38
    courtens wrote: »
    Thank you for all your helpful suggestions.

    kwinn: will your approach required 3 I/Os? I am not too sure I understand your suggestion too well. And what about the heat?

    More details to my application:
    The vRef controls the brightness (intensity) of a flash (strobe) which is part on a film transfer system. So it is very important that the intensity can be held constant, once set. This is why I do like the 12bit precision that a DAC brings, in theory at least (I never used one before.)

    This is what I came up with, but the problem with this approach is that the vRef is either fast enough but ripply; or too slow and more steady. I guess I will need to compromise if using this. The only way to cut down on the ripples is by having a fast optocoupler.
    .........

    Only one I/O is needed for what I suggested and it does not involve PWM so it does not matter if the optoisolator is fast or slow. When the optoisolator led is on the reference voltage will be 4V, when the led is off the reference voltage will be 10V. Once the values of the resistors required to produce the desired voltages have been determined the outputs will be stable and accurate. Since it is a reference voltage the current should be low and very little heat will be generated.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-22 14:28
    If you use kwinn's method, I would use the optoisolator to drive a low-RDS(on) MOSFET. Otherwise the residual forward voltage of the opto's output will skew regulator's output.

    -Phil
  • courtenscourtens Posts: 101
    edited 2013-01-22 18:48
    kwinn wrote: »
    The simplest I can come up with is a 3 terminal variable voltage regulator with 2 resistors between the adj pin and ground. With both resistors in the circuit you get 10V out, with the optoisolator shorting one resistor you get 4V out. A precision regulator and 1% or better resistors would give a stable and accurate output and rapid switching.

    Is this about what you had in mind; and will three LM317 work for this? It looks a bit involved. Did I over-do it? Thanks again for all the help. I must admit, about 30% of what was suggested would require additional studying, because it's a bit over my head!
    vref2.jpg
    1024 x 697 - 45K
  • kwinnkwinn Posts: 8,697
    edited 2013-01-22 21:21
    Precision dual voltage reference.bmp

    No, what I had in mind was much simpler as shown in the attached diagram. The regulator would be switched from 10V to 4V by the optoisolator and Q1. If you need a continuous range from 4V to 10V this circuit will not work. It will provide either 10V or 4V.

    As Phil suggested a low Rds on mosfet could be used in place of Q1. I would suggest using one of the 250 ohm 0.1% resistors used in 4-20mA circuits as R1 and 1K trim pots for R2 and R3. Q1 could be a 2N3904 or 2N2222, or similar small signal transistor, R4 10K, C1 and C2 are 0.1uF.
  • courtenscourtens Posts: 101
    edited 2013-01-22 22:35
    kwinn wrote: »
    Precision dual voltage reference.bmp

    No, what I had in mind was much simpler as shown in the attached diagram. The regulator would be switched from 10V to 4V by the optoisolator and Q1. If you need a continuous range from 4V to 10V this circuit will not work. It will provide either 10V or 4V.

    As Phil suggested a low Rds on mosfet could be used in place of Q1. I would suggest using one of the 250 ohm 0.1% resistors used in 4-20mA circuits as R1 and 1K trim pots for R2 and R3. Q1 could be a 2N3904 or 2N2222, or similar small signal transistor, R4 10K, C1 and C2 are 0.1uF.

    Thank you for the diagram. This helps. I am sorry for not having been clear enough about the vRef requirements. I need to be able to adjust it seamlessly, and as gradually as possibles, from 4 to 10V.

    At this point my best guess is to be using a DAC. If I get 12-bit steps from 4 to 10V -- that would equals 6V/4096 = 0.015 V increment steps! Now I just need to figure out the programing around that, and what DAC to best use....

    PS. I just found this driver spin code for this 16-bit DAC (MAX451) http://obex.parallax.com/objects/548/ 16-bit may be a bit overkill.
  • kwinnkwinn Posts: 8,697
    edited 2013-01-22 22:43
    courtens wrote: »
    Thank you for the diagram. This helps. I am sorry for not having been clear enough about the vRef requirements. I need to be able to adjust it seamlessly, and as gradually as possibles, from 4 to 10V.

    At this point my best guess is to be using a DAC. If I get 12-bit steps from 4 to 10V -- that would equals 6V/4096 = 0.015 V increment steps! Now I just need to figure out the programing around that, and what DAC to best use....

    I agree, a 12 bit dac would be a good choice for this. There are several suitable SPI dacs that can be used for this along with an op amp to provide the voltage range and resolution you need.
  • courtenscourtens Posts: 101
    edited 2013-01-23 00:23
    I think I am set on using this DAC MCP4921 with this well documented spin code http://obex.parallax.com/objects/508/

    Thank you ALL so much for all the help!
  • courtenscourtens Posts: 101
    edited 2013-01-23 13:33
    ... Note that the output is current out, and would need an op amp to convert current to voltage (I used a cheap NTE928S single supply op amp). ...

    Frank: is this sort of what you had in mind; and will this still require a op amp? Link to MCP4921 datasheet

    Sorry, I am so new to this....

    vref3.jpg
    1024 x 759 - 77K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-23 13:54
    I'm afraid you won't be able to use the ADC that way. AVss needs to be grounded. But, more importantly, Vref can't be higher than Vdd. You could do a 0-5V output with a 5V supply and use an op-amp to double the voltage range.

    -Phil
  • kwinnkwinn Posts: 8,697
    edited 2013-01-23 15:22
    Phil is right, you will need an op amp to get a 10V output, and also to offset the output voltage so it goes from 4 to 10 volts for the 4096 steps. You might also want to consider using the 4096 bits of resolution to cover a slightly wider voltage range than the 6 volt range you are interested in.

    By setting the gain of the op amp so you get 2mV per step instead of 1.465mV and have a range of 8.192V for the 4096 steps. This will make component selection less critical and allow the software to do the offset and gain adjustments digitally.
  • courtenscourtens Posts: 101
    edited 2013-01-23 15:22
    I'm afraid you won't be able to use the ADC that way. AVss needs to be grounded. But, more importantly, Vref can't be higher than Vdd. You could do a 0-5V output with a 5V supply and use an op-amp to double the voltage range.

    -Phil

    Thanks Phil. Is it possible to float the hole thing: have AVss and GND be 4V and have Vdd and Vref be 10V?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-23 17:01
    I would definitely not try to float the whole thing. For one, even though the Abs. Max rating for the ADC is 6.5V, it would still probably stress it to run it at 6V. For another, your 4V supply would have to be capable of both sourcing and sinking current, depending upon the ultimate load. Positive voltage regulators can only source current. (Although a -6V reg hung from the +10V rail, instead of a +4V reg referenced to ground, might solve that problem, it's still not the best.)

    The op-amp output is your best bet.

    -Phil
  • frank freedmanfrank freedman Posts: 1,983
    edited 2013-01-23 17:30
    courtens wrote: »
    Frank: is this sort of what you had in mind; and will this still require a op amp? Link to MCP4921 datasheet

    Sorry, I am so new to this....

    Not quite, but feed the DAC output (a current for the one I used) into an op amp. Unless you need "really" fast response, you may get by with spin as 12 bits may need a few mS. You can get under 10 uS using assembly to send a twelve bit value. If needed, you could further trim or scale for accuracy in case 1/4096 proves a little coarse;) My test setup used the example from the LTC data sheet into a cheap dual op amp though only used one of the two in the device. Drove the device from the prop directly.

    Also, the chip used was run from 5v with a 9v ref from the coppertop. Could have gone 2 in series as this one will handle up to +/- 25 volts though I have only experimented in unipolar mode. So advised, be careful of little limitations that may be conditional. The LTC8043 should do up to 25v but Vcc ~5v,but the one in your circuit as Phil notes will be max of Vdd-0.4v in one mode and Vdd in unbuffered mode. So you have a few trade-offs to consider. I will say the LTC took a bit to get working at first...
  • courtenscourtens Posts: 101
    edited 2013-01-23 23:07
    I came up with this updated schematic, considering all the very helpful input you ALL gave me. I hope I am not too far off with it.

    Sorry for this large image, but somehow the forums upload code is making it hard to read. So I though I would try something new.

    vref4.gif
    1024 x 594 - 63K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-24 00:16
    Putting Vref in the feedback loop is not a good idea. It needs to be connected to a constant +5V. Look at it this way: when the circuit powers up, the input and output of the op-amp will be zero, so Vref will also be zero. So, no matter what value you send ADC, the output will always be zero.

    -Phil
  • courtenscourtens Posts: 101
    edited 2013-01-24 08:33
    Thank you Phil! Good point.

    I never used any of these components before, they are very handy to know about.

    Revised diagram, now with faster optocoupler (PHOTO-IC) link to PDF

    I hope this is good to go like that ... :smile:
Sign In or Register to comment.