Go Down

Topic: swarm , wireless communication (Read 666 times) previous topic - next topic

codeRobo

Hi . I'm planning for a project that involves 3 to 4 individual , independent robots(they use micro controllers with arduino boards ) .

I would like to exchange data between the robots (A robot may send data at any point in time to any other robot ) . Which is the best module for me , I would want it to be low cost and simple to use as I don't know much of hardware .





Jeffrey Sun

I think xBee module can meet your requirement.

codeRobo

[size=12]How many pins do i need for XBee communication ?
What are the modules that I need to buy ?
Any example arduino code ?[/size]

Jeffrey Sun

Arduino board communicates with XBee by Serial port. I'm using Arduino Mega + Sensor Shield + XBee serial 1. The TX0, RX0 (pin 0, 1) are used for the communication.

The DFRobot (www.dfrobot.com) sells the XBee shields and modules. I'm not sure if this site is convenient for you. There are many sites around the world sell the arduino related modules. You can select a convenient one.

You can treat the XBee module as a wireless serial port. It will automatically transmit the data you send to serial port to the air. There is nothing special when wirte the code. I pasted a simple serial port test code below.


const int ledPin =  13;      // the number of the LED pin

void setup() {

     // initialization
     Serial.begin(9600);
     Serial.write("Hello world");
     digitalWrite(ledPin, HIGH);

}

void loop() {

     // Do the things.

      //Serial.write("Hello world");
      //delay(1000);

      if(Serial.available())
      {
           int c = Serial.read();
           switch(c)
           {
           case 'a':
                 Serial.write("Receive a\r\n");
                 digitalWrite(ledPin, HIGH);
                 break;
           case 'b':
                 Serial.write("Receive b\r\n");
                 digitalWrite(ledPin, LOW);
                 break;
           }
      }
}


To use the XBee modules, what you need to do is configure them, so that they can set up the wireless network.
You can get more details regarding how to configure the XBee module at http://arduino.cc/en/Main/ArduinoXbeeShield .


Go Up