The Gravity: I2C HUB (DFR0759) by DFRobot is a versatile and efficient hub designed to simplify the connection of multiple I2C devices to a single I2C bus. It is particularly useful in projects where multiple sensors, modules, or peripherals need to communicate with a microcontroller, such as an Arduino or Raspberry Pi. The hub ensures stable communication and reduces wiring complexity, making it an essential tool for prototyping and development.
The following table outlines the key technical details of the Gravity: I2C HUB:
Parameter | Specification |
---|---|
Manufacturer | DFRobot |
Part Number | DFR0759 |
Operating Voltage | 3.3V - 5V |
Communication Protocol | I2C |
I2C Address | Pass-through (no address assigned) |
Dimensions | 42mm x 32mm |
Weight | 7g |
Connector Type | Gravity 4-pin I2C interface |
Number of Ports | 6 (1 input, 5 output) |
The Gravity: I2C HUB features a total of 6 ports: 1 input port and 5 output ports. Each port uses the standard Gravity 4-pin I2C interface. The pinout is as follows:
Pin | Label | Description |
---|---|---|
1 | GND | Ground (0V) |
2 | VCC | Power supply (3.3V or 5V) |
3 | SDA | I2C data line |
4 | SCL | I2C clock line |
Below is an example of how to use the Gravity: I2C HUB with an Arduino UNO to read data from two I2C devices (e.g., a temperature sensor and a light sensor):
#include <Wire.h> // Include the Wire library for I2C communication
#define TEMP_SENSOR_ADDR 0x48 // I2C address of the temperature sensor
#define LIGHT_SENSOR_ADDR 0x23 // I2C address of the light sensor
void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(9600); // Start serial communication for debugging
Serial.println("I2C HUB Example: Reading from sensors");
}
void loop() {
// Read temperature sensor data
Wire.beginTransmission(TEMP_SENSOR_ADDR); // Start communication with temp sensor
Wire.write(0x00); // Request temperature data (register 0x00)
Wire.endTransmission();
Wire.requestFrom(TEMP_SENSOR_ADDR, 2); // Request 2 bytes of data
if (Wire.available() == 2) {
int tempData = (Wire.read() << 8) | Wire.read(); // Combine MSB and LSB
float temperature = tempData * 0.0625; // Convert to Celsius
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" C");
}
// Read light sensor data
Wire.beginTransmission(LIGHT_SENSOR_ADDR); // Start communication with light sensor
Wire.write(0x10); // Request high-resolution mode
Wire.endTransmission();
delay(180); // Wait for measurement
Wire.requestFrom(LIGHT_SENSOR_ADDR, 2); // Request 2 bytes of data
if (Wire.available() == 2) {
int lightData = (Wire.read() << 8) | Wire.read(); // Combine MSB and LSB
Serial.print("Light Intensity: ");
Serial.print(lightData);
Serial.println(" lux");
}
delay(1000); // Wait 1 second before the next reading
}
I2C Devices Not Detected
Unstable Communication
Power Issues
Data Corruption
Q: Can I connect more than 5 devices to the hub?
A: No, the Gravity: I2C HUB supports up to 5 output ports. For more devices, consider using an additional hub or an I2C multiplexer.
Q: Does the hub support 3.3V and 5V devices simultaneously?
A: No, all connected devices must operate at the same voltage level (either 3.3V or 5V).
Q: Do I need to add external pull-up resistors?
A: The hub includes built-in pull-up resistors. However, if additional devices have pull-ups, ensure the total resistance is within the recommended range.
Q: Can I use the hub with a Raspberry Pi?
A: Yes, the hub is compatible with any microcontroller or SBC that supports I2C communication.