Go Down

Topic: Trying to find the address of an I2C device (Read 611 times) previous topic - next topic

laurencekillick424

I recently raised the question of how to find the address of an I2C device and was told that one should be able to find it in the data sheet or in some cases to assign it oneself.

I have searched the data sheet of the DTH11 temp and humidity sensor and I cant find any reference to an address.  Is it possible to quiz the device and get the address that way or am I just too dim to see it on the datasheet?   Or if I have to assign it could someone point me to where the process is explained?  I have searched numerous websites and not found any reference to assigning an address for an I2C device.

I have just watched Jeremy Blum Arduino Tutorial 7 which covers I2C and he uses address 72 for his particular device but does not mention where he found it or how he assigned that number.

As always, any help will be really appreciated.

Laurence

Riva

Cut and past the code from here http://playground.arduino.cc/Main/I2cScanner and upload it to your arduino with the DTH11 plugged in.
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

laurencekillick424

Thank you - that looks like just the thing I need.

UKHeliBob

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

zarobhr


Is the DHT11 an I2C device ?

i dont think so here is what i found

5. Communication Process: Serial Interface (Single-Wire Two-Way)
Single-bus data format is used for communication and synchronization between MCU and DHT11 sensor. One communication process is about 4ms.
Data consists of decimal and integral parts. A complete data transmission is 40bit, and the sensor sends higher data bit first.
Data format: 8bit integral RH data + 8bit decimal RH data + 8bit integral T data + 8bit decimal T data + 8bit check sum. If the data transmission is right, the check-sum should be the last 8bit of "8bit integral RH data + 8bit decimal RH data + 8bit integral T data + 8bit decimal T data".

UKHeliBob

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Riva

Grab a suitable library from this tutorial http://learn.adafruit.com/dht
Works on my DHT22 okay.
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

laurencekillick424

Thank you folks.  I'm not sure now why I came to believe that the DHT11 is an I2C device.   I ran the I2C scanner program on it and got an address back but it changed each time I ran the scanner.   However, I do have a couple of I2C devices and all this is part of the learning curve, I guess.  Tonight I am not going to stop until I get a temperatue and RH value .......

I am always amazed at teh speed of response on this forum and peoples readiness to give freely of their time and expertise.  I, and many others I suspect, would have consigned their Arduinos to the bottom drawer without this extraordinary technical resource.

Go Up