DAC

This is on the way:

I don't understand exactly how to operate it. I understand the I2C part, but what if I am putting in 5V, what number would I input digitally to get, say, 3.4V?
I want to generate a sine wave for audio....

Also, how can I generate a negative voltage? (for this and op amp supplies)

Thanks!

Its a 12-Bit Digital-to-Analog Converter, so the output is Vref * count / 2^12 which is Vout = Vref * count / 4096.

what is "count" and "vref"? Are those the numbers?

i.e. If I had 5V supply rail and I wanted 2.5 volts I would send 2048 over I2C?

Also, how can I generate a negative voltage?

Looks like its ratiometric to the supply. 4095 -> 5V,
0 -> 0V. 2048 -> 2.5V

And a negative voltage?

Also, how can I generate a negative voltage?

By having a -5V supply as well, and an opamp in an inverting amplifier configuration perhaps? The DAC chip is only single rail and max supply of 5.5V so it won't do it by itself.

Also, how can I generate a negative voltage?

You can't directly. You can either take the D/A analog output into a unity gain op-amp that has a +2.5vdc offset to the - input of the opamp and that uses + and - voltage rails and then you would have a AC output voltage centered on 0v, going both positive and negative.

For simple audio use, you can most likely just pass the D/A output through a say .5mfd series capacitor and using a common ground connection from the converter to the device you are wiring to, and it will be a true zero based ac voltage. Recall that a cap passes AC but blocks DC voltages.

Lefty

With no relation to anything else I have talked about on this post, how can I generate the inverse voltage of the input? 5v generates maybe
-4.98V and so forth.

http://arduino.cc/en/Reference/Map

That makes negative integers. I want a negative voltage.

You need a part like this then.
http://www.analog.com/static/imported-files/data_sheets/AD1851_1861.pdf
It needs a negative supply so you can output a negative voltage.
If you search further, either at analog devices or at maxim-ic.com, you might even find one with an internal negative supply source.
These do not put out much current, so you may need a buffer after it depending on your needs.

The simplest way it to have two power supplies one for the positive and one for the negative voltage. You then connect the -ve of one supply to the +ve of the other. This point then becomes your ground or reference point. Then the +ve end is the positive voltage and the -ve end is the negative voltage. You can then use these voltages to feed into your op-amps or A/D or D/A.

So like two batteries in series, with one wire at each end and ground in the center?

Exactly. Two AAs will yield +/= 1.5V
6 will yield +/- 4.5V.

How can I do that with arduino? I don't want to power an op-amp off batteries.

By using mains power adapters.

Is that a negative voltage, or just ground (0V)?

No it is a negative voltage.

Voltages are a relative measure, they are always measured with reference to some other potential. If you connect the positive end of a supply to ground the other end is a negative voltage (with respect to ground)

Really!?!?!?! So arduino 5V+Wall wart 6V can make +5V to -6V?

No that's not what I said.