{"product_id":"usb-i2c-module","title":"USB - I2C Module","description":"\u003cp\u003e \u003c\/p\u003e\n\u003cp align=\"left\"\u003eThe\u003cstrong\u003e USB-I2C\u003c\/strong\u003e module provides a  complete interface between your PC and the I2C bus. The module is self powered  from the USB cable and can supply up to 70mA at 5v for external circuitry from a  standard 100mA USB port. The module is an I2C master only, not a slave.\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eFirst Step - Get The Drivers\u003c\/strong\u003e\u003cbr\u003e\nThe USB-I2C module uses the \u003ca href=\"http:\/\/www.ftdichip.com\/Products\/FT232R.htm\"\u003e\u003cstrong\u003eFTDI  FT232R USB chip\u003c\/strong\u003e\u003c\/a\u003e to handle all the USB protocols. The documentation provided by FTDI  is very complete,  and is not duplicated here. Before using the USB-I2C, you will need to  install FTDI's Virtual COM Port ( VCP ) Drivers. These drivers appear to the  system as an extra Com Port ( in addition to any existing hardware Com Ports ).  Application software accesses the USB device in the same way as it would access  a standard Windows Com Port using the Windows VCOMM API calls or by using a Com  Port  Library. Drivers are available for Windows, Apple, Linux and  Open BSD systems directly from the \u003ca target=\"_blank\" href=\"http:\/\/www.ftdichip.com\"\u003e\u003cstrong\u003eFTDI  website\u003c\/strong\u003e\u003c\/a\u003e. You should get and install the drivers now, before you connect the USB-I2C  to your computer. The Drivers page is \u003ca target=\"_blank\" href=\"http:\/\/www.ftdichip.com\/FTDrivers.htm\"\u003e\u003cstrong\u003ehere\u003c\/strong\u003e\u003c\/a\u003e. \u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eWhich COM port?\u003cbr\u003e\n\u003c\/strong\u003eAfter installing the drivers, and plugging in the USB-I2C module to a spare USB  port, you will want to know which COM port it has been assigned to. This will  vary from system to system depending on how many COM ports you currently have  installed. To find out where it is, right click on your \"My Computer\"  desktop icon and select the \"Device Manager\" tab. Now scroll down and  open the \"Ports (COM \u0026amp; LPT)\" tab. You should see the USB serial  port listed - COM2 in the example below. If you want to change the COM port  number - just right click on it, select properties, select advanced and select  the COM port number from the available list. The COM port should be set up for 19200 baud, 8 data bits, no parity and two stop  bits. \u003c\/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg width=\"410\" height=\"448\" border=\"0\" src=\"\/images\/win98.dm.jpg\" alt=\"\"\u003e\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eConnections\u003c\/strong\u003e\u003cbr\u003e\nThe diagram below shows the I2C connections.\u003c\/p\u003e\n\u003cp align=\"center\"\u003e\u003cstrong\u003e\u003cimg width=\"543\" height=\"149\" border=\"0\" src=\"\/images\/usb-i2c-b.jpg\" alt=\"\"\u003e \u003c\/strong\u003e\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003e0v Gnd\u003cbr\u003e\n\u003c\/strong\u003eThe 0v Gnd pin must be connected to the 0v (Ground) on your I2C device.\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eInput 1\u003cbr\u003e\n\u003c\/strong\u003eThe Input 1 pin is actually the processor reset line and is used in our  workshop to program the processor after final assembly. The reset function has  been disabled in software so that this pin may be used as an input pin. It has a  47k pull-up resistor on the PCB, so if the input is not required you can just  ignore it.\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eSCL and SDA\u003c\/strong\u003e \u003cbr\u003e\nThese pins are the I2C bus connections. They should be connected directly to the  SCL and SDA pins on your I2C device. The USB-I2C module is always a bus master,  and is fitted with 4.7k pull-up resistors on the PCB. \u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003e+5v\u003cbr\u003e\n\u003c\/strong\u003eThe +5v supply from the USB-I2C module can supply up to 70mA to external  devices. If your I2C device requires more than this, or has its own supply, then  leave the +5v pin unconnected. Do not apply your own 5v supply to this pin.\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eCommands\u003c\/strong\u003e\u003cbr\u003e\nThe USB-I2C responds to commands sent to it from the PC. There  are just three primary commands: \u003cbr\u003e\nI2CD_CMD (0x53) - This allows you to read or write to I2C devices that do not  have internally addressable registers, such as the Philips PCF8574 I\/O expander.\u003cbr\u003e\nI2C_CMD (0x55) - This allows you to read or write to internally registered  devices such as EEPROM's or our own range of modules.\u003cbr\u003e\nUSB-I2C_CMD (0x5A) - A range of commands to the USB-I2C module, generally to improve  selected communications.\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eWriting to I2C devices without internally addressable  registers\u003c\/strong\u003e\u003cbr\u003e\nThese include devices such as the Philips PCF8574 I\/O expander. Following the  I2CD_CMD you send the devices I2C address and the data byte.\u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"16%\" align=\"right\"\u003e \u003c\/td\u003e\n            \u003ctd width=\"16%\" align=\"center\"\u003ePrimary USB-I2C command\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eDevice Address + R\/W bit\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eThe data byte\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"16%\" align=\"right\"\u003eByte Type\u003c\/td\u003e\n            \u003ctd width=\"16%\" align=\"center\"\u003eI2CD_CMD\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eAddr+R\/W\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eData\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"16%\" align=\"right\"\u003eExample\u003c\/td\u003e\n            \u003ctd width=\"16%\" align=\"center\"\u003e0x53\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003e0x40\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003e0x00\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"16%\" align=\"right\"\u003eMeaning\u003c\/td\u003e\n            \u003ctd width=\"16%\" align=\"center\"\u003eDirect Read\/Write command\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003ePCF8574 I2C address\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eSet all bits low\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp align=\"left\"\u003eThis 3 byte sequence sets all bits of a PCF8574 I\/O expander  chip low.  All 3 bytes should be sent to the USB-I2C in one sequence. A gap will result in the  USB-I2C re-starting its internal command synchronization loop and ignoring the  message. After all bytes have been received the USB-I2C performs the IC2 write  operation out to the PCF8574 and sends a single byte back to the PC. This returned  byte will be 0x00 (zero) if the write command failed and non-zero if the write  succeeded. The PC should wait for this byte to be returned (timing out after  500mS) before proceeding with the next transaction.\u003cbr\u003e\n\u003cstrong\u003e\u003cbr\u003e\nReading from I2C devices without internally addressable registers\u003c\/strong\u003e\u003cbr\u003e\nThis is similar to writing, except that you should add 1 to the device address  to make it an odd number. To read from a PCF8574 at address 0x40, you would use  0x41 as the address. (When the address goes out on the I2C bus, its the 1 in the  lowest bit position that indicates a read cycle is happening). Here is an  example of reading the inputs on a PCF8574 I\/O expander:\u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eI2CD_CMD\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003ePCF8574 I2C address + Read bit\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0x53\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0x41\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp align=\"left\"\u003eThe USB-I2C will perform the read operation on the I2C bus and send  a single byte (the PCF8574 inputs) back to the PC. The PC should wait for the  byte to  be returned (timing out after 500mS) before proceeding with the next  transaction.\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eWriting to I2C devices with internally addressable registers\u003c\/strong\u003e\u003cbr\u003e\nThis includes almost all I2C devices. Following the I2C_CMD you send the device  I2C address, then the devices internal register  address you want to write to and the number of bytes you're writing. The  maximum number of data bytes should not exceed 60 so as not to overflow the USB-I2C's internal buffer.\u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"16%\" align=\"right\"\u003e \u003c\/td\u003e\n            \u003ctd width=\"16%\" align=\"center\"\u003ePrimary USB-I2C command\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eDevice Address + R\/W bit\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eDevice internal register\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eNumber of data bytes\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eThe data bytes\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"16%\" align=\"right\"\u003eByte Type\u003c\/td\u003e\n            \u003ctd width=\"16%\" align=\"center\"\u003eI2C_CMD\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eAddr+R\/W\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eReg\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eByte Count\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eData\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"16%\" align=\"right\"\u003eExample\u003c\/td\u003e\n            \u003ctd width=\"16%\" align=\"center\"\u003e0x55\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003e0xE0\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003e0x00\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003e0x01\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003e0x51\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"16%\" align=\"right\"\u003eMeaning\u003c\/td\u003e\n            \u003ctd width=\"16%\" align=\"center\"\u003ePrimary USB-I2C command\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eSRF08 I2C address\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eSRF08 command Reg\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eOne command byte follows\u003c\/td\u003e\n            \u003ctd width=\"17%\" align=\"center\"\u003eStart ranging in cm\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp align=\"left\"\u003eThis 5 byte sequence starts an SRF08 at address 0xE0 ranging.  All 5 bytes should be sent to the USB-I2C in one sequence. A gap will result in the  USB-I2C re-starting its internal command synchronization loop and ignoring the  message. After all bytes have been received the USB-I2C performs the IC2 write  operation out to the SRF08 and sends a single byte back to the PC. This returned  byte will be 0x00 (zero) if the write command failed and non-zero if the write  succeeded. The PC should wait for this byte to be returned (timing out after  500mS) before proceeding with the next transaction.\u003cbr\u003e\nHere is another write example - this time an 8 byte sequence to initialize the  MD22 motor driver: \u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"12%\"\u003e\n            \u003cp align=\"center\"\u003eI2C_CMD\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"12%\"\u003e\n            \u003cp align=\"center\"\u003eMD22 Addr+R\/W\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"12%\"\u003e\n            \u003cp align=\"center\"\u003eMode Reg\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"12%\"\u003e\n            \u003cp align=\"center\"\u003eData byte count\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"13%\"\u003e\n            \u003cp align=\"center\"\u003eMD22 mode 1\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"13%\"\u003e\n            \u003cp align=\"center\"\u003eLeft Motor Stopped\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"13%\"\u003e\n            \u003cp align=\"center\"\u003eRight Motor Stopped\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"13%\"\u003e\n            \u003cp align=\"center\"\u003eFast acceleration\u003c\/p\u003e\n            \u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"12%\"\u003e\n            \u003cp align=\"center\"\u003e0x55\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"12%\"\u003e\n            \u003cp align=\"center\"\u003e0xB0\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"12%\"\u003e\n            \u003cp align=\"center\"\u003e0x00\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"12%\"\u003e\n            \u003cp align=\"center\"\u003e0x04\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"13%\"\u003e\n            \u003cp align=\"center\"\u003e0x01\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"13%\"\u003e\n            \u003cp align=\"center\"\u003e0x00\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"13%\"\u003e\n            \u003cp align=\"center\"\u003e0x00\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"13%\"\u003e\n            \u003cp align=\"center\"\u003e0x02\u003c\/p\u003e\n            \u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp align=\"left\"\u003eAgain the USB-I2C will respond with non-zero if the write succeeded  and zero if it failed. A failure means that no acknowledge was received from the  I2C device.\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eReading from I2C devices with internally addressable  registers\u003c\/strong\u003e\u003cbr\u003e\nThis is similar to writing, except that you should add 1 to the device address  to make it an odd number. To read from an SRF08 at address 0xE0, you would use  0xE1 as the address. (When the address goes out on the I2C bus, its the 1 in the  lowest bit position that indicates a read cycle is happening). The maximum  number of data bytes requested should not exceed 60 so as not to overflow the USB-I2C's internal buffer. Here is an  example of reading the two byte bearing from the CMPS03 compass module:\u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eI2C_CMD\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eCPMS03 I2C address + Read bit\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eCMPS03 bearing register\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eNumber of bytes to read\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0x55\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0xC1\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0x02\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0x02\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp align=\"left\"\u003eThe USB-I2C will perform the read operation on the I2C bus and send  two bytes back to the PC - high byte first. The PC should wait for both bytes to  be returned (timing out after 500mS) before proceeding with the next  transaction.\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eUSB-I2C\u003c\/strong\u003e\u003cstrong\u003e Commands\u003cbr\u003e\n\u003c\/strong\u003eThe USB-I2C command format is shown below:\u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eUSB-I2C_CMD\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eUSB-I2C Command\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eData 1\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eData2\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e 0x5A\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eSee below\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eCommand Specific\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eCommand Specific\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp align=\"left\"\u003eThe USB-I2C commands are always a four byte sequence. They  start with the USB-I2C_CMD primary command which is followed by the USB-I2C command  itself. Two data bytes follow which can be any junk if not used, but they must  be included to make up the 4 byte command sequence. These commands  are: \u003c\/p\u003e\n\u003cdiv align=\"center\"\u003e\u003ccenter\u003e\n\u003ctable width=\"645\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003eHex\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003e\n            \u003cp align=\"center\"\u003eCommand\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003eBytes returned\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003ePurpose\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x01\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eREVISION \u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e1\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003eReturns the USB-I2C firmware revision number\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x02\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eNEW_ADDRESS\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e1\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003eChanges SRF08 I2C address\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x03\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eUNUSED\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e1\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003eUnused - for CM02 compatibility only -          returns 0x00\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x04\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eSCAN1\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e6\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003eSend motor data - return battery, compass          \u0026amp; sonar data \u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x05\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eSCAN2\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e9\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003eSame but for 2 SRF08's\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x06\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eSCAN3\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e12\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003e3 SRF08's\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x07\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eSCAN4\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e15\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003e4\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x08\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eSCAN6\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e21\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003e6\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x09\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eSCAN8\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e27\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003e8\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x0A\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eSCAN12\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e39\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003e12\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x0B\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eSCAN16\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e51\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003eAll 16 possible SRF08's\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x10\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eSETPINS\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e1\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003eSets I\/O pins high\/low\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x11\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eGETPINS\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e1\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003eGets the status of I\/O pins \u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"46\" align=\"center\"\u003e0x12\u003c\/td\u003e\n            \u003ctd width=\"132\" align=\"center\"\u003eGETAD\u003c\/td\u003e\n            \u003ctd width=\"84\" align=\"center\"\u003e4\u003c\/td\u003e\n            \u003ctd width=\"373\" align=\"center\"\u003eGets Analogue value on I\/O2 and I\/O3\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003c\/center\u003e\u003c\/div\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eREVISION\u003c\/strong\u003e is used to read the USB-I2C firmware revision. It  returns a single byte indicating the revision number. The two data bytes are  unused and can be anything, but they must be sent.\u003cbr\u003e\n\u003cstrong\u003eNEW_ADDRESS\u003c\/strong\u003e command is used to change an SRF08's I2C address to a  different address. The new address should be in the first of the two data bytes.  The second data byte is unused and can be anything, but it must be sent.  Changing the address on the SRF08 requires 4 separate transactions on the I2C  bus. The USB-I2C know how to change an SRF08's I2C address and just needs you to  send it the new address using this command. When using it, make sure you only  have one SRF08 connected, otherwise you will set every SRF08 on the bus to the  same address. The single return byte is the new address sent back when the task  is complete.\u003cbr\u003e\n\u003cstrong\u003eUNUSED\u003c\/strong\u003e Unused - for CM02 compatibility only - returns 0x00.\u003cbr\u003e\n\u003cstrong\u003eSCAN\u003c\/strong\u003e This command is provided for CM02 compatibility. It  assumes you have an MD22 motor controller, a CMPS03 compass module and a number  of SRF08 rangefinders. SCAN1 assumes 1 SRF08, SCAN8 assumes 8 SRF08's. The two  data bytes contain the Left and Right motor speed values for the MD22 motor  controller. After sending the new motor speeds to the MD22, the USB-I2C will send a  return frame comprising the battery voltage (0x00 - see above). This is followed by two bytes of  compass bearing - high byte first, and then three bytes for each SRF08. The  first of the three bytes is the SRF08's light sensor reading. The next two bytes  is the range - high byte first. \u003cbr\u003e\nFor example, if the SCAN2 command is used, you would receive a 9 byte return:\u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"11%\" align=\"center\"\u003e\n            \u003cp align=\"center\"\u003eBattery Volts\u003cbr\u003e\n            (reads 0x00)\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"11%\" align=\"center\"\u003e\n            \u003cp align=\"center\"\u003eCompass bearing high byte\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"11%\" align=\"center\"\u003e\n            \u003cp align=\"center\"\u003eCompass bearing low byte\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"11%\" align=\"center\"\u003e\n            \u003cp align=\"center\"\u003eSRF08 at 0xE0\u003cbr\u003e\n            Light sensor\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"11%\" align=\"center\"\u003e\n            \u003cp align=\"center\"\u003eSRF08 at 0xE0\u003cbr\u003e\n            Range high byte\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"11%\" align=\"center\"\u003e\n            \u003cp align=\"center\"\u003eSRF08 at 0xE0\u003cbr\u003e\n            Range low byte\u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd width=\"11%\" align=\"center\"\u003eSRF08 at 0xE2\u003cbr\u003e\n            Light sensor\u003c\/td\u003e\n            \u003ctd width=\"11%\" align=\"center\"\u003eSRF08 at 0xE2\u003cbr\u003e\n            Range high byte\u003c\/td\u003e\n            \u003ctd width=\"12%\" align=\"center\"\u003eSRF08 at 0xE2\u003cbr\u003e\n            Range low byte\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp\u003eSRF08 data is always returned starting with address 0xE0, 0xE2, 0xE4 - going  up one address at a time until all requested SRF08's data has been sent.\u003cbr\u003e\nAfter sending the data back up to the PC, the USB-I2C automatically issues a new  ranging command to all SRF08s. The ranging command used is 82 (0x52) which returns  the results in uS. To convert to cm divide by 58 and to convert to inches divide  by 148.\u003cbr\u003e\nSRF08 addresses should have been set up before running this command and the MD22  should be initialized to the mode and acceleration required. One more important  feature. The SCAN command also sets up a 500mS timer on the USB-I2C. If another  SCAN command is not received within this time, a command is automatically sent to the MD22  to stop the motors. This is to prevent your robot wandering out  of control if it ventures outside of the range of the radio link. \u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eLEDs\u003c\/strong\u003e\u003cbr\u003e\nThere are two status Leds on the USB-I2C. A red Led indicates power is on and the  green Led flashes briefly when a command is received. The red Led can be turned  on and off using the SETPINS command. See below.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eI\/O Pins  \u003c\/strong\u003e\u003cbr\u003e\nIf the USB-I2C module is not being used for I2C, it can be used as general  purpose I\/O controller with three I\/O lines. Input 1 is always an input only pin  and has a 47k pull-up resistor (not 4.7k like the others). The other two can be input or output. The outputs  are set high\/low with the SETPINS command. The pin is not actively driven high, it is released and  pulled high by a 4.7k resistor. Output low is actively driven and can sink a maximum of  24mA. GETPINS will return the status of the I\/O pins. To use an I\/O pin as an  input, it must first have a 1 (high) written to it. This will release the pin so  that the 4.7k resistor will pull it high, it can then be used as an input. Both  SETPINS and GETPINS commands will return the status of the I\/O Pins, however,  only SETPINS can change them. The bits in the data byte written by SETPINS and  returned by SETPINS and GETPINS have the following format:\u003c\/p\u003e\n\u003cdiv align=\"center\"\u003e\u003ccenter\u003e\n\u003ctable cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003e7\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003e6\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003e5\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003e4\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003e3\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003e2\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003e1\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003e0\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003ex\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003ex\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003ex\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003ex\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003eI\/O3\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003eI\/O2\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003eInput1\u003c\/td\u003e\n            \u003ctd width=\"60\" align=\"center\"\u003eRed Led\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003c\/center\u003e\u003c\/div\u003e\n\u003cp\u003eThe following command will turn the Red led off and make the I\/O lines high  so they can be used as inputs:\u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eUSB-I2C_CMD\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eSETPINS Command\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eData 1\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eData2\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e 0x5A\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e 0x10\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0x0E\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0x00 (unused)\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp\u003e\u003cstrong\u003eAnalogue Inputs\u003c\/strong\u003e\u003cbr\u003e\nThe USB-I2C module can also convert the analogue values on pins I\/O2 and I\/O3.  Before doing this the I\/O pins should be set high, effectively making them  inputs. Remember though that this is primarily a USB to I2C interface and as  such has 4k7 pull-up resistors. Take this into account when connecting your  analogue input.\u003c\/p\u003e\n\u003cp\u003eThe following command will fetch the analogue values:\u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eUSB-I2C_CMD\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eGETAD Command\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eData 1\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eData2\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e 0x5A\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e 0x12\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0x00 (unused)\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003e0x00 (unused)\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp\u003eWith analogue data returned in the following format:\u003c\/p\u003e\n\u003ctable width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bgcolor=\"#ffffcc\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eByte 1\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eByte 2\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eByte 3\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eByte 4\u003c\/td\u003e\n        \u003c\/tr\u003e\n        \u003ctr\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eI\/O2 High Byte\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eI\/O2 Low Byte\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eI\/O3 High Byte\u003c\/td\u003e\n            \u003ctd width=\"25%\" align=\"center\"\u003eI\/O3 Low Byte\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp\u003eThe analogue inputs use 10-bit conversion, so you will see values from 0 to  1024 (0x0000 to 0x03FF)\u003c\/p\u003e\n\u003cp class=\"stockOut\"\u003e\u003cstrong\u003eNote - you cannot  mix I\/O mode and I2C mode,  I\/O commands should not be used when I2C devices are  connected. \u003c\/strong\u003e\u003c\/p\u003e\n\u003cp align=\"left\"\u003e\u003cstrong\u003eUSB-I2C Test Software\u003cbr\u003e\n\u003c\/strong\u003eTo help you test and get the USB-I2C up and running quickly, we have  provided a couple of simple test programs. The first is for the USB-I2C connected to an SRF08 ultrasonic  ranger.\u003c\/p\u003e\n\u003cdiv align=\"center\"\u003e\u003ccenter\u003e\n\u003ctable border=\"0\"\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd\u003e\u003cimg width=\"300\" height=\"220\" border=\"0\" src=\"\/images\/usb-srf08.jpg\" alt=\"\"\u003e\u003c\/td\u003e\n            \u003ctd\u003e    \n            \u003cp\u003e \u003c\/p\u003e\n            \u003c\/td\u003e\n            \u003ctd\u003e\u003cimg width=\"249\" height=\"262\" border=\"0\" src=\"\/images\/usb-i2c-2.jpg\" alt=\"\"\u003e\u003c\/td\u003e\n        \u003c\/tr\u003e\n    \u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003c\/center\u003e\u003c\/div\u003e\n\u003cp align=\"left\"\u003eThe connector on the USB-I2C module may be soldered directly to  the SRF08 as shown, or you can use a cable if preferred. The USB-I2C module can  easily supply the 25mA peak of the SRF08. The software automatically searches  for the SRF08 and displays its I2C address, along with revision number, range  and light sensor reading. You can download \u003ca href=\"http:\/\/www.robot-electronics.co.uk\/files\/USB_I2C_SRF08.exe\"\u003e\u003cstrong\u003eusb_i2c_srf08.exe\u003c\/strong\u003e\u003c\/a\u003e and the \u003ca href=\"http:\/\/www.robot-electronics.co.uk\/files\/usb_i2c_srf08.zip\"\u003e\u003cstrong\u003eC source code\u003c\/strong\u003e\u003c\/a\u003e here.\u003c\/p\u003e\n\u003cp align=\"left\"\u003eThe second is for testing I\/O modes, and allows you to set\/clr  the I\/O's as well as read the digital and analogue inputs.\u003c\/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg width=\"324\" height=\"244\" border=\"0\" src=\"\/images\/usb-i2c-c.jpg\" alt=\"\"\u003e\u003c\/p\u003e\n\u003cp align=\"left\"\u003eYou can download \u003ca href=\"http:\/\/www.robot-electronics.co.uk\/files\/usb_i2c_io.exe\"\u003e\u003cstrong\u003eusb_i2c_io.exe\u003c\/strong\u003e\u003c\/a\u003e and the \u003ca href=\"http:\/\/www.robot-electronics.co.uk\/files\/usb_i2c_io.zip\"\u003e\u003cstrong\u003eC source code\u003c\/strong\u003e\u003c\/a\u003e here.\u003c\/p\u003e","brand":"Devantech","offers":[{"title":"1 Giorno","offer_id":47169867219289,"sku":"USB-I2C\/A","price":27.15,"currency_code":"EUR","in_stock":true},{"title":"2-4 Settimane","offer_id":47890035802457,"sku":"USB-I2C","price":27.15,"currency_code":"EUR","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0781\/1009\/7753\/files\/usb-i2c_5.jpg?v=1695766316","url":"https:\/\/xernuqvalzi.pro\/products\/usb-i2c-module","provider":"Robot Italy","version":"1.0","type":"link"}