Understanding I2C Communication
I2C, short for "Inter-Integrated Circuit," is a prevalent communication protocol utilized for linking multiple integrated devices to a microcontroller (MCU). It was introduced by Philips Semiconductors in the early 1980s and has since evolved into an industry-standard for serial communication.
The I2C bus is characterized by its minimalistic structure, comprising just two fundamental lines: SCL (Serial Clock) and SDA (Serial Data).
SCL (Serial Clock): This line serves to convey clock signals that synchronize data transmission among devices.
SDA (Serial Data): Here, the actual data is carried, facilitating communication between the connected devices.
I2C operates as a master-slave protocol, with a master device, often an MCU like the ESP-01S, directing and orchestrating communication with one or more peripheral devices, which can include sensors or displays.
The flexibility of the I2C bus allows it to accommodate several devices, typically ranging from a few to potentially a dozen or more, depending on the system's design and the allocation of unique addresses. Each device on the I2C bus is identified by a distinct 7-bit or 10-bit address, empowering the master device to select and communicate with a specific target. In the standard 7-bit address system, 128 possible addresses (ranging from 0x00 to 0x7F) are available. In the extended 10-bit address system, this count increases to 1024 possible addresses.
This robust and widely accepted communication protocol facilitates the seamless integration of various devices into a system, making it an invaluable tool for microcontroller-based projects and embedded systems.
ESP-01S SCL and SDA
The ESP-01S module is known for its limited GPIO pins, which can be a constraint for connecting sensors or displays. However, the I2C bus offers an elegant solution, enabling the connection of numerous sensors and displays with ease.
To harness I2C effectively, both the SCL and SDA lines require pull-up resistors. Fortunately, ESP-01S simplifies this by including built-in 12K pull-up resistors for both GPIO0 and GPIO2. These GPIO pins can be readily employed for SCL and SDA connections, facilitating the integration of multiple sensors and displays on the I2C bus. This feature provides a valuable way to extend the GPIO capabilities of the ESP-01S, enhancing its versatility for various applications.
To Do: I2C Scanner to get address and display on screen, screen and light sensor
To Do: Our I2C device show case, OLED and 1602