I2C with ESP32 – I2C Tricks & Tips with the ESP32

Let’s take a deep dive into I2C on the ESP32. The ESP32 has two I2C buses, which we can utilize to our advantage. We’ll also build our own I2C peripheral.

Article with code: https://dronebotworkshop.com/i2c-esp32/
More articles and tutorials: https://dronebotworkshop.com
Join the conversation on the forum: https://forum.dronebotworkshop.com
Subscribe to the newsletter and stay in touch: https://dronebotworkshop.com/subscribe/

We’ve worked with I2C many times; it’s the most popular way to interface sensors and displays to a microcontroller. Today, we will explore I2C on the ESP32 and see how we can make full use of its capabilities.

The ESP32 has two I2C buses, which we can take advantage of when dealing with sensors that have conflicting addresses. We can also use the ESP32 as an advanced I2C peripheral, making it possible to create our own sensors and custom displays.

We’ll also examine the Wire Library. The Wire Library is the key to using I2C with the ESP32, and we’ll learn how it works by manually retrieving data from a temperature and humidity sensor.

Here is the Table of Contents for today’s video:

00:00 – Introduction
01:11 – The I2C Bus
06:05 – ESP32 I2C Basics
08:48 – Using the Wire Library
14:06 – ESP32 I2C Scan
15:41 – OLED Code
19:01 – Multiple I2C Buses
24:31 – ESP32 as an I2C Peripheral
34:02 – Conclusion

Once you have mastered the use of the I2C bus, you’ll be able to interface virtually any sensor to an ESP32. And if you can’t find the perfect sensor for your application, you can always roll your own!

I hope you enjoy the video.

Bill

source

You might be interested in