Hello friends , I hope you all are fine and having fun with your lives. Today, I am going to share a new project which is XBee Arduino Interfacing. In my previous tutorials in the XBee series, we have had first Introduction to XBee Module and after that we have also discussed How to Interface XBee Module with Computer. Now we are all well aware of XBee Module and can easily do the XBee Arduino Interfacing. We have seen in the previous tutorial that XBee Module works on Serial protocol so we have to use the Serial Pins of Arduino UNO board.
If you want to use any other microcontroller then you can its not a big issue, just see the way how the programming goes and convert it to the language of your microcontroller i.e. PIC Microcontrollers or 8051 Microcontrollers. If you guys have any question, you may contact me or can ask in the comments. so, let's get started with XBee Arduino Interfacing:
Other XBee Projects:XBee Arduino Interfacing
- First of all you need to do is XBee Arduino Interfacing.
- So, in order to do that you have to connect the Pin # 2 and Pin # 3 of Xbee with the Tx and Rx of Arduino and Pin # 1 to 3.3V of Arduino and Pin # 10 to ground of Arduino as shown in the below figure:
- Don't solder the XBee pins directly into the Arduino as it may damage the XBee.
- You can buy the XBee Shield for Arduino.
- Now first of all run the X-Ctu software and configure your XBees as we did in the last tutorial i.e. Interfacing of XBee module with Computer.
- After that attach your XBees with the two Arduino Boards and use the below code:
int b1 = 2; int b2 = A3;int mode1 = A4; int mode2 = A5;void setup() { Serial.begin(9600); delay(100); pinMode(b1,OUTPUT);digitalWrite(b1, LOW); pinMode(b2,INPUT_PULLUP); pinMode(mode1,INPUT_PULLUP); pinMode(mode2,INPUT_PULLUP); } void loop() { if (Serial.available() > 0) { delay(500); Serial.print("+++"); delay(1000); Serial.print("rnATDL1"); delay(100); Serial.print("rnATCN"); delay(100); Serial.print("A"); } }
- Now add this code in one of your Arduino Board and a simple serial receiving code on the second arduino.
- Now whenever you press the button you will get A on the second arduino board.
- You can change it with anything you like and on the second side you can do anything by adding a condition.
That's all for today. I hope you have enjoyed this tutorial XBee Arduino Interfacing. I will share more projects on XBee Arduino Interfacing soon. If you are getting any problem you can ask in comments. Thanks. ALLAH HAFIZ :))
Thanks in advance. Reply
don't get confused .... if you are using Arduino UNO then simply connect pin # 2 of UNO Board with pin # 2 of XBee .... and pin # 3 of UNO Board with pin # 3 of XBee and you are on go ... Reply