Arduino I2C Scanner

What is the I2C address?! Scanner please.

Do I need such scanner? Sooner or later, everyone stuck on some I2C device – unknown address. For example, on OLED display, there is jumper (SMD resistor with “000” – zero Ohms), and next to it: “IIC address eslect”, and two options, soldered at first one: 0x78, and can be selected another one by removing this resistor and soldering at second place: 0x7A. But, after opening example code for this OLED display, it does not works. Why?! Because it has address of 0x3C, not 0x78 as it is designated. So, here is simple sketch I found somewhere. Well known and simple sketch, but very useful:

You may use :

Most of the default examples uses 9600 bits per second, but sometimes I need it faster, so I made it “115200”.  If you have problem with your serial port (USB cable to your Arduino), then lower speed, it is up to you. Just be sure to select the same speed at Serial Monitor, bottom right corner. Else it will not work.

Wiring

Instead making wiring diagram, I will just tell you that SCL and SDA of the device in question goes to SCL and SDA on your favorite  Arduino board.  Usually with numbers 4 and 5; SCL (serial clock) to pin A5 (or ADC5, or pin number 28), and SDA (seral data) to pin A4 (or ADC4, or pin number 27). Do not forget to power your device with appropriate voltage and connect ground wire. Usually it is 5V, but there may be exceptions.

It will give you info every five seconds, something like this:

scanner

Leave a Reply

Your email address will not be published. Required fields are marked *