PDA

View Full Version : [Question(s)] I2C Header



tylerkess
03-29-2011, 09:52 AM
I'm trying to use the I2C header on an Arbotix board, but I don't which pins are SDA, SCL, power, and ground. I guess I can just use a voltage meter for power and ground, but I don't know how to check the data and clock signals. Anyone know?

Oh, and if it matters, the sensor I'm using on it is a Devantech Thermal Array Sensor.


Edit: I also know I need pull-up resistors on the data and clock lines, but I'm not entirely sure what those are, or how to use them.

Edit: I figured out what each of the pins does, but I still don't how to implement a pull-up resistor.

lnxfergy
03-29-2011, 12:56 PM
Hmm, does seem we don't have a picture in the manual. However, the VCC line is on top (near the motor drivers), and the schematic shows that SCL is next to VCC, then SDA, then ground at the bottom of the header.

A pullup resistor is simply going to be a 4.7k-ohm resistor between SDA and VCC and another between SCL and VCC.

-Fergs

tylerkess
03-29-2011, 06:17 PM
Thanks. I was reading on the sensor's info page that the I2C bus should have the pull up resistors in it. Does the Arbotix have them, or do I need to connect them externally?

lnxfergy
03-29-2011, 07:26 PM
Thanks. I was reading on the sensor's info page that the I2C bus should have the pull up resistors in it. Does the Arbotix have them, or do I need to connect them externally?

You'll have to install them externally.

-Fergs

tylerkess
03-31-2011, 05:43 PM
It's all hooked up.

Below is some code I found on Google Code that is supposed to test it, but it doesn't do anything. Any ideas what might be wrong with it?

// This is a simple example of how to use the TPA81 library
#include <Wire.h>
#include <Tpa81.h>
// Create an instance of Tpa81, constructor is Tpa81(deviceID)
Tpa81 thermo = Tpa81(0);
void setup(){ // this is called once
Wire.begin(); // this must be called to start the I2C bus
Serial.begin(38400);
}
void loop(){ // print a reading every 2 seconds
int i;
unsigned char reading[8];
// query the sensor
i = thermo.getData(reading);

// send up data to PC like "AMBIENT: p1, p2.... p8.\n"
Serial.print(i); // print the ambient temperature;
Serial.print(": ");
Serial.print((int)reading[0]);
for(i=1;i<8;i++){
Serial.print(",");
Serial.print((int)reading[i]);
}
Serial.println(".");
delay(2000);
}