I2C Device Bus Scanner Utility

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on print
Table of Contents

This Spin2 utility program for the Propeller 2 scans all I2C devices connected to a pair of I/O pins and shows their addresses in a matrix format on Parallax Serial Terminal.  This program is useful to verify the addresses of multiple device addresses on the same bus before you use them in an application.


The example program has three I2C devices connected to P0 (SDA) and P1 (SCL):


  • NOYITO I2C 1602 16×2 LCD Module Shield Yellow-Green w/ Backlight
  • DS3231 ATC24C32 I2C Clock Module Real Time Clock Module IIC RTC Module
  • AT24C32 I2C 32K Byte EEPROM (inside of the DS3231 Clock Module, listed above)

The example uses an I2C object, full duplex serial object (for Parallax Serial Terminal) and an ANSI object for ANSI-compliant displays. Load the i2C_devices.spin2 object into flash, open Parallax Serial Terminal and you’ll see:

In the Parallax Serial Terminal display, each dot represents a hex value. For two dots, one hex value is shown when the program successfully identifies the slave ID, and checks for an ACK.

The addresses of the three devices are:

  • $4E is the LCD Display
  • $AE is the EEPROM on the RTC
  • $D0 is the Real Time Clock

These values may be confirmed by looking up the datasheet on the specific parts.  This code example is supported by a detailed video linked below.

Programming Language
Tools and Operating System
Document Author
Source Code Author
Table of Contents
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Copyright © 2021 Parallax Inc. All Rights Reserved
Designed and Made in California, USA