RFbee communication help

Hello,

First, sorry for my language, it can be average because it’s not my native language.

I come here to find some help about RFbee. I want to make a wireless communication between 2 computers with 2 RFbee like that :
COMPUTER --> UNO --> I/O SHIELD --> RFBee --> ------air------> RFBee --> I/O SHIELD --> UNO --> COMPUTER

To do that, i have :

  • 2 cards arduino uno
  • 2 shields DFRobot I/O Expansion Shield V7.1
  • 2 RFBee v1.1

I’ve searched much time but i just don’t understand how it work and how to programate it. I found much and much sites (seedstudio limits the number of links for new users so i can’t tell you which i visited)

But even with all that, i don’t understand how to do to make it work. Scripts or exemple just doesn’t work when i try them. I tried to modify them but nothing worked.

Someone could take some time to explain me clearly and the easiest possible how tu do it please? An exemple of basic codage for RFBee would be really great!

Hi,

What you can do at the receiver side is, upload a simple code in the UNO which sends some number, say ‘1’ and is received by the Receiving Uno. The whole communication goes through the pair of RFBee modules both kept in either Rx-Tx mode or Transceiver modes.

Sender code:

[code]void setup()
{
Serial.begin(9600); // beginning the Serial Communication

// Read the AT Commands section in RFBee Datasheet to understand AT Commands below
//Start control mode in RFBEE using NUM’s +++
Serial.print("+++\r");
delay(40);
//Read firmware version (should be 1.1)
Serial.print(“ATFV\r”);
delay(10);
//Read HW version (should be 1.0)
Serial.print(“ATHV\r”);
delay(10);
//Read current baud setting (should be 0=9600bps)
Serial.print(“ATBD\r”);
delay(10);
//set mode, initially it’s transceiving
Serial.write(“ATMD0\r”);
delay(10);
//Set Output format
Serial.write(“ATOF3\r”); // Check Datasheet
delay(10);
//Set My (source) Address
Serial.write(“ATMA2\r”);
delay(10);
//Set Destination Address
Serial.write(“ATDA1\r”);
delay(10);
Serial.write(“ATAC2\r”);
delay(10);
Serial.write(“ATTH0\r”);
delay(10);
Serial.write(“ATPA7\r”); Maximum Power, can adjust as per requirement
delay(10);
Serial.write(“ATCF5\r”); Least Data rate, can change as per requirement
delay(10);

//Go back to data mode
Serial.print(“ATo0\r”);
}

void loop()
{

 Serial.print('1');
 delay (2000); // delay 2 seconds

}
[/code]

This code would serially send ‘1’ every 2 seconds.

Similarly, you can make the receiving code using Serial.read() command of Arduino Serial library.

Thanks,
Tanmay Chaturvedi

Thanks for your help.

I tried your code but data is not send from rfbees, it just prints in monitor but not send to the other one.

I don’t understand, in your code, there only Serial.print. That only show what is between parentheses, i don’t understand how it can configurate rfbees with just Serial.print.

I did that code with Serial.read() you adviced me :

[code]
int incomingbyte = 1;

void setup()
{
Serial.begin(9600); // beginning the Serial Communication

// Read the AT Commands section in RFBee Datasheet to understand AT Commands below
//Start control mode in RFBEE using NUM’s +++
Serial.print("+++\r");
delay(40);
//Read firmware version (should be 1.1)
Serial.print(“ATFV\r”);
delay(10);
//Read HW version (should be 1.0)
Serial.print(“ATHV\r”);
delay(10);
//Read current baud setting (should be 0=9600bps)
Serial.print(“ATBD\r”);
delay(10);
//set mode, initially it’s transceiving
Serial.write(“ATMD0\r”);
delay(10);
//Set Output format
Serial.write(“ATOF3\r”); // Check Datasheet
delay(10);
//Set My (source) Address
Serial.write(“ATMA2\r”);
delay(10);
//Set Destination Address
Serial.write(“ATDA1\r”);
delay(10);
Serial.write(“ATAC2\r”);
delay(10);
Serial.write(“ATTH0\r”);
delay(10);
Serial.write(“ATPA7\r”); //Maximum Power, can adjust as per requirement
delay(10);
Serial.write(“ATCF5\r”); //Least Data rate, can change as per requirement
delay(10);

//Go back to data mode
Serial.print(“ATo0\r”);
}

void loop()
{

 incomingbyte =  Serial.read();
 Serial.println(incomingbyte);
 delay (1000); // delay 2 seconds

}[/code]

when i write something like “a” for exemple, it’s show me a number “97” only in the monitor where i write it but not in the other one.

What should i do?

  1. Serial.print() helps you to print the data currently on the Serial monitor.

Serial.write() helps you to write something on the serial monitor, where writing means sending data actually to the serial pins of any device which can be transmitted to any other peripheral connected serially.

So, in my code, Serial.print("ATHV\r") only tells the Hardware Version. However, when I write Serial.write("ATMD0\r") , it actually configures the mode of operation of RFBEE in Transceiver mode.

  1. If Sender has its own Address 2 ATMA2 and its Destination Address is 1 ATDA1 then at the receiving side, it would just be opposite ATMA1 and ATDA2 I can see that you didn’t change the address, infact kept both addresses same, so they wouldn’t communicate.

  2. It only sends a Byte, and is sent in form of an ASCII value. So, you may browse on converting ASCII into INT value and then send, or you may try to read the ASCII value first at the Receiving side and then convert into INT. As per what I remember, INT value is ASCII - ‘0’ .

a ok! I didn’t understand it like that.

I changed it :

[code]int incomingbyte = 1;

void setup()
{
Serial.begin(9600); // beginning the Serial Communication

// Read the AT Commands section in RFBee Datasheet to understand AT Commands below
//Start control mode in RFBEE using NUM’s +++
Serial.print("+++\r");
delay(40);
//Read firmware version (should be 1.1)
Serial.print(“ATFV\r”);
delay(10);
//Read HW version (should be 1.0)
Serial.write(“ATHV\r”);
delay(10);
//Read current baud setting (should be 0=9600bps)
Serial.print(“ATBD\r”);
delay(10);
//set mode, initially it’s transceiving
Serial.write(“ATMD0\r”);
delay(10);
//Set Output format
Serial.write(“ATOF3\r”); // Check Datasheet
delay(10);
//Set My (source) Address
Serial.write(“ATMA2\r”);
delay(10);
//Set Destination Address
Serial.write(“ATDA1\r”);
delay(10);
Serial.write(“ATAC2\r”);
delay(10);
Serial.write(“ATTH0\r”);
delay(10);
Serial.write(“ATPA7\r”); //Maximum Power, can adjust as per requirement
delay(10);
Serial.write(“ATCF5\r”); //Least Data rate, can change as per requirement
delay(10);

//Go back to data mode
Serial.print(“ATo0\r”);
}

void loop()
{

 incomingbyte =  Serial.read();
 Serial.println(incomingbyte);
 delay (1000); // delay 2 seconds

}[/code]

and :

[code]int incomingbyte = 1;

void setup()
{
Serial.begin(9600); // beginning the Serial Communication

// Read the AT Commands section in RFBee Datasheet to understand AT Commands below
//Start control mode in RFBEE using NUM’s +++
Serial.print("+++\r");
delay(40);
//Read firmware version (should be 1.1)
Serial.print(“ATFV\r”);
delay(10);
//Read HW version (should be 1.0)
Serial.write(“ATHV\r”);
delay(10);
//Read current baud setting (should be 0=9600bps)
Serial.print(“ATBD\r”);
delay(10);
//set mode, initially it’s transceiving
Serial.write(“ATMD0\r”);
delay(10);
//Set Output format
Serial.write(“ATOF3\r”); // Check Datasheet
delay(10);
//Set My (source) Address
Serial.write(“ATMA1\r”);
delay(10);
//Set Destination Address
Serial.write(“ATDA2\r”);
delay(10);
Serial.write(“ATAC2\r”);
delay(10);
Serial.write(“ATTH0\r”);
delay(10);
Serial.write(“ATPA7\r”); //Maximum Power, can adjust as per requirement
delay(10);
Serial.write(“ATCF5\r”); //Least Data rate, can change as per requirement
delay(10);

//Go back to data mode
Serial.print(“ATo0\r”);
}

void loop()
{

 incomingbyte =  Serial.read();
 Serial.println(incomingbyte);
 delay (1000); // delay 2 seconds

}[/code]

So if i understand what you told me, with those configurations, both monitor should show me the text i wrote but for me, it didn’t change anything.
here is what i have on one of my monitors :
when i start :

when i write letter “a” :

You have used Serial.read() in both Rx and Tx code. It would only read the values in the serial pins.

Since you are not using Serial.write() function at the Tx side, there would be no data being written on serial port and the serial port would read -1, which means NO DATA at the serial port.

First, at the Tx side, write say Serial.write(“1”). If you will see the Serial monitor at Tx side, you would see a stream of 1s.
Please make note that this 1 is not at an integer.

Now, at the Receiver side, use Serial.read() function and see the output in Serial monitor.

Ok, i changed for the sender’s code : incomingbyte = Serial.read() to incomingbyte = Serial.write(“1”)

Now the Tx side read 11 (for value of “1” i suppose) and the Rx side read -1.

If i well understand, there is now one RFBee what is Tx and the other one is Rx, right? So after set source and destination addresses and set Serial.write on the Tx and Serial.read on the Rx, it should exchange datas, i don’t see what where is the problem.

  1. No need to use the variable ‘incomingbyte’. Directly write Serial.write(‘1’);

  2. When you see -1 on the serial monitor, it simply means there is NO DATA on serial pins. This occurred because data was NOT being written on the serial pins.

  3. Do you have a UARTSBee?? For testing purpose, what you can do is, at the Receiver side:
    a) use UARTSBee and connect RFBee to your computer using UARTSBee.
    b)when you connect, you’ll see ‘OK’, press +++ and then you would see ‘Entering command mode’. [Refer DATASHEET]
    c) the AT commands you use in the code, you have to manually enter it.
    d) after configuring it, type ‘ATo0’ and press ENTER. You’d enter in DATA MODE.

As you can see in the Rx code also, DATA mode is used to transmit or receive any data

at the TX side, you have to use Arduino/any RFBee compatible board and burn the code given. If the connection goes proper, you would see the data over the Receiver side.

PS: you have to use any Serial Software like: TeraTerm, HyperTerminal or PuTTy at the Rx side to see data.

i have only that :

  • 2 cards arduino uno
  • 2 shields DFRobot I/O Expansion Shield V7.1 (if i’m not wrong, it’s an UARTSBee)
  • 2 RFBee v1.1

and i can use only arduino IDE to programmate it.

It’s not exactly UARTSBee but it’s more than that. Further, it may serve the purpose.

So, you may try what I told you in the thread above.

I decided to remove the shield expansion. So now, RFBee is directly connected to arduino uno. I connected :
pin 3v3 arduino ----> pin 3v3 RFBee
pin ground arduino ----> pin GND RFBee
pin 2 arduino ----> pin TX RFBee
pin 3 arduino ----> pin RX RFBee

I tried tu use the code with that configuration but it’s show the same things.

Is a UARTSBee compulsory?

i tried also that code :

[code]#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);

Serial.println(“Hello”);

// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("+++");
delay(100);
mySerial.println(“ATMA1”);
delay(100);
mySerial.println(“ATDA2”);
delay(100);
mySerial.flush();

}

void loop() // run over and over
{

//if (mySerial.available())
//Serial.write(mySerial.read());
//if (Serial.available())
//mySerial.write(Serial.read());
mySerial.println(“A”);
delay(1000);
}[/code]

it’s print me “hello” but nothing else but i think it should work.