Checking I2C addresses on Arduino

/home/wpcom/public_html/wp-content/blogs.dir/10d/72092500/files/2014/12/img_1553.jpg

One of the biggest problems I found when working with I2C devices on the Arduino was being sure that the device was working and/or connected correctly.

A very useful sketch is available on github

github.com/todbot/arduino-i2c-scanner

That scans the I2C bus and shows the address of any connected device. The screen shot above shows a device at HEX address 23 has been found. The sketch as downloaded shows addresses in decimal, but it is an easy task to change three occurrences of DEC to HEX.

Two things to be aware of, the baud rate is set at 19200 so you need to set this on the Serial Monitor and if two or more devices on the bus share the same address they will show as one device.

Many thanks to the original author for publishing this sketch.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s