alexandros
Well-known member
This is a question regarding electronic circuits rather than code, but I'm posting it in case someone can provide some tips.
I want to amplify the signal of the MCP4728 DAC from Adafruit to a range from 0 to 10V. I'm using a TL072 op amp with the current circuit
And this is the code:
I'm sending messages from the serial monitor like this one "0c2047v" which assigns the value 2047 to channel 0. The readings I get from my multimeter from the DAC are correct but the readings I get from the op amp are correct only for values above 1100. If I send a value less than 1100 the op amp starts raising its voltage and when I send a 0 value the op amp outputs 11.71V. I'm using a 12V power supply for the op amp.
Anyone knows why this is happening?
I want to amplify the signal of the MCP4728 DAC from Adafruit to a range from 0 to 10V. I'm using a TL072 op amp with the current circuit
And this is the code:
Code:
#include <Adafruit_MCP4728.h>
Adafruit_MCP4728 mcp;
int channel;
int value;
void setup() {
mcp.begin();
// initialize all channels to 0
for (int i = 0; i < 4; i++) {
mcp.setChannelValue((MCP4728_channel_t)i, 0);
}
Serial.begin(115200);
while (!Serial);
}
void loop() {
if (Serial.available()) {
// receive a message of the type "0c1023v"
// which will send 1023 to channel 0
static int temp;
byte in = Serial.read();
if (isDigit(in)) {
temp = temp * 10 + in - '0';
}
else {
if (in == 'c') {
channel = temp;
temp = 0;
}
else if (in == 'v') {
value = temp;
temp = 0;
mcp.setChannelValue((MCP4728_channel_t)channel, value);
Serial.print("channel: ");
Serial.print(channel);
Serial.print(", value: ");
Serial.println(value);
}
}
}
}
Anyone knows why this is happening?