PC Remote Control Arduino Uno With XBee Series 1

by hoe4 in Circuits > Arduino

664 Views, 1 Favorites, 0 Comments

PC Remote Control Arduino Uno With XBee Series 1

intro.jpg

This simple project is about PC remote control Arduino Uno with XBee Series 1. I create this simple circuit because i found two XBee series 1 again when i was cleaning my room. I bought those like 6 years ago but i forgot where those were stored. Hence, i would like to test those XBee whether working or not. Those XBee are still working after testing.

Hardware List

IMG_8697.jpg
IMG_8719.jpg
IMG_8720.jpg
IMG_8722.jpg

Materials are involved shall show as below


Hardware

-> Desktop or laptop x 1 no.

-> Arduino Uno board x 1 no.

-> XBee series 1 x 2 nos.

-> a bunch of ribbon cables (male - male)

-> Breadboard x 1 no.

-> XBee explorer USB x 1 no. (WRL-11812)

https://www.sparkfun.com/products/11812

-> XBee adaptor (Model : ADP-3)

https://www.mouser.com/c/?q=xbee%20adapter&OrgTerm=xbee%20adaptor&NewSearch=1& _gl=1%2Ahewwft%2A_ga%2AMzc3NDY3MTM5LjE2ODc3NDk0MTA.%2A_ga_15W4STQT4T%2AMTY4NzgzNTE0OC4zLjEuMTY4NzgzNTIyNy4wLjAuMA..%2A_ga_1KQLCYKRX3%2AMTY4NzgzNTE0OC4zLjEuMTY4NzgzNTIyNy40MS4wLjA.

-> LED x 1 no.

-> resistor x 1 no. (i used 470 Ohm)

Software

XCTU (by Digi)

Function of Hardware

1-> Ardunio Uno with XBee (act as receiver)

It is used to receive signal from PC to arduino.

2-> PC with XBee (act as transmitter)

It is used to transmit signal either '1' or '2' through XCTU console. '1' for turning LED on and '2' for turning LED off.

What Is XBee

Basically, XBee provide a wireless communication between device (coordinator) and device (End point). There are so many websites that provide network topology and guide. You can read following links or through google if you need further information.

https://www.e-spincorp.com/zigbee-network-topology/

https://www.sparkfun.com/pages/xbee_guide

XCTU

xctu1.jpg
xctu2.jpg
xctu3.jpg
xctu4.jpg
xctu5.jpg
xctu6.jpg
xctu7.jpg

XBee console is used to input '1' or '2' for controlling LED on and off. Hence, XCTU software is required to install to your PC. You can download XCTU from following link

https://hub.digi.com/support/products/xctu/


XBee configuration is required when XCTU install to your PC. Please beware of the following issues during configuration

1->Set XBee baud rate (transmitter and receiver) should be the same.

2->Set Arduino baud rate should be as same as XBee in Arduino program.

3->Set transmitter (PC with XBee) as coordinator during configuration.

4->Set receiver (Arduino with XBee) as End point during configuration.

5->Both XBee should set to same Channel (I set Channel C).

6->Both XBee Pan ID should be same ( I set 3001 or any number you want).

7->XBee operation voltage is 3.3V ONLY. Double check connection before power on.

Wiring Diagram

schematic_xbeeserial.png

This wiring diagram shows connection for Arduino with XBee circuit. Arduino PIN 8 set to OUTPUT for controlling LED on or off. Arduino PIN 2 and PIN3 connect to XBee PIN for data Rx and Tx. Arduino 3.3V pin supply power to XBee PIN 1.

Arduino Program

#include <SoftwareSerial.h>

#define HIGH 1

#define LOW 0

int data = 0;



/* Connection

 *

 * Arduino pin 2 to XBee DOUT pin (pin 2), Arduino pin 3 to XBee DIN pin (pin 3)

 */

SoftwareSerial xbee(2,3);

int LED_PIN = 8;



void setup() {

 // put your setup code here, to run once:


 xbee.begin(9600);  //set to same baud rate as xbee transmitter and receiver

 Serial.begin(9600);

 pinMode(LED_PIN, OUTPUT); //LED PIN 8 set as OUTPUT

}


void loop() {

 // put your main code here, to run repeatedly:


 if (xbee.available()>0)  //check xbee console whether available

 {


   while(exit!=0)

   {

     int exit = 0;

     data = xbee.read();  

     if (data == '1')     //LED PIN 8 HIGH when user input 1 through xbee console

     {

       digitalWrite(LED_PIN, HIGH);

       delay(50);

       exit = 1;

     }

     else if (data == '2')  //LED PIN 8 LOW when user input 2 through xbee console

     {

       digitalWrite(LED_PIN, LOW);

       delay(50);

       exit = 0;


     }


   }


 }


}

Conclusion

XBee provide wireless solution when you cannot access wifi or mobile network. Also, it is not quite hard to create a simple program to control Arduino pin with Arduino standard library. However, you are required to configure XBee properly.

Referring to XBee website, XBee series 1 operate range can up to 100m. However, the operation range like 9m for me under roughly test. Test location is full of buildings around myself.


Finally, please feel free to leave a comment if you have any inquires and suggestions.

Thank you