This tutorial is to show wireless communication between two Arduinos using RFBee. There are two types of RFBee available in Cytron, they are RFBee 434MHz UART Wireless Module (100m) and RFBee 433MHz UART Wireless Module (1km):
RFBee 434MHz UART Wireless Module (100m)：Having operating frequency of 434 MHz and wireless range of 100 m. This wireless range is measured under open space, the wireless range may reduce if we use it in indoor.
RFBee 433MHz UART Wireless Module (1km): Having operating frequency of 433 MHz and wireless range of 1 km. Again, this specification is measured under open space, and it may reduce when we use it in indoor.
Since they have different operating frequencies, both these modules are not compatible with each other. We need same frequency module in order to set up the wireless communication. Also, they are not compatible to the low cost RF transmitter and receiver.
Both RFBee modules have similarities as follows:
- They are transceiver module, which means they are able to receive and transmit data wirelessly.
- Both of them are using UART TTL interface protocol and half duplex (default), and able to support baud rate from 1200 bps to 115200 bps (default is 9600 bps).
- There are 100 channels to be configured for security and interference avoidance purpose.
- The configuration can be done with AT command.
- The supply voltage is 3.3V.
In this tutorial, I’ll show you how to use RFBee modules to establish a wireless communication between two Arduino. The Arduino board I am using in this tutorial is the CT-UNO board and the RFBee module is RFBee 434MHz UART Wireless Module (100m)
- CT-UNO board x 2
- RFBee 434MHz UART wireless module (100m) x 2
- Cytron XBee shield x 2
- USB micro B cable x 2
- LED x 2
- Resistor 180Ω x 2
- Resistor 1kΩ x 2
- Push button x 2
First, take out the RFBee module from the package. There are 3 components in the package: a RFBee-434MHz module, an spiral antenna and a XBee breakout board.
The breakout board is not needed in this tutorial so I just keep it aside. Next, solder the antenna on the antenna pad of the RFBee module.
Plug the RFBee on the Cytron XBee Shield and further plug the whole shield onto CT-UNO board.
Make sure the RFBee is plugged into XBee Shield correctly, same goes to the XBee shield, and repeat these steps for another set of RFBee and CT-UNO.
Connect CT-UNO to PC/computer via USB micro B cable to configure the RFBee. There are 100 channels available for RFBee module. To configure the RFBee, the MODE must be switched from “Trans” to “AT”, and the mini jumpers should be plugged at the “USB” and “USB” for Tx and Rx on Cytron XBee Shield.
There are 3 parts in the configuration we can set:
- A – module address
- B – serial port baud rate
- C – wireless communication channel
Let start with a simple test of communication by sending the command of “AT“. If everything is working, we will obtain the return of “OK“.
The second step is set the module address. The module address can be changed by sending “AT+A” follow by 3 digit values, and the values can be between 000 and 255. The default value is 000.
For example, I sent AT+A010 to the module via Serial Monitor, and I will obtain return OK+A010.
The third step is set the serial port baud rate. The serial port baud rate can be changed by sending “AT+B” follow by valid baud rate. The baud rate can be set to be 1200, 2400, 4800, 9600, 19200, 38400, 57600, and 115200. The default value is 9600.
For example, I sent AT+B4800 to the module via Serial Monitor, and I will obtain return OK+B4800.
The last step is set the wireless communication channel. The channel can be changed by sending “AT+C” follow by 3 digit values, and the values can be between 001 and 020. The default value is 001.
By using combination ABC, there is over 100 channels available. Remember, both RFBee modules MUST have same configuration in order to communicate to each order.
In this tutorial, a push button and 1kΩ resistor are connected to the XBee Shield pin 2, and a LED and 180Ω resistor are connected to XBee Shield pin 13.
Remember to plug the mini jumpers at the D1 and D0 for Tx and Rx of Cytron XBee Shield respectively so that the sketch can be uploaded into CT-UNO later on.
Next is the coding. The coding is simple: when push button is pressed, CT-UNO will sends integer ‘1’, else it will send integer ‘0’; when CT-UNO receives ‘1’, the LED will ON, if it receives ‘0’, the LED will OFF. Here’s the sketch:
The baud rate we configured in the RFBee configuration will be the baud rate of the serial communication of CT-UNO. Since the baud rate I set in the RFBee is 4800, so the value in the Serial.begin( ) should be 4800. If you set different baud rate, remember to change that baud rate in the Serial.begin( ).
Upload the sketch into CT-UNO. After that, all the steps are repeated for another CT-UNO.
Figure below shows the CT-UNO boards after set-up:
Video below shows the wireless communication between two CT-UNO using RFBee modules: