Tag Archive | "network"

RF Wireless Data with the Seeedstudio RFbee


In this article we examine the Seeedstudio RFbee Wireless Data Transceiver nodes. An RFbee is a small wireless data transceiver that can be used as a wireless data bridge in pairs, as well as a node in mesh networking or data broadcasting. Here is an example of an RFbee:

You may have noticed that the RFbee looks similar to the Xbee-style data transceivers – and it is, in physical size and some pinouts, for example:


However this is where the similarity ends. The RFbee is in fact a small Arduino-compatible development board based on the Atmel ATmega168 microprocessor (3.3V at 8MHz – more on this later) and uses a Texas Instruments CC1101 low-power sub1-GHz RF transceiver chip for wireless transfer. Turning over an RFbee reveals this and more:

But don’t let all this worry you, the RFbee is very simple to use once connected. As a transceiver the following specifications apply:

  • Data rate – 9600, 19200, 38400 or 115200bps
  • Adjustable transmission power in stages between -30dBm and 10 dBm
  • Operating frequency switchable between 868MHz and 915MHz
  • Data transmission can be point-to-point, or broadcast point-to-many
  • Maximum of 256 RFbees can operate in one mesh network
  • draws only 19.3mA whilst transmitting at full power

The pinout for the RFbee are similar to those of an Xbee for power and data, for example:

There is also the ICSP pins if you need to reprogram the ATmega168 direcly with an AVRISP-type programmer.

Getting Started

Getting started is simple – RFbees ship with firmware which allows them to simply send and receive data at 9600bps with full power. You are going to need two or more RFbees, as they can only communicate with their own kind. However any microcontroller with a UART can be used with RFbees – just connect 3.3V, GND, and the microcontroller’s UART TX and RX to the RFbee and you’re away. For our examples we will be using Arduino-compatible boards. If Arduino is new to you, consider our tutorials first.

If you ever need to update the firmware, or reset the RFbee to factory default after some wayward experimenting – download the firmware which is in the form of an Arduino sketch (RFBee_v1_1.pde) which can be downloaded from the repository. (This has been tested with Arduino v23). In the Arduino IDE, set the board type to “Arduino Pro or Pro Mini (3.3V, 8MHz) w/ATmega168”. From a hardware perspective, the easiest way to update the firmware is via a 3.3V FTDI cable or an UartSBee board, such as:


You will also find a USB interface useful for controlling your RFbee via a PC or configuration (see below). In order to do this,  you will need some basic terminal software. A favourite and simple example is called … “Terminal“. (Please donate to the author for their efforts).

Initial Testing

After connecting your RFbee to a PC, run your terminal software and set it for 9600 bps – 8 – None – no handshaking, and click the check box next to “+CR”. For example:


Select your COM: port (or click “ReScan” to find it) and then “Connect”. After a moment “OK” should appear in the received text area. Now, get yourself an Arduino or compatible board of some sort that has the LED on D13 (or substitute your own) and upload the following sketch:

Finally, connect the Arduino board to an RFbee in this manner:

  • Arduino D0 to RFbee TX
  • Arduino D1 to RFbee RX
  • Arduino 3.3V to RFbee Vcc
  • Arduino GND to RFbee GND
and the other RFbee to your PC and check it is connected using the terminal software described earlier. Now check the terminal is communicating with the PC-end RFbee, and then send the character ‘A’, ‘B’ or ‘C’. Note that the LED on the Arduino board will blink one, two or three times respectively – or five times if another character is received. It then reports back “Blinking completed!” to the host PC. For example (click to enlarge):

Although that was a very simple demonstration, in doing so you can prove that your RFbees are working and can send and receive serial data. If you need more than basic data transmission, it would be wise to get a pair of RFbees to experiment with before committing to a project, to ensure you are confident they will solve your problem.

More Control

If you are looking to use your RFbees in a more detailed way than just sending data at 9600 bps at full power, you will need to  control and alter the parameters of your RFbees using the terminal software and simple AT-style commands. If you have not already done so, download and review the RFbee data sheet downloadable from the “Resources” section of this page. You can use the AT commands to easily change the data speed, power output (to reduce current draw), change the frequency, set transmission mode (one way or transceive) and more.

Reading and writing AT commands is simple, however at first you need to switch the RFbee into ‘command mode’ by sending +++ to it. (When sending +++ or AT commands, each must be followed with a carriage return (ASCII 13)). Then you can send commands or read parameter status. To send a command, just send AT then the command then the parameter. For example, to set the data rate (page ten of the data sheet) to 115200 bps, send ATBD3 and the RFbee will respond with OK.

You can again use the terminal software to easily send and receive the commands. To switch the RFbee from command mode back to normal data mode, use ATO0 (that’s AT then the letter O then zero) or power-cycle the RFbee.

RFbee as an Arduino-compatible board with inbuilt wireless

As mentioned previously the RFbee is based around an Atmel ATmega168 running at 8MHz with the Arduino bootloader. In other words, we have a tiny Arduino-compatible board in there to do our bidding. If you are unfamiliar with the Arduino system please see the tutorials listed here. However there are a couple of limitations to note – you will need an external USB-serial interface (as noted in Getting Started above), and not all the standard Arduino-type pins are available. Please review page four of the data sheet to see which RFbee pins match up to which Arduino pins.

If for some reason you just want to use your RFbee as an Arduino-compatible board, you can do so. However if you upload your own sketch you will lose the wireless capability. To restore your RFbee follow the instructions in Getting Started above.

The firmware that allows data transmission is also an Arduino sketch. So if you need to include RF operation in your sketch, first use a copy of the RFBee_v1_1.pde included in the repository – with all the included files. Then save this somewhere else under a different name, then work your code into the main sketch. To save you the effort you can download a fresh set of files which are used for our demonstration. But before moving forward, we need to learn about controlling data flow and device addresses…

Controlling data flow

As mentioned previously, each RFbee can have it’s own numerical address which falls between zero and 255. Giving each RFbee an address allows you to select which RFbee to exchange data with when there is more than two in the area. This is ideal for remote control and sensing applications, or to create a group of autonomous robots that can poll each other for status and so on.

To enable this method of communication in a simple form several things need to be done. First, you set the address of each RFbee with the AT command ATMAx (x=address). Then set each RFbee with ATOF2. This causes data transmitted to be formatted in a certain method – you send a byte which is the address of the transmitting RFbee, then another byte which is the address of the intended receipient RFbee, then follow with the data to send. Finally send command ATAC2 – which enables address checking between RFbees. Data is then sent using the command

Where data is … the data to send. You can send a single byte, or an array of bytes. length is the number of bytes you are sending. sourceAddress and destinationAddress are relevant to the RFbees being used – you set these addresses using the ATMAx described earlier in this section.

If you open the file rfbeewireless.pde in the download bundle, scroll to the end of the sketch which contains the following code:

This is a simple example of sending data out from the RFbee. The RFbee with this sketch (address 1) sends the array of bytes (testdata[]) to another RFbee with address 2.  You can disable address checking by a receiving RFbee with ATAC0 – then it will receive any data send by other RFbees.

To receive data use the following function:

The variable result will hold the incoming data, len is the number of bytes to expect, sourceAddress and destinationAddress are the source (transmitting RFbee) and destination addresses (receiving RFbee). rssi and lqi are the signal strength and link quality indicator – see the TI CC1101 datasheet for more information about these. By using more than two RFbees set with addresses you can selectively send and receive data between devices or control them remotely. Finally, please note that RFbees are still capable of sending and receiving data via the TX/RX pins as long as the sketch is not executing the sendTestData() loop.

I hope you found this introduction interesting and useful. The RFbees are an inexpensive and useful alternative to the popular Xbee modules and with the addition of the Arduino-compatible board certainly useful for portable devices, remote sensor applications or other data-gathering exercises.

For more information and product support, visit the Seeedstudio product pages.

RFbees are available from Seeedstudio and their network of distributors.

Disclaimer – RFbee products used in this article are promotional considerations made available by Seeedstudio.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, education, lesson, RF, rfbee, seeedstudio, tutorial, wireless, WLS126E1P, xbee

Tutorial: Control AC outlets via SMS

Learn how to control AC outlets via SMS text message. This is chapter thirty-three of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

Updated 02/03/2013

Assumed understanding for this article is found in part one. If you have not already done so, please read and understand it.

In this chapter we will continue with the use of the SM5100 cellular shield to turn digital outputs on and off via SMS. However please read chapters twenty-six and twenty-seven first if you are unfamiliar with using the GSM shield with Arduino. As an extension of chapter twenty-seven, we will use our Arduino to turn on or off AC outlets via a common remote-control AC outlet pack. Please note this is more of a commentary of my own experience, and not an exact tutorial. In other words, by reading this I hope you will gain some ideas into doing the necessary modifications yourself and in your own way.

Firstly, we need some remote-control AC outlets. Most electrical stores or giant retail warehouses may have something like this:


Nothing too original, just a wireless remote control that can switch on or off receiver outlets on a choice of four radio frequencies. Before moving forward I would like to acknowledge that this article was inspired by the wonderful book Practical Arduino – Cool Projects for Open Source Hardware by Jon Oxer and Hugh Blemings. In chapter two an appliance remote-control system is devised using a similar system.

At first glance the theory behind this project is quite simple – using the hardware in example 27.2, instead of controlling LEDs, activate the buttons on the wireless remote control for the AC outlets – leaving us with AC outlets controlled via SMS. However there are a few things to keep in mind and as discovered during the process, various pitfalls as well.

Before voiding the warranty on your remote control, it would be wise to test the range of the remote control to ensure it will actually work in your situation. I found this was made a lot easier by connecting a radio to the remote outlet – then you can hear when the outlet is on or off. If this is successful, make a note of the amount of time required to press the on and off buttons – as we need to control the delay in our Arduino sketch.

The next step is to crack open the remote control:


… and see what we have to work with:


Straight away there are two very annoying things – the first being the required power supply – 12 volts; and the second being the type of button contacts on the PCB. As you can see above we only have some minute PCB tracks to solder our wires to. It would be infinitely preferable to have a remote control that uses actual buttons soldered into a PCB, as you can easily desolder and replace them with wires to our Arduino system. However unless you can casually tear open the remote control packaging in the store before purchase, it can be difficult to determine the type of buttons in the remote.

As you can see in the photo above, there is an off and on pad/button each for four channels of receiver. In my example we will only use two of them to save time and space. The next question to solve is how to interface the Arduino digital outputs with the remote control. In Practical Arduino, the authors have used relays, but I don’t have any of those in stock. However I do have a quantity of common 4N25 optocouplers, so will use those instead. An optocoupler can be thought of as an electronic switch that is isolated from what is it controlling – see my article on optocouplers for more information.

Four optocouplers will be required, two for each radio channel. To mount them and the associated circuitry, we will use a blank protoshield and build the Arduino-remote control interface onto the shield. The circuitry for the optocoupler for each switch is very simple, we just need four of the following:

As the LED inside the optocoupler has a forward voltage of 1.2 volts at 10mA, the 390 ohm resistor is required as our Arduino digital out is 5 volts. Dout is connected to the particular digital out pin from the Arduino board. Pins 4 and 5 on the optocoupler are connected to each side of the button contact on our remote control.

The next consideration is the power supply. The remote control theoretically needs 12 volts, however the included battery only measured just over nine. However for the optimum range, the full 12 should be supplied. To save worrying about the battery, our example will provide 12V to the remote control. Furthermore, we also need to supply 5 volts at a higher current rating that can be supplied by our Arduino. In the previous GSM chapters, I have emphasised that the GSM shield can possibly draw up to two amps in current. So once again, please ensure your power supply can deliver the required amount of current. From experience in my location, I know that the GSM shield draws around 400~600 milliamps of current – which makes things smaller and less complex.

The project will be supplied 12 volts via a small TO-92 style 78L12 regulator, and 5 volts via a standard TO-220 style 7805 regulator. You could always use a 7812, the 78L12 was used as the current demand is lower and the casing is smaller. The power for the whole project will come from a 15V DC 1.5A power supply. So our project’s power supply schematic will be as follows:

Now to mount the optocouplers and the power circuitry on the blank protoshield. Like most things in life it helps to make a plan before moving forward. I like to use graph paper, each square representing a hole on the protoshield, to plan the component layout. For example:

It isn’t much, but it can really help. Don’t use mine – create your own, doing so is good practice. After checking the plan over, it is a simple task to get the shield together. Here is my prototype example:


It isn’t neat, but it works. The header pins are used to make connecting the wires a little easier, and the pins on the right hand side are used to import the 15V and export 12V for the remote. While the soldering iron is hot, the wires need to be soldered to the remote control. Due to the unfortunate size of the PCB tracks, there wasn’t much space to work with:


But with time and patience, the wiring was attached:


Again, as this is a prototype the aesthetics of the modification are not that relevant. Be careful when handling the remote, as any force on the wiring can force the soldered wire up and break the PCB track. After soldering each pair of wires to the button pads, use the continuity function of a multimeter to check for shorts and adjust your work if necessary.

At this stage the AC remote control shield prototype is complete. It can be tested with a simple sketch to turn on and off the related digital outputs. For example, the following sketch will turn on and off each outlet in sequence:

Now to get connected with our GSM shield. It is a simple task to insert the remote shield over the GSM shield combination, and to connect the appropriate power supply and (for example) GSM aerial. The control sketch is a slight modification of example 27.2, and is shown below

The variable pressdelay stores the amount of time in milliseconds to ‘press’ a remote control button. To control our outlets, we send a text message using the following syntax:

Where a/b are remote channels one and two, and x is replaced with 0 for off and 1 for on.

So there you have it – controlling almost any AC powered device via text message from a cellular phone. Imagine trying to do that ten, or even five years ago. As always, now it is up to you and your imagination to find something to control or get up to other shenanigans.


Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in AC power, arduino, CEL-00675, CEL-09607, cellphone hacking, cellular, GSM, hardware hacking, lesson, SM5100, SMS, tutorial

Tutorial: Arduino and GSM Cellular – Part Two

Continue to learn about connecting your Arduino to the cellular network with the SM5100 GSM module shield. This is chapter twenty-seven of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

Updated 02/03/2013

Assumed understanding for this article is found in part one. If you have not already done so, please read and understand it. In this instalment we continue with bare projects which you can use as a framework for your own creations.

Reach out and control something

First we will discuss how to make something happen by a simple telephone call. And the best thing is that we don’t need the the GSM module to answer the telephone call (thereby saving money) – just let the module ring a few times. How is this possible? Very easily. Recall example 26.1 – we monitored the activity of the GSM module by using our terminal software. In this case what we need to do is have our Arduino examine the text coming in from the serial output of the GSM module, and look for a particular string of characters.

When we telephone the GSM module from another number, the module returns the text as shown in the image below:


We want to look for the text “RING”, as (obviously) this means that the GSM shield has recognised the ring signal from the exchange. Therefore need our Arduino to count the number of rings for the particular telephone call being made to the module. (Memories – Many years ago we would use public telephones to send messages to each other. For example, after arriving at a foreign destination we would call home and let the phone ring five times then hang up – which meant we had arrived safely). Finally, once the GSM shield has received a set number of rings, we want the Arduino to do something.

From a software perspective, we need to examine each character as it is returned from the GSM shield. Once an “R” is received, we examine the next character. If it is an “I”, we examine the next character. If it is an “N”, we examine the next character. If it is a “G”, we know an inbound call is being attempted, and one ring has occurred. We can set the number of rings to wait until out desired function is called. In the following example, when the shield is called, it will call the function doSomething() after three rings.

The function doSomething() controls two LEDs, one red, one green. Every time the GSM module is called for 3 rings, the Arduino alternately turns on or off the LEDs. Using this sketch as an example, you now have the ability to turn basically anything on or off, or call your own particular function. Another example would be to return some type of data, for example you could dial in and have the Arduino send you a text message containing temperature data.

And now for a quick video demonstration. The first call is made, and the LEDs go from red (off) to green (on). A second call is made, and the LEDs go from green (on) to red (off). Although this may seem like an over-simplified example, with your existing Ardiuno knowledge you now have the ability to run any function by calling your GSM shield.

Control Digital I/O via SMS

Now although turning one thing on or off is convenient, how can we send more control information to our GSM module? For example, control four or more digital outputs at once? These sorts of commands can be achieved by the reception and analysis of text messages.

Doing so is similar to the method we used in example 27.1. Once again, we will analyse the characters being sent from the GSM module via its serial out. However, there are two AT commands we need to send to the GSM module before we can receive SMSs, and one afterwards. The first one you already know:

Which sets the SMS mode to text. The second command is:

This command tells the GSM module to immediately send any new SMS data to the serial out. An example of this is shown in the terminal capture below:


Two text messages have been received since the module was turned on. You can see how the data is laid out. The blacked out number is the sender of the SMS. The number +61418706700 is the number for my carrier’s SMSC (short message service centre). Then we have the date and time. The next line is the contents of the text message – what we need to examine in our sketch.

The second text message in the example above is how we will structure our control SMS. Our sketch will wait for a # to come from the serial line, then consider the values after a, b, c and d – 0 for off, 1 for on. Finally, we need to send one more command to the GSM module after we have interpreted our SMS:

This deletes all the text messages from the SIM card. As there is a finite amount of storage space on the SIM, it is prudent to delete the incoming message after we have followed the instructions within. But now for our example. We will control four digital outputs, D9~12. For the sake of the exercise we are controlling an LED on each digital output, however you could do anything you like. Although the sketch may seem long and complex, it is not – just follow it through and you will see what is happening:

And now for a video demonstration:

So there you have it – controlling your Arduino digital outputs via a normal telephone or SMS. Now it is up to you and your imagination to find something to control, sensor data to return, or get up to other shenanigans.

If you enjoyed this article, you may find this of interest – controlling AC power outlets via SMS.


Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, CEL-00675, CEL-09607, cellphone hacking, cellular, GSM, hardware hacking, lesson, microcontrollers, SM5100, SMS, tutorial

Tutorial – Arduino Uno and SM5100B GSM Cellular

Shield is now obsolete. Contact your hardware supplier for support.

Posted in arduino, CEL-00675, CEL-09607, cellphone hacking, cellular, GSM, lesson, SMS, tronixstuff, tutorial

Subscribe via email

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: