DAC

Hi All
I need use in my project digital Analog converter (DAC) type [ PCF8591 ] with Arduino.
so I need project have been used digital Analog converter (DAC) type [ PCF8591 ] with Arduino to benefiting of it.

Google "arduino pcf8591" for examples.

But, consider some of the other DACs, like this one, which comes with example code.

This should help you learn how to do these things:

PCF8591 and Arduino

thanks
I know this way for searching but my problem is :
I have variable voltage in arduino will get in pin A20 in PWM shape I need change this by PCF8591 to real analog

Below is DAC code for PCF8591

/***********************************************
#define PCF8591 (0x48) // I2C bus address
void setup()
{
Wire.pins(0,2);// just to make sure
Wire.begin(0,2);
}
void loop()
{
for (int i=0; i<255; ++i)
{
Wire.beginTransmission(PCF8591); // wake up PCF8591
Wire.write(0x40); // turn on DAC b1000000
Wire.write(i);
Wire.endTransmission();
}
}

Wire.pins(0,2);// just to make sure

Make sure of what?
Which Arduino. The Mega mentioned in your other two cross-posts
Then you have made sure that the wrong pins are used.

Read the "How to post" sticky, so we don't have to guess.
That post also explains how to post code properly, with code tags.
Leo..

sorry, I'm beginner in Arduino

my Arduino in mega

A Mega uses pin20 and pin21 for I2C (connect your chip to those pins).
The wire library automatically takes care of that, so don't put any pin numbers in the brackets.
Leo..

thanks
it's right

which pin is output pin???

I need convert my digital voltage will came from sensor to arduino and after to PCF8591 to convert to analog

Remove the 1k resistors.
1k pull up is too low, and a Mega already has build-in 10k pull up resistors.

Pin#15 is the analogue output of the D/A.
Why connect it back to an analogue input if you already know what the voltage will be (your code).
That output should go to an opamp with a gain of 1.5,
assuming you want that 0-7.5volt you mentioned in another thread.

You might get a more stable output voltage if you connect the Vref pin14 of the PCF to the 3.3volt pin of the Mega. And use an opamp with a gain of ~2.27.

What are you trying to do with that 0-7.5volt.
Is a simple RC filter with opamp gain/buffer not enough?
Leo..

I have variable voltage in arduino will get in pin A20 in PWM shape I need change this by PCF8591 to real analog

No that is not how things work. You send a number to the PCF8591 which represents the voltage you want and the PCF8591 produces that voltage. There is no PWM involved in this.

Not sure why the PCF8591.
A MCP4725 breakout board has 16x higher resolution (if only an D/A is needed).
Leo..