2025-05-12 14:31:35 +03:00
2025-05-12 11:24:46 +03:00
2025-04-24 11:54:16 +03:00
2025-04-24 09:34:04 +03:00
++
2025-05-12 11:27:07 +03:00

Empowering Innovation

Unlocking Unlimited Possibilities with Our Modular IoT Devices

At FABLAB Bahrain, we're revolutionizing the world of IoT devices with our cutting-edge, ESP32C3-based modules. Not only do they come pre-programmed as I2C slave devices, ready to be controlled via a simple interface, but they're also designed to be fully programmable and reconfigurable by end-users themselves. Our comprehensive library provides an intuitive way for developers to customize and fine-tune their products, whether it's changing addresses or integrating BLE or WiFi connectivity. But that's not all - we've also made it possible for users to upload their own firmware, empowering them to transform our modules into anything they can imagine. From smart home automation to industrial control systems, our devices are the perfect building blocks for your next innovation project. With our modular design and open-source approach, you'll have complete freedom to shape your IoT vision

I2C Communication Library

I2CRelay is an 8-relay module built around the ESP32-C3 Super Mini, featuring an I2C interface that allows it to be controlled by another MCU, enabling easy integration into complex control systems. Additionally, when paired with an ESP32-C3-based controller, it can leverage Wi-Fi and Bluetooth LE connectivity, expanding control options beyond wired I2C communication for wireless operation and enhanced flexibility in IoT and robotics applications. This combination of compact size, low power consumption, and versatile communication protocols makes the module indispensable for remote and automated control of multiple devices, offering scalable and reliable switching solutions for smart homes, industrial automation, and advanced robotics.

Table of Contents

  1. Technical Drawings
  2. Features
  3. Hardware Components Used
  4. Installation
  5. Versatility
  6. Usage
  7. API Overview
  8. Example Serial Commands
  9. Notes
  10. Credits
  11. License
  12. Project Image

Technical Drawings


Key Features of the 8-Relay Module with ESP32-C3 Super Mini

  • 8-Channel Relay Control: Enables switching of up to 8 high-power devices independently.
  • ESP32-C3 Super Mini Integration: Compact, powerful RISC-V processor with built-in Wi-Fi and Bluetooth 5.0 for versatile connectivity.
  • I2C Communication Interface: Allows easy control from another MCU with minimal wiring and reliable data transfer.
  • Wireless Control Capability: Supports Wi-Fi and Bluetooth when paired with an ESP32-C3-based controller, enabling remote and flexible device management.
  • Low Power Consumption: Efficient power usage suitable for battery-powered and IoT applications.
  • Compact and Lightweight Design: Ideal for space-constrained projects and embedded systems.
  • High Reliability and Safety: Optocoupler isolation and built-in protection circuits to safeguard both the relay module and connected devices.
  • Wide Application Range: Perfect for home automation, industrial control, robotics, and smart IoT solutions.

Hardware Components Used

  • 8-Channel Relay Module.
  • Esp32C3 Super Mini.
  • Flywheel.

Installation

  1. Download or clone this repository.
  2. Copy the I2CRelay, and related library folders to your Arduino libraries directory.
  3. Restart the Arduino IDE.

Files

The library is composed of two files, each with a specific role:

  1. I2CRelay.h

    • Defines the I2CRelay class, which extends the functionality to control relays over I2C.
  2. I2CRelay.cpp

    • Contains the implementation of methods for the I2CRelay class.

Versatility

The I2CRelay library offers broad versatility for automation through its configurable I2C addressing, expandable relay control, and cross-platform compatibility. User-friendly commands and customizable hardware pins simplify integration into diverse projects, from IoT and home automation to industrial control. Its efficient, non-blocking operation and persistent configuration via EEPROM ensure a scalable and reliable relay control system.


API Overview

Method / Constructor Description Parameters / Usage Example
I2CRelay(uint8_t address = 0x08, uint8_t sda = 8, uint8_t scl = 3) Create an I2CRelay object with optional I2C address and pin selection. I2CRelay relay;
I2CRelay relay(0x10, 21, 22);
void begin() Initialize I2C communication with the configured pins. relay.begin();
void setRelay(uint8_t relayNum, uint8_t state) Turn relay (18) ON or OFF. relay.setRelay(3, 1); // ON relay 3
void setAllRelays(uint8_t state) Turn all relays ON or OFF at once. relay.setAllRelays(0); // OFF all relays
void setDeviceName(const String &name) Set the name of the I2C relay device (up to 24 chars). relay.setDeviceName("MainPanel");
void setI2CAddress(uint8_t newAddr) Change the I2C address of the relay slave. relay.setI2CAddress(0x12);
String getIdentification() Query the slave for its identification string (address, type, name, states). String id = relay.getIdentification();
void handleSerialCommand(const String &cmd) Parse and execute a serial command string (e.g., "r 2 1", "all 0"). relay.handleSerialCommand("r 2 1");

Notes:

  • relayNum is 18 (user-facing), mapped internally to 07.
  • state is 1 (ON) or 0 (OFF).
  • All methods are non-blocking except setAllRelays, which adds a small delay between commands.
Description
No description provided
Readme MIT 160 KiB
2025-04-24 16:13:08 +03:00
Languages
C++ 100%