Pages: [1]   Go Down
Author Topic: Help! How to use ADT7420 with Arduino  (Read 639 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, everybody.

I have bought ADT7420 temperature sensor.
I have connected it to Arduino, but I think it seems connection wrong or code is wrong.
Because there are very little information and code about it on internet, so I cannot find a solution.

Could you kindly give me suggestions?

I connected like it
https://www.dropbox.com/s/fhbczrxtd7bqs8r/DSC_0003.jpg

I have used this code
http://www.ccad.sist.chukyo-u.ac.jp/~mito/ss/Embedded/Arduino/temp/index.htm

Code:
#include <I2C.h>
#define ADT 0x48

int i,ans;
long temp;

void setup()
{
  I2c.begin();        //
  Serial.begin(9600);  // start serial for output
  delay(10);
  I2c.read(ADT,0x0B,1);
  byte st=I2c.receive();
  Serial.print("ID:(0xCB):");
  Serial.println(st, HEX);
}

void loop()
{
  int i;
  byte xH,xL;

  Serial.print("temp:");
  I2c.read(ADT,0x0,2);
   xH = I2c.receive();
   xL = I2c.receive();
   Serial.print(xH,HEX);
   Serial.print(xL,HEX);
   Serial.print(": ");
   Serial.print(int (long(word(xH,xL)/8) * 100/16));
   Serial.println(":0.01deg");
  delay(500);
}

Then, result is

ID:(0xCB):CB
temp:A40: 2050:0.01deg
temp:A38: 2043:0.01deg
temp:A40: 2050:0.01deg
temp:A38: 2043:0.01deg
temp:A40: 2050:0.01deg
temp:A40: 2050:0.01deg
temp:A40: 2050:0.01deg

Thanks reply to me smiley


Regards.
« Last Edit: March 31, 2013, 02:02:12 am by junkai » Logged

Barcelona
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could you tell us more information about how you have connected it?


Rubén  smiley-wink
Logged

Pages: [1]   Go Up
Jump to: