I2C Scanner - How to Find I2C Addresses on Arduino

by RonFrtek in Circuits > Arduino

368 Views, 1 Favorites, 0 Comments

I2C Scanner - How to Find I2C Addresses on Arduino

I2C Scanner - How to Find I2C Addresses on Arduino

In this tutorial we are going to make an I2C Scanner that will display an I2C Adress of the connected sensor or a module. This is very useful in cases where we do not know what is the I2C Address of a certain sensor or module that we would like to use in our projects.


Watch the Video!


What You Will Need

68747470733a2f2f692e696d6775722e636f6d2f6c46573361784a2e6a7067.jpg
bme280-.jpg
VisuinoAdvrtisemenESPNowESP32C3-1.jpg
breadboard.png
FMT2X9VKEY93G5P.jpg
FNLOD2CKEY93G5N.jpg
  • TM1637 LED Display
  • Some I2C sensor for testing
  • Arduino UNO (or any other Arduino)
  • Jumper wires
  • Breadboard
  • Visuino program: Download Visuino


Brought by PCBWay

2022-08-26_13-41-18.jpg

Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.

What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!

Go check them out here. They also offer a lot of other stuff in case you might need it like assembly3D printingCNC machining and a lot more.

The Circuit

2022-09-29_12-13-13.jpg
  • Connect LED Display pin[CLK] to Arduino digital pin[8]
  • Connect LED Display pin[DI0] to Arduino digital pin[9]
  • Connect LED Display pin[GND] to Arduino pin[GND]
  • Connect LED Display pin[VCC] to Arduino pin[5V


  • Connect TEST MODULE/SENSOR pin [SCL] to Arduino pin [SCL]
  • Connect TEST MODULE/SENSOR pin [SDA] to Arduino pin [SDA]
  • Connect TEST MODULE/SENSOR pin [VCC] to Arduino pin [5v]
  • Connect TEST MODULE/SENSOR pin [GND] to Arduino pin [GND]

Note: Make sure to disconnect the power from Arduino, when you replace the I2C MODULE/SENSOR

Start Visuino, and Select the Arduino UNO Board Type

FMW5CHBKFV47BP9.jpg
Visuino-Select-Board-UNO.jpg

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

In Visuino Add & Set Components

2022-09-29_16-15-35.jpg
2022-09-29_16-16-00.jpg
2022-09-29_16-16-20.jpg
2022-09-29_16-16-51.jpg
2022-09-29_16-46-03.jpg
  • Add "TM1637" Component
  • Add "Clock Generator" Component


  • Double click on "Display1" and in the "Elements" window drag "Text Display 7 Segments" to the left
  • Close the "Elements" window


  • Select Arduino board and in the Properties window expand I2C Channels > I2C > Elements
  • Click on the "Elements" 3 dots button, a window "Elements" will open
  • In the "Elements" window drag "I2C Scan" to the left
  • Close the "Elements" window

In Visuino Connect Components

2022-09-29_16-17-21.jpg
  • Connect Arduino > "I2C Scan1" pin [Address] to "Display1" > "Text Display 7 Segments1" pin [In]
  • Connect "Display1" pin [Clock] to Arduino Digital pin [8]
  • Connect "Display1" pin [Clock] to Arduino Digital pin [8]
  • Connect "ClockGenerator1" pin [Out] to Arduino > "I2C Scan1" pin [Scan]

Generate, Compile, and Upload the Arduino Code

Visuino-Compile-UNO.jpg

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play

If you power the Arduino module, The LED Display will show the I2C address of the connected sensor or module.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it and open it in Visuino: https://www.visuino.eu