AW9523B IO Expansion Board
AW9523B uses an I2C interface and allows using 4 expansion boards at the same time by modifying the i2c address, expanding up to 64 I/O ports.
|SDA||I2C Data input|
|SCL||I2C Clock input|
RPI User Guides
Enable I2C Interface
Open a terminal and run the following commands:
sudo raspi-config Choose Interfacing Options -> I2C -> Yes.
Reboot Raspberry Pi:
- Install BCM2835 libraries:
#Open the Raspberry Pi terminal and run the following command wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz tar zxvf bcm2835-1.71.tar.gz cd bcm2835-1.71/ sudo ./configure && sudo make && sudo make check && sudo make install # For more, you can refer to the official website at: http://www.airspayce.com/mikem/bcm2835/
- Install WiringPi libraries:
#Open the Raspberry Pi terminal and run the following command cd sudo apt-get install wiringpi #For Raspberry Pi systems after May 2019 (earlier than that can be executed without), an upgrade may be required: wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v # Run gpio -v and version 2.52 will appear, if it doesn't it means there was an installation error # Bullseye branch system using the following command: git clone https://github.com/WiringPi/WiringPi cd WiringPi . /build gpio -v # Run gpio -v and version 2.70 will appear, if it doesn't it means there was an installation error
Open the Raspberry Pi terminal and run the following commands to download the examples：
sudo apt-get install p7zip-full -y sudo wget https://files.waveshare.com/upload/b/b8/AW9523B-IO-Expansion-Board-Code.7z 7z x AW9523B-IO-Expansion-Board-Code.7z -O./AW9523B-IO-Expansion-Board-Code cd AW9523B-IO-Expansion-Board-Code/RaspberryPi/
|SDA||3||I2C Data input|
|SCL||5||I2C clock input|
|INT||16||Interrupt input (could NC)|
|RST||18||Reset module (could NC)|
Test the example
Please first negative to 'AW9523B-IO-Expansion-Board-Code/RaspberryPi/' directly by cd command before you run the codes;
- Compile the codes and run it.
cd C sudo make clean sudo make sudo ./main
The examples use interrupt by default, if you want to disable the interrupt function, please add the following lines to /boot/config.txt, it will set the gpio23 to pull-up mode.
Run the following commands:
cd python sudo python AW9523B.py
Connect the PAx pin to PBx pin, for example, connect PA0 to PB0 by cables. The PAx pins are set as output, and PBx are set as input. The status of PAx pins output toggle every 550ms in order like a water lamp, every time the PAx pins toggle, it all cause the PBx pin to interrupt and printed the status to the terminal.
Arduino User Guides
The provided examples and hardware connections are based on Arduino UNO R3. For other Arduino boards, you may need to modify the connection or codes
You can connect the board according to the table
|SDA||SDA||I2C data input|
|SCL||SCL||I2C clock input|
Install Arduino IDE（Windows）
Run the Codes
Download the examples from Demo codes， unzip the archive, and enter the AW9523B-IO-Expansion-Board-Code directory. Copy the AW9523B-Arduino-Library folder to the libraries directory which is under the installation path, generally, the path is C:\Program Files (x86)\Arduino\libraries
Open the Arduino IDE software, Tools choose UNO, then open the examples from File-> Example
Build and upload the examples, then open the serial monitor to check the logs
Connect the PAx pin to PBx pin, for example, connect PA0 to PB0 by cables. The PAx pins are set as output, and PBx are set as input. The status of PAx pins output toggle every 550ms in order like water lamp, every time the PAx pins toggle, it all causes the PBx pin to interrupt and printed the status to the serial monitor.
STM32 User Guides
The example and related hardware connection are based on STM32F103RBT6. If you want to use other STM32 board, you may need to change the hardare connection and codes.
|SDA||PB9||I2C data input|
|SCL||PB8||I2C clock input|
Run the codes
The examples are based on HAL libraries.
Download the Demo codes, and find the STM32 directory. Open the PCF8574 IO Expansion Board.uvprojx file from STM32\STM32F103RB\MDK-ARM folder.
1. Use a multimeter to measure the voltage of every IOs, the P0~P3 are High and P4 ~ P7 are Low.
2. Open the SSCOM software, the status of IOs is printed on the software.