Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Digital to Analog Conversion.......

Status
Not open for further replies.

Mr CCE

New Member
Hey guys,

Lately I've been working on a project that involves digital to analog conversion. Now I've been using the DAC0808 for this and I've constructed the 'typical application' circuit found on the data sheet. As input, I've used the A/D converter in PIC16F877A and I tested its output to be varying from 0 -> 255 (port B).

However I constructed the DAC0808 circuit without an amplifier at the output and found out that its output is in the range -0.45 to -5.xx.

My connections are:

Vref = 9 V
VEE = -9 v
VCC = 5 V

The problem is that as the Digital input varies from 0 to 255, the analog output (with no amplifier) changes rapidly from -0.45 to -5.8 !! So what gives??

I'd appreciate any advice gentlemen.

regards.:)
 
Last edited:
Its a current DAC; not a voltage DAC. Its output has to be fed into a virtual ground (zero impedance to ground) such as happens at the non-inverting input of an opamp. The DAC current flows in the feedback resistor, whose value must be chosen such that the opamp output is less than the opamp's -supply pin...
 
D to A ...

Hi there,
thx for the quick reply, now on to business.

You're absolutely right. I added an inverting amplifier and there's a bit of a progress. I used an 8V reference voltage- 5 Kilo ohm feedback resistor for the op-amp 741, and here's what's happening:

- I changed the mcu program so that it would output on port B the binary numbers from 0 to 255, with a 2 sec delay between each value - so I would check out how the DAC is functioning (using a voltmeter).

- the voltage is increasing as the binary value is increasing, but it reaches 7.xx to 8 V after 13 increments only. But shouldn't it reach this range after, like, 256 increments? My bet is on the Feedback resistor of the amplifier(?:confused:).

please more of your valuable advice!

thx for any future help

regards:rolleyes:
 
Post a schematic.
You are running the 741 on split supplies, at least +-10V, right?
You are tying the non-inverting input of the 741 to 0V?

Yours should look like this, taken from the **broken link removed**
 

Attachments

  • dac.png
    dac.png
    33.6 KB · Views: 1,513
Last edited:
hi,
You could try a 2k5 from pin 4 to 0V [without the amplifier as a test] , you should measure a voltage of 0 to ~ -4.9V on pin 4 to 0v.
 
D to A....

Hi there,
I've attached the schematic down below.I could really use your advice on this 'cause it's the first time I use this IC.
thx a lot in advance.
regards.
 

Attachments

  • DAC for forum.GIF
    DAC for forum.GIF
    7.3 KB · Views: 2,487
Hi there,
I've attached the schematic down below.I could really use your advice on this 'cause it's the first time I use this IC.
thx a lot in advance.
regards.

him
Have you tried the 2.5K resistor from pin 4 to 0v and measured the voltage on pin 4.?

For this test, do not have the OPA connected, you should read 0v thru -4.9V as you step the digital input from 0 thru 255.

Lets know what you measure.:)
 
Hi there,

him
Have you tried the 2.5K resistor from pin 4 to 0v and measured the voltage on pin 4.?

For this test, do not have the OPA connected, you should read 0v thru -4.9V as you step the digital input from 0 thru 255.

Lets know what you measure.:)

The addition of the 2500 ohm resistor worked miracles! Sir I really can't thank you enough!!

Now what's happening right now is that the voltage is increasing from about 0.01~0V to -4.8~-4.9 V as I'm increasing the digital input from 0->255, and the analog voltage is increasing in increments of 0.xx V but the mcu is still incrementing the digital value whereas the voltage just stops at -4.9. So how to get the full scale?

Please more of your valuable advices! thank you very much for any help in advance

regards.
 
Hi there,



The addition of the 2500 ohm resistor worked miracles! Sir I really can't thank you enough!!

Now what's happening right now is that the voltage is increasing from about 0.01~0V to -4.8~-4.9 V as I'm increasing the digital input from 0->255, and the analog voltage is increasing in increments of 0.xx V but the mcu is still incrementing the digital value whereas the voltage just stops at -4.9. So how to get the full scale?

Please more of your valuable advices! thank you very much for any help in advance

regards.

hi,
In order to invert the DAC signal output from 0 > -4.9V to say 0 > +5V you require a inverting OPA with the gain set to just over unity.
Use the OPA circuit as shown in the application data for the DAC.
To get the best result use a modern OPA with a specification superior to the 741.!

I would suggest in order to get the gain of the OPA to the required level, use a fixed resistor in series with a variable resistor in the OPA feedback path.
Say 3.3K fixed and a 5K multiturn variable.

EDIT: do not have the 2.5K connected when the OPA is used.

Do you follow OK.?:)
 
Last edited:
DAC still....

hi again,

I see. Well I'll get to it right away. I'm gonna use the LF 351 as in the datasheet.
thx very much in advance, I'll do it and tell you how it turns out.

regards.
 
hi again,

I see. Well I'll get to it right away. I'm gonna use the LF 351 as in the datasheet.
thx very much in advance, I'll do it and tell you how it turns out.

regards.

hi,
Look at this LTspice simulation.

EDIT:
As you require a +5Voutput use the lower value of feedback resistor as shown the simulation.

DAC1.gif
 
Last edited:
hi,
Look at this LTspice simulation.

Eric, the DAC sources current, so the op amp needs a negative supply, and the output of the opamp will range from 0V to -xV, where x depends on the feedback resistor.
 
Eric, the DAC sources current, so the op amp needs a negative supply, and the output of the opamp will range from 0V to -xV, where x depends on the feedback resistor.

hi Mike,
The OPA in the posted sim image has a +/-9V supply.?

Am I overlooking something.???
 
hi Mike,
The OPA in the posted sim image has a +/-9V supply.?

Am I overlooking something.???

Just turn the current source over in the LTSpice sim.
 
Just turn the current source over in the LTSpice sim.

Modified the sim to show the Vout as a result of 0mA to -1.991mA using a 2k5 load as per the DAC datasheet with current source direction same as shown DAC1.gif [post #11], no change made to current source direction.

The plot corresponds to the datasheet description.

You also said in your earlier post that the OPA requires a -V supply, which it has already.????

DAC2.gif
 
Last edited:
...

You also said in your earlier post that the OPA requires a -V supply, which it has already.????

...

Yes, but I think this sim better reflects how the OpAmp converts the current sourced by the DAC into a negative voltage at the output of the OpAmp. The point I was trying to make to the OP is that the OpAmp must be powered from a supply that is more negative (how much depends on the OpAmp) than the expected negative output voltage.
 

Attachments

  • Draft63.png
    Draft63.png
    21.9 KB · Views: 226
Hi everyone,

Actually it worked! I added an inverting op-amp at the DAC output with a feedback resistor of 3300 ohm and I was able to get the *almost* full scale from 0 V to +4.86 V (yes, +ve) as the DAC input changed from 0 to 255 so the result is not as much satisfactory but with an accuracy rate of 97.x % it'll have to do (assuming 248 binary at 4.86 V).

Really I can't thank both of you enough you've been an enormous help guys thank you very much.

If anyone has any other pieces of advice or pointers I'll be more than glad to hear them.

thx a lot.

regards.
 
Yes, but I think this sim better reflects how the OpAmp converts the current sourced by the DAC into a negative voltage at the output of the OpAmp. The point I was trying to make to the OP is that the OpAmp must be powered from a supply that is more negative (how much depends on the OpAmp) than the expected negative output voltage.

hi Mike,
I think on this occasion I must disagree with your comments.:)

Your point/explanation about the -9V supply was quite clear, it said the OPA requires a -V supply, which I have always shown in the sims.
No mention in your post of the expected negative voltage.

A point to note is that the -V supply to the OPA is only required if the user requires the Vdc output to be able go to 0V.

With the CA3140 OPA shown in my circuit the Vdc output is able go to within a few +mV of zero when used with a single positive supply voltage.

The point about the 'DAC sim' current source layout in my sim versus your sim, IMHO is a little 'picky'.

Regards

hi Mr CCE,
If you use a low value potentiometer in the OPA feedback resistor path, you should be able to set the output at the required +5V. Say a 3k3 fixed in series with a 500R or 1K variable.
 
Last edited:
The reason why...

Hi everyone,

thx for your valuable contributions. Now the reason I was building the D/A converter is that I want to:

1- A/D convert audio from a microphone
2- D/A convert the result to obtain the audio back

I got a microphone but I don't know what's its impedence (didn't buy it myself!) I attached a picture of it and on the back the microphone reads:"Wellix DR-08" and I'm confused about a couple of things:

- How to test it?
- How to determine the appropriate gain for a corresponding amplifier? If I want the audio to be in the range 0 -> 5V for instance?

I really need pointers on this 'cause it's the first time I try this sort of thing! (A/D then D/A audio!!)

Your precious information and advice are greatly appreciated gentlemen!

thx very very much in advance.
regards.
 

Attachments

  • microphone.JPG
    microphone.JPG
    52.2 KB · Views: 242
Ok, I just went and re-read the DAC0808 data sheet, and I see that I was mistaken as to the direction that the output current flows at the IO pin. It flows INTO the pin; not OUT OF the pin as I previously was thinking... This means that the output of the 741 OpAmp never swings below 0V.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top