In this tutorial, we will see how we can find I2C address for different sensors using I2C bus with ARIES v3.0 Board using an I2C device OLED SSD1306.
Each I2C device consists of a unique address which is used to identify the device connected in the bus. The master scans the I2C-bus for devices. If a device is found, it is reported to the Arduino serial monitor. This sketch is the first step to get the I2C communication working. The sketch shows the 7-bit addresses of the found devices as hexadecimal values.
In this example we will be using an SSD1306 OLED Display, for checking the I2C address. You can use any sensor working with I2C device to test the example code by following the procedure given below.
OLED display
OLED displays have much less thickness than LCD displays with good brightness and also produce better and true colors. The connection of this display with ARIES is made through the I2C (also called as IIC) serial interface. These displays can be used in various applications including smart watch, MP3, function cellphone, portable health device and many others.
Prerequisites
- Windows 10 or above/Linux (64 bit)
- Arduino IDE
- VEGA ARIES Board support package
Components Required
- ARIES v3.0 Board
- USB type C to USB type A cable
- SSD1306 OLED Display
- Jumper Wires
Note: All of the following boards can be used for this project
Circuit Diagram:
Connections:
OLED Display | ARIES V3 board |
VCC | 3.3V |
GND | GND |
SCK/SCL | SCL-0 |
SDA | SDA-0 |
Procedure
Open and set up the Arduino IDE as described in Getting Started with ARIES v3.0.
- Make sure you have selected ARIES v3 Board from Tools -> Board -> VEGA Processor: ARIES Boards -> ARIES v3
- Select Programmer as VEGA XMODEM from Tools -> Programmer -> VEGA XMODEM
- Also select appropriate port from Tools -> Port -> COM* (ARIES v3)
Now, Open Files -> Examples -> Under Examples for ARIES v3 -> Wire-> VEGA_I2C_scanner
Libraries
Arduino libraries are an extension of the standard Arduino API and consists of thousands of libraries, both official and contributed by the community. Libraries simplifies the use of complex codes. Every version of Arduino IDE has a library manager for installing Arduino software libraries. The libraries required for this projects are
- Adafruit SSD1306
- Adafruit GFX Library
- Adafruit BusIO
To install the libraries required for this project.
Go to Tools -> Library Manager -> and search for Adafruit SSD1306
Click on Install all
Once you have downloaded the required libraries you can upload the code to ARIES board.
Output
Once you’ve completed the code, upload it to your ARIES v3.0 board using the Arduino IDE. Wait until the program is uploaded. After completing the upload, the program will start to execute. The hexadecimal I2C address of the SSD1306 OLED Display will be printed on the serial monitor.