I have searched the solution for a long time to use DFRobot IO Expansion Shield (http://www.dfrobot.com/index.php?route=product/product&path=123_129&product_id=264) with XBee PRO 900. But there is no help. After reading the manual (http://www.dfrobot.com/wiki/index.php?title=IO_Expansion_Shield_For_Arduino(V5)_(SKU:_DFR0088)) and Schematics (http://www.dfrobot.com/image/data/DFR0088/Arduino%20Expansion%20V5%20SCH.pdf) carefully, I have successfully made UNO + IO Expansion Shield + XBee PRO 900 communicating with PC + X-CTU + XBee PRO 900. Here is the solution, hope it helps as an instruction.
- Make the 3 jumpers all connect to APC side (opposite to 485). This will use XBee PRO. It does not need additional wiring. The IO Expansion Shield has connect APC-TXD to pin 0(RX), APC-RXD to pin 1(TX), DTR(EN) to pin 2.
- Upload the sketch to UNO. Make sure the XBee PRO is not connected otherwise uploading will fail for serial port occupied by XBee PRO.
- Plug IO Expansion Shield with XBee PRO into UNO.
- To receive data, write LOW to EN.
- To transmit data, write HIGH to EN.
Here is my codes (UNO).
int buzzerPin = 8;
int EN = 2;
int val;
void setup()
{
pinMode(buzzerPin, OUTPUT);
pinMode(EN, OUTPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(EN, LOW); //Enable Receiving Data
val = Serial.read();
if (-1 != val) {
if ('A' == val) {
tone(buzzerPin, 2500, 200);
digitalWrite(EN, HIGH); //Enable Transmitting Data
Serial.println("XBee PRO 900 received");
}
}
}