EXT.IO 是一款並行端口拓展器,集成了IO拓展晶片PCA9554PW,支持拓展至8個GPIO,能夠用於用於2.3~5.5V VCC、開漏、上拉、中斷輸出操作.通過I2C接口(串行時鐘SCL,串行數據SDA)輔助多數的微控制器提供I/0拓展,對於I/O引腳緊缺,又不想浪費資源添加額外控制器的開發者來說,EXT.IO會是一個不錯輔助Unit。
商品特性
● I2C通訊
● 輸入輸出拓展
● GROVE 接口, 支持 UIFlow 、 Arduino
● 2x LEGO 兼容孔
規格 |
參數 |
IIC地址 |
0x27 |
I/O擴展數量 |
8 |
淨重 |
5g |
產品尺寸 |
32x 24x 11 (mm) |
參考原理圖及PCA9554PW數據手冊可知,該Unit能夠通過控制A0~A2引腳的電平組合,修改設備的I2C地址。 (默認地址為0x27,更多信息請查看datasheet) 在Unit的PCB板上預留了三個貼片電阻焊接位,分別為A0-A2(R6-R8),如下圖所示。
Datasheet - PCA9554PW
1-EasyLoader是一個簡潔快速的程序燒錄器,每一個產品頁面裡的EasyLoader都提供了一個與產品相關的案例程序,通過簡單步驟將其燒錄至主控,能夠進行一系列的功能驗證.(目前EasyLoader僅適用於Windows操作系統)
2-下載軟件後,雙擊運行應用程序,將M5設備通過數據線連接至電腦,選擇端口參數,點擊"Burn" 即可開始燒錄.(為M5StickC燒錄時,請將波特率設置在750000或115200)
3-3.目前EasyLoader僅適用於Windows操作系統、兼容M5體係採用ESP32作為控制核心的主機.在為M5Core燒錄前需要安裝CP210X驅動程序(使用M5StickC作為控制器的則無需安裝)
點擊此處查看安裝程序
M5Core(GROVE A) |
GPIO22 |
GPIO21 |
5V |
GND |
EXT.IO Unit |
SCL |
SDA |
5V |
GND |
1.Arduino IDE
2.
UIFlow
操作流程
STEP 1. 將欲查詢的模組連接至Arduino UNO(附圖為腳位參考,實際請比對商品標示接線)
STEP 2. 開啟Arduino IDE並新增檔案
STEP 3. 貼入教學下方的範例文件,並上傳到Arduino UNO,即會開始掃描I2C位址
STEP 4. 開啟序列埠監控視窗,即可取得I2C位址
I2C掃描範例程式
|
/ ---------------------------------------------------------------- / |
|
// Arduino I2C Scanner |
|
// Re-writed by Arbi Abdul Jabbaar |
|
// Using Arduino IDE 1.8.7 |
|
// Using GY-87 module for the target |
|
// Tested on 10 September 2019 |
|
// This sketch tests the standard 7-bit addresses |
|
// Devices with higher bit address might not be seen properly. |
|
/ ---------------------------------------------------------------- / |
|
|
|
#include //include Wire.h library |
|
|
|
void setup() |
|
{ |
|
Wire.begin(); // Wire communication begin |
|
Serial.begin(9600); // The baudrate of Serial monitor is set in 9600 |
|
while (!Serial); // Waiting for Serial Monitor |
|
Serial.println("\nI2C Scanner"); |
|
} |
|
|
|
void loop() |
|
{ |
|
byte error, address; //variable for error and I2C address |
|
int nDevices; |
|
|
|
Serial.println("Scanning..."); |
|
|
|
nDevices = 0; |
|
for (address = 1; address < 127; address++ ) |
|
{ |
|
// The i2c_scanner uses the return value of |
|
// the Write.endTransmisstion to see if |
|
// a device did acknowledge to the address. |
|
Wire.beginTransmission(address); |
|
error = Wire.endTransmission(); |
|
|
|
if (error == 0) |
|
{ |
|
Serial.print("I2C device found at address 0x"); |
|
if (address < 16) |
|
Serial.print("0"); |
|
Serial.print(address, HEX); |
|
Serial.println(" !"); |
|
nDevices++; |
|
} |
|
else if (error == 4) |
|
{ |
|
Serial.print("Unknown error at address 0x"); |
|
if (address < 16) |
|
Serial.print("0"); |
|
Serial.println(address, HEX); |
|
} |
|
} |
|
if (nDevices == 0) |
|
Serial.println("No I2C devices found\n"); |
|
else |
|
Serial.println("done\n"); |
|
|
|
delay(5000); // wait 5 seconds for the next I2C scan |
|
} |
- M5Stack I/O擴展模組(I2C)-U011
x 1