DAC is eating my signal >:(

Well, I’m kind of new to working with I2C, so I’m experimenting.

I’ve got both a MAX521 DAC and a TC74A2 temperature sensor on the I2C bus. These two have different addresses (B0101000 for the DAC and B1001010 for the temperature sensor), yet for some reason the DAC seems to eat my I2C commands to the Temperature sensor!

When both are connected to the I2C bus (in parallel), and I send a command to the DAC, it responds correctly, but when I send a command to the TC74A2, it does not.

The TC74A2 responds correctly if I remove both +5V AND ground from the DAC (not if I leave ground connected though).

Could it be a power issue? Do I need stronger pullups than supplied internally through the Wire library?

I don’t think it’s the code, but here it is if you want to see it:

#include <MAXDAC.h>
#include <Wire.h>

int temperature;

#define address 0x4A

maxdac dac(B0101000);

void setup() {
  Serial.begin(115200);
  Wire.begin();
}

void loop() {
//BEGIN DAC PART
  for (int i=0; i<256; i++) {
    dac.write(1, i);
    delay(20);
  }
//END DAC PART
//BEGIN TEMPERATURE SENSOR PART
  Wire.beginTransmission(address);
  //start the transmission with the TC74A2
 
  Wire.send(0x00);
 
  Wire.requestFrom(address, 1);
    temperature = Wire.receive();
    Serial.println(temperature);
    Serial.print("And in Fahrenheit: ");
    Serial.println((temperature*1.8)+32);
  Serial.println("Starting over again");
  Wire.endTransmission();
//END TEMPERATURE SENSOR PART
  delay(1000);
}

PS: I’ve tried leaving the MAXDAC library in (and not using it) to test if that was conflicting, but the TC74A2 still works fine if the DAC isn’t powered.

THANKS :-?

Do I need stronger pullups than supplied internally through the Wire library?

Yes you need 4K7 pullups.

For the I2C bus the pullup resistance is determined by communication frequency and the capacitance on the bus. At 100KHz and only two devices on the bus the internal pullup should work. For 400KHz operation it probably won't.

On my boards I use values in the 4.7K to 10K range. You will get cleaner signals using an external pullup in this range.

(* jcl *)


www: http://www.wiblocks.com twitter: http://twitter.com/wiblocks blog: http://luciani.org

At 100KHz and only two devices on the bus the internal pullup should work.

But quite clearly it is not. Only one device works, either one separately is fine but two together is not. he is only using the internal pull ups. What other conclusion is there?

The signal looks appalling without external pull ups I am very surprised it works at all.

Difficult to troubleshoot over the net.

The pullup spec in the Atmel datasheet is

Rmax = 1000nS / Cbus for Fscl <=100KHz
Rmax = 300nS / Cbus for Fscl <=400KHz
Rmin = (Vcc - 0.4V) / 3mA

IIRC the internal pullup is 30-50K.

As I mentioned I would use a pullup in the 4.7K-10K range.

(* jcl *)

Thanks for the suggestions.

I tried using external 4k7 ohm resistors on both SCL and SDA, but it still didn't work. I then accidentally plugged 5V directly into the TC74A2 (and not the breadboard bus, and thus not the DAC), and it worked (because I also didn't have the SDA and SCL connected to the DAC)..

I measured my 5V from the Arduino out of curiosity, and my multimeter is telling me it's only about 4.6 volts!

Is my computer not supplying high enough voltage for both devices to work in parallel?

Is this my PSU or motherboard?

Are you powering the Arduino through the USB port? The spec for the USB port is 4.75V - 5.25V for a high-powered hub and 4.4V to 5.25V for a low powered hub.Your computer is most likely a low-powered USB and 4.6V is within the spec.

It is unlikely that these devices will draw much current. You should verify that they will operate in the 4.4V to 5.25V range.

(* jcl *)

I am indeed powering through the USB port.

I don’t think it’s drawing >500mA, as when that happens my computer automatically disconnects the port until the short (or high power device) is disconnected.

Looking at the datasheets, it certainly looks like they should work…

The MAX521 has a minimum supply voltage of 4.5V. Since the lower limit of USB spec is 4.4V and you are at 4.6V now you are close to the limit.

The temperature sensor looks like it operates to 2.7V.

(* jcl *)

But the thing is, the DAC seems to work fine regardless, it's the TC74A2 that's giving me problems.

The DAC should work. You are at 4.6V and the minimum spec is 4.5V.

For a more robust design I would have more margin. A different USB port could come in below the DAC voltage spec. If you switch a load on the voltage could drop below the spec. Having more margin would help to insure that your design works under various operating conditions.

It sounds like you had some sort of wiring problems.

I would do the following --

  1. connect everything back up
  2. Add the pullups (one less thing to worry about)
  3. Verify the power and ground voltages on all ICs. You could try wiggling the wires in case there is an intermittent connection.

If everything verifies and and it is still not working you may need a scope.

(* jcl *)