Wednesday, 26 February 2014

ZIGBEE (Tarang F4) interfacing with microcontroller

When there is a need of long range two way communications in hobby electronics most of the people prefer "ZIGbee" modules. there are several zigbee modules available in the market...with several ranges and qualities..

Tarang F4 is also a similar module.....

So let's see how to use these modules for normal full duplex serial communication with UART:

  1.  This module can be easily interfaced with  any 8 bit microcontroller with all standard baud-rates between 1200 to 115200.   
  2. Each module consists of a 16 bit address. So user must provide a source address and destination address while configuring the module. which means only the destination module with matched address can only receive the data.
  3. User can select the RF channels among 16 channels with addresses from 0x00 to 0x0F. The modules must be in same channel to establish the communication between them. 

 lets check the pin configuration of this module.

Tarang module works on 3.3v  power supply. so sufficient voltage regulator must be used.


By default the tarang F4 module: works at baud-rate of : 9600
                      source address : 0x1000   (hexadecimal)     
destination address : 0x1000            
RF channel : 0x00     
it means :

"by default any tarang F4 module can communicate with any other module".

 So tarang modules can be directly interfaced with microcontroller with baudrate of 9600. The connection circuit will be as follows.

NOTE: if your microcontroller is working at 3.3V then you can directly interface it to the microcontroller. if your microcontroller is working at 5V connect a resistor of 100ohms between TXD pin of MCU and Din pin of Tarang F4.


For configuring the tarang F4 module first connect the module to PC serial Port. Now a days our laptops are not designed with serial ports directly. So we have to go for USB to Serial converters Like FT232, CP2102 or  Prolific connectors.

  1. Connect the module to PC using any above serial interface.
  2. open "hyper terminal"(in xp) or use any similar software in case of  Windows7 or 8 like "Tera Term".
  3. connect to the selected "COM" port and select local echo option select baudrate of 9600,databits 8, hardware : none.
  4. Device must be set to command mode by entering three '+' symbols "+++"  with in one second. and Do not press enter.
  5. you will get a response from module "OK".
  6. Enter the correspond AT commands as per your requirement and press enter. Follow the command as per the data sheet. Some of the useful basic commands are listed below.
  7. After entering the settings the settings must be stored in the memory. "ATGRD" is the command used to store the settings. If this is not used the current settings will be lost.
  8. to exit the command mode "ATGEX" is used. it gives "EXIT" as response.  


  1. "ATGEX" : exit form command mode ; response: "EXIT"
  2. "ATGRD": set module to default settings(channel(00)baud(9600),address(1000));response:"OK"
  3. "ATGWR":stores current settings; response : "OK"
  4. "ATNCH": sets/read channel number: response:"00" to "0F" (total 16 supporting channels)
  5. "ATNMY":set/read source address: response:"1000"(16 bit hexadecimal number)
  6. "ATNDA":set/read destination address: response:"1000"(16 bit hexadecimal number)
  7. "ATSBD": set/read baudrate: response: "00" to "07".