the_i2c_bus
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| the_i2c_bus [2020/01/15 23:08] – [Software for I²C devices: start with Arduino] tell | the_i2c_bus [2022/02/03 09:06] (current) – tell | ||
|---|---|---|---|
| Line 15: | Line 15: | ||
| * Each " | * Each " | ||
| * Addresses are 7 bits long, therefore there are only 128 possible addresses. | * Addresses are 7 bits long, therefore there are only 128 possible addresses. | ||
| - | * Some devices have pins that can chose from several addresses. | + | * Some devices have pins that can chose from several addresses. |
| ====== I²C Protocol ====== | ====== I²C Protocol ====== | ||
| - | The I²C standard defines the basic signalling | + | The I²C standard defines the basic signaling |
| * Claim the bus and start a transaction: | * Claim the bus and start a transaction: | ||
| * Stop and release the bus: release SDA to go high, while leaving SCL high | * Stop and release the bus: release SDA to go high, while leaving SCL high | ||
| * Send a byte (and get an acknowlegement) | * Send a byte (and get an acknowlegement) | ||
| * Read a byte | * Read a byte | ||
| + | | ||
| + | This figure shows the basic idea: start, write one byte, acknowledge, | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | All transfers start as shown here, with the master sending one byte onto the bus containing the 7 bit address and one bit that indicates whether the next byte will be a write (master to slave) or a read (slave sends to master). | ||
| + | |||
| + | A good, relatively simple explanation of data transfer is https:// | ||
| These get combined in various ways depending on the device. | These get combined in various ways depending on the device. | ||
| Line 29: | Line 38: | ||
| ====== I²C in FRC ====== | ====== I²C in FRC ====== | ||
| {{ : | {{ : | ||
| - | Since the introduction of the RoboRio, there has been an easy way to use I²C for FIRST robots. | + | Since the introduction of the RoboRio, there has been an easy way to use I²C for FIRST robots. |
| + | It uses the same housings and headers that hold pins on 0.1 inch centers. | ||
| + | |||
| + | In addition to SCL and SDA, there is a pin for 3.3v power, and a pin for the common ground for signal and power. | ||
| Around 2018-2019 we started to see packaged color and distance sensors from Rev Robotics and others. | Around 2018-2019 we started to see packaged color and distance sensors from Rev Robotics and others. | ||
| Line 43: | Line 55: | ||
| This is often the best place to find such examples. | This is often the best place to find such examples. | ||
| - | + | By 2021 there appeared FRC Java libraries for some of the I²C sensors that we've used. But going back to the Arduino C code is necessary for some of the interesting ones that are less common in FRC. | |
| - | + | ||
| - | + | ||
| ====== I²C in other maker/hobby wiring ====== | ====== I²C in other maker/hobby wiring ====== | ||
| + | |||
| ===== QWIIC ===== | ===== QWIIC ===== | ||
| Line 55: | Line 65: | ||
| [[http:// | [[http:// | ||
| - | (picture) | + | {{ : |
| Adafruit wants to call the same thing [[https:// | Adafruit wants to call the same thing [[https:// | ||
| + | |||
| + | ===== Eastbots I2C Tester ===== | ||
| + | |||
| + | In 2019 we had some flaky i2c operation, so we built this wiring tester | ||
| + | [[testing_i2c_wiring]] | ||
| + | |||
| + | |||
the_i2c_bus.1579147710.txt.gz · Last modified: 2020/01/15 23:08 by tell
