Not to be confused with clock stretching, clock speed is simply the frequency at which the SCL (clock) line is driven. The I2C specification defines several standard clock speeds as follows:
- 100 kHz = Standard Mode
- 400 kHz = Fast Mode
- 1 MHz = Fast Mode Plus
- 1.7 and 3.4 MHz = High Speed Mode
- 5 MHz = Ultra Fast Mode
However, not all hardware can support all these speeds. For a given target device (sensor), the details would be found in the datasheet. For a host controller (Arduino, Pi), it can be trickier to track down the details and it may depend on other factors. But in general, most target devices and host controllers can support a range of speeds. Also, the vast majority of devices and controllers support at least the 100 kHz speed, which is why that speed is often used as the default.
Additionally, the speeds do not need to be exactly the ones specified above. The requirements are typically specified in terms of maximum and/or minimum. For example, a device that supports 100 kHz most likely can also be clocked slower at 90 kHz or 50 kHz or 23 kHz or whatever.
How Is This Useful?
There are various scenarios where specifying a non-default I2C clock speed might be useful:
- Increase speed to make things "faster".
- Mainly useful for things like displays.
- The hardware needs to support the faster speeds though.
- Decrease speed to improve robustness.
- Can potentially help when cable lengths are long or there are other sources of noise.
- The I2C device itself requires it.
- Details would be found in device's datasheet.
- For example, the AGS02MA requires the I2C clock speed be below 30 kHz.
- The I2C controller has known quirks.
- This is rare.
Change Clock Speed in CircuitPython
To change the I2C clock speed in CircuitPython, it must be done when the I2C bus is initially created. The frequency parameter is used to specify the desired speed in Hz. Ex:
i2c = busio.I2C(board.SCL, board.SDA, frequency=20000)
See the CircuitPython busio documentation for more info:
Change Clock Speed in Arduino
To change the I2C clock speed in Arduino, use the setClock() function of the Wire library. Ex:
i2c_dev->setSpeed(20000);
See the Arduino Wire documentation for more info:
Change Clock Speed on Raspberry Pi
To change the I2C clock speed on a Raspberry Pi, the config.txt file must be edited and the Pi rebooted. Use the i2c_arm_baudrate option. Ex:
dtparam=i2c_arm_baudrate=20000
More information on config.txt can be found in the Raspberry Pi documentation:
Page last edited January 05, 2026
Text editor powered by tinymce.