https://github.com/chinmay-esp/esp32-i2c-master
This repository contains an ESP32-based I2C scanner that detects and prints the addresses of connected I2C devices. The project initializes the I2C bus, scans available addresses, and outputs detected device addresses to the terminal. Ideal for debugging and verifying I2C connections.
https://github.com/chinmay-esp/esp32-i2c-master
cpp esp-idf esp32
Last synced: about 2 months ago
JSON representation
This repository contains an ESP32-based I2C scanner that detects and prints the addresses of connected I2C devices. The project initializes the I2C bus, scans available addresses, and outputs detected device addresses to the terminal. Ideal for debugging and verifying I2C connections.
- Host: GitHub
- URL: https://github.com/chinmay-esp/esp32-i2c-master
- Owner: Chinmay-ESP
- Created: 2025-02-09T10:30:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-09T10:37:05.000Z (over 1 year ago)
- Last Synced: 2025-02-09T11:27:06.607Z (over 1 year ago)
- Topics: cpp, esp-idf, esp32
- Language: C++
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# I2C Address Read for I2C Devices (ESP32-IDF)
## Overview
This project is designed to scan and detect I2C devices connected to an ESP32 microcontroller. It initializes the I2C bus, scans for available I2C addresses, and displays the detected device addresses in the terminal. This is useful for debugging and verifying connections in I2C-based embedded systems.
## Features
- **ESP32 I2C Bus Initialization**: Configures GPIO21 (SDA) and GPIO22 (SCL) for I2C communication.
- **Device Detection**: Scans for I2C devices on the bus and prints their addresses.
- **FreeRTOS Task Implementation**: Uses FreeRTOS to continuously scan and detect devices asynchronously.
- **ESP-IDF Integration**: Fully compatible with ESP-IDF framework.
## Hardware Requirements
- ESP32 Development Board
- I2C-based Sensors or Modules (e.g., OLED Display, I2C Device etc.)
- Jumper Wires for Connections
## Software Requirements
- ESP-IDF (>= v5.2)
- VS Code or Terminal for Development
- Python 3.x (for ESP-IDF setup)
## Setup & Installation
### 1. Clone the Repository
```sh
git clone https://github.com/Chinmay-ESP/ESP32-I2C-Master.git
cd ESP32-I2C-Master
```
### 2. Set Up ESP-IDF
Follow the [ESP-IDF Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/) to set up your ESP32 development environment.
### 3. Build & Flash the Project
```sh
idf.py set-target esp32
idf.py build
idf.py flash -p /dev/ttyUSB0 -b 115200
```
### 4. Monitor Serial Output
```sh
idf.py monitor
```
## Usage
1. Connect your I2C devices to the ESP32:
- **SDA**: GPIO 21
- **SCL**: GPIO 22
2. Flash the firmware to your ESP32.
3. Open the serial monitor to view detected I2C addresses.
4. The output should display detected device addresses like:
```sh
I2C Scanner found I2C device at: 0x3C
I2C Scanner found I2C device at: 0x68
I2C_Scanner complete
```