By dave | May 20, 2023

IO Abstraction library fully supports the AW9523 16-bit IO expander chips on Arduino and mbed. It requires only two pins (three for interrupt mode) SDA, SCL, and optionally INT. Our driver integrates the GPIO, LED controller, and interrupt support providing nearly all functions using familiar Arduino terminology.

This device can even be used in conjunction with an AW9523 analog device to make it even easier to use the LED controller.


The AW9523 is a pretty complete device, and has most capabilities of Arduino pins, however there are several notes:

  • Interrupt support, you can enable interrupt handling on any input pin and connect the interrupt pin to the Arduino device
  • It does not support INPUT_PULLUP, if you need pulled up input you need to add a manual restistor
  • LED controller, this device has an additional AnalogDevice abstraction that you can use, any pin can be turned into a current source.

Create an instance

To use globally define a variable as follows:

AW9523IoAbstraction ioDevice(0x58, IO_PIN_NOT_DEFINED);

Optionally you can create an AnalogDevice to access the LED controller features:

AW9523AnalogAbstraction ledController(ioDevice);

This will allow you to treat the extra LED controller features available as an analog device. See the analog device help. Also see the AW9523 example packaged with the library, or the AW9523 I2C device reference docs.

Once you have created an instance, simply use it like any other IoAbstraction they all work the same way.

To find your i2c device address use this i2c address scanner, this sketch will tell you every address on which it finds an i2c chip.

Additional notes for LED controller mode

If you want to use the LED control function of the device, there is an additional output type, it is LED_CURRENT_OUTPUT. You can enable the LED mode two ways.

  1. on the device abstraction call ioAW9523.pinMode(pin, LED_CURRENT_OUTPUT);
  2. create the analog abstraction as per the example, and initialise the pin as PWM analogAw9523.initPin(pin, DIR_PWM);

See the reference docs linked above or example for more information.

Go back to the IoAbstraction page

Other pages within this category

comments powered by Disqus

This site uses cookies to analyse traffic, and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.

Send a message
X

Please use the forum for help with UI & libraries.

This message will be securely transmitted to our servers.