Inter-Integrated Circuit (I2C) is used by the LiDAR and IMU. I2C is another form of synchronous serial communication and requires two channels for communication between devices: serial data (SDA) and serial clock (SCL). SDA is used to both transmit and receive data. Since a pair of I2C lines can be used to drive multiple devices as shown in the figure below, each device has a pre-defined address to distinguish between peripherals, which is either 7-bits or 10-bits long and can be found in each device’s data sheet. In our case, the microcontroller would serve as the master and set the clock rate, and communicating sensors would serve as slaves. When transmitting data, first, the master sends the address of the slave that it wants to communicate with, and then either device sends bytes of data.
Microcontroller | Configuration Documentation |
---|---|
Arduino | Wire Library |
PIC32 | PIC32 I2C Library |
Raspberry Pi | smbus Library |