tags:

views:

505

answers:

2

Hi All,

I have a temperature sensor, which is connected using an USB-I2C adapter (http://www.robot-electronics.co.uk/htm/usb%5Fi2c%5Ftech.htm) I attached this device to my linux computer (suse10). I typed dmesg and saw

usb 3-3: new full speed USB device using ohci_hcd and address 10
usb 3-3: new device found, idVendor=0403, idProduct=6001
usb 3-3: new device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-3: Product: FT232R USB UART
usb 3-3: Manufacturer: FTDI
usb 3-3: SerialNumber: A7007K93
usb 3-3: configuration #1 chosen from 1 choice
ftdi_sio 3-3:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 3-3: FTDI USB Serial Device converter now attached to ttyUSB0

But I have no idea how to read the current temperature.

updated 1: Actually the I2C bus can attach up to 127 sensors. But I have no idea how to list the addresses of available sensors.

Can anybody give me some hints? Thanks in advance

+3  A: 

Your adapter allows you to send I2C commands over a virtual serial port. A serial port has been created for you. You need to open it and send commands to it. The commands are specific to the device you are connected to. See the example in the link you provided to get an idea.

It is hard to give you correct instructions without a datasheet. Most probably your device will use one byte address and the read procedure is as follows:

[I2C_AD1] [Device I2C address + Read bit] [Device Address register] [Number of bytes to read]
0x55 0xXX 0x00 0x01

You need to send 4 bytes to the serial port. The first one instructs the USB to I2C converter to send a read command. The second one is the address of the device attached to the I2C bus. I2C devices use 7-bit addresses (0-127). Usually these are given with one bit shifted at the left. Therefore you need to scan these addresses (iterate from 0 to 127, shift left one bit, set bit0 to 1):

([0x00 - 0x7F] << 1) | 1

Since we don't have a datasheet I can't tell anything about the last two bytes. You could try to use dummy values. If a device is attached to the scanned I2C address, it should reply with a NACK to an attempt to read a non-existing register. Read commands sent to an I2C address that doesn't correspond to an actual device should be ignored.

kgiannakakis
Thanks, this is in the correct direction. However, I am not sure, which command I should send. I was only successfully queried the revision number of the firewire. I am still not able to scan all possible device addresses (maximal 127) and am not able to read the value of available devices.
stanleyxu2005
Which temperature sensor are you using? Is there a datasheet available somewhere?
kgiannakakis
Hi, I am still searching for datasheet of the temperature sensor. But I think, even without any datasheet, it should still have a way to scan, which addresses are occupied. Is it possible?
stanleyxu2005
See my edited reply for an example.
kgiannakakis
A: 

Hello everybody, I have a similar problem. I am trying to develop a C Program to drive Blinkm http://blinkm.thingm.com but how to do ? I suppose that my addresse (0x09 or 0x00) in broadcast is not good. I try with de left shifted (0x12) but always not working ... Please can you help me ? Thanks. Thomas

Thomas