top of page

Connecting Sensors to Rev Hub

Updated: Apr 15

Inter-integrated-circuit (I2C) is incredibly popular with modules and sensors, making it useful for projects that require many parts working together. I2C allows you to potentially connect up to 128 devices to your main board!


When connecting two circuits to one another, think of the main device as the “master” and the connected devices—such as sensors, pin expansions, and drivers—as “slaves”. I2C makes it possible to connect multiple masters and slaves to your board while maintaining a clear communication pathway.


Maintaining a clear communication pathway is possible because I2C uses an address system and a shared bus, meaning many devices can be connected to the exact same wires. However, the Hub must first select a specific device by transmitting a unique address before sending data. This provides each slave device with what it needs while also supporting multiple masters. I2C uses fewer wires and all data is transmitted on a single wire, keeping your pin count low. The tradeoff for this simplified wiring is slower speeds than Serial Peripheral Interface (SPI).


Rev Control / Expansion Hub


I2C sensors connect to the Control Hub, or Expansion Hub, via a JST PH 4-Pin Sensor Cable and the I2C buses, shown in the image below. The color-coding of the I2C buses in the image corresponds with each wire in the JST PH 4-Pin Sensor Cable.


I2C Pins on Rev Control Hub

As a convention, the black wire is ground and the red wire is power. The blue (SCLn) wire and white (SDAn) wire are the communication signals for each I2C bus on the Hubs.


Rev Control and Expansion Hubs comes with inbuilt IMU Sensors available at I2C address location 0.


Sensors


All sensors are primarily variable resistors, like potentiometer, and thereby control the amount of current that can pass through them. Some sensors are binary in nature, for example, light sensors. However, the amount of current can be calibrated to give more precise measurements, for example, temperature sensors. Some examples:

Description

Type

Model Number

Image

Digital luminosity (light) sensors

Light

TSL2561


TSL2561

Six-axis gyroscope and accelerometer

Motion

MPU6050


MPU6050

Time-of-Flight (ToF) distance sensor.

Distance - It can measure distances from 3 cm to 100 cm with a resolution of 1 mm.

VL53L0X


VL53L0X

Color light-to-digital converter

Color

TCS34725


TCS34725

Ambient light sensor

Light

BH1750


BH1750

Ultrasonic Distance Sensor

Distance

MaxBotix I2C Ultrasonic Sensor


MB1020

Connecting a sensor to Rev Hub


Connecting a sensor is easy - just make sure to match GND, 3.3V, SCL and SCA when connecting. Some sensors require logic level convertor when connecting to Rev Hub. Refer to this link for details: https://ftc-docs.firstinspires.org/en/latest/control_hard_compon/rc_components/sensors/sensors.html


Other Communication Protocols


Serial Peripheral Interface (SPI) 


Like I2C, SPI is a different form of serial-communications protocol specially designed for microcontrollers to talk to each other. However, it has some key differences from its I2C counterpart. While you can use multiple masters and slaves with I2C, SPI allows a single master device with a maximum of four slave devices.


SPI is much faster than I2C due to the simple protocol and, while data/clock lines are shared between devices, each device requires a unique address wire. SPI is commonly found in places where speed is important such as with SD cards and display modules, or when information updates and changes quickly, like with temperature sensors.


UART (Universal Asynchronous Reception and Transmission)


UART is a simple communication protocol that allows microcontroller to communicate with serial devices. The UART system communicates with computers via the USB port.


This peripheral allows the Hub to directly communicate with a computer via an onboard USB-to-Serial converter. Therefore, programs written on a Windows, Mac, or Linux OS can be used with a Hub connected to a USB port as if it was a serial port (serial port communication is trivial compared to USB communication).




Recent Posts

See All

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating

Subscribe

Subscribe to our mailing list for regular updates on news, events, insightful blogs, and free code!

Thanks for subscribing!

bottom of page