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.

WORKING PROCESS:

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.

CONFIGURING THE MODULE:

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.  

SOME TARANG F4 BASIC AT-COMMANDS 

  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". 
00=>1200
01=>2400
02=>4800
03=>9600
  04=>19200
  05=>38400
  06=>57600
    07=>115200

15 comments:

Unknown said...

Thank you for this information......:)

Unknown said...

Thanx .,.Man

Niyaz said...

This is very good information, Thank you.
Instead of micro controller, I want interface zigbee with programmable logic controller.

Niyaz said...

This is very good information, Thank you.
Instead of micro controller, I want interface zigbee with programmable logic controller. How do do this? Please help me

Unknown said...

Hai i want crate the mesh topology for zigbee.For this how can i set the coordinator node,Router and End device.I have done node to node communication with two zigbee's.Now i want to add the more zigbee's modules for mesh topology.How can i do this?please reply me back thank you.

VAMSI DANDA said...

Mr Unknown there is a document is available online. like a user manual. you need to set the source and destination address of all Tarang F4 modules to FFFF. which enables them to communicate with all modules online. you can make your own standard data frame with start and stop bytes and checking codes you can make sure that a particular data packet can only be processed by the target receiver. you can even make encryption and decryption commands in your MCU.

Unknown said...

Hai vamsi thanks for u r response.If will keep the source and destination address 0xFFFF then it will acts as in broadcast mode.By this the communication will not happens between the slaves i.e the every slave will only gives the response to initiator(Master) .Now i have been trying for communication between the slave to slaves as well as master by that i can extend my network for some distance.Now my doubt is how can i set the TARANG module is Co-ordinator,Router and End-Device.I hope will get some information thank you.

VAMSI DANDA said...

address of all tarangs should be FFFF each and every one in the network
so any module can broadcast to all remaining in the network.

Unknown said...

Is there any way the zigbee module to set as coordinator,Router and End device.

Krishna Rao Mane said...

for mesh module tarang f20 "atnmy", "atnda", "atnud" and few.. ATcommands are showing "error" insted of "OK"

Krishna Rao Mane said...

for mesh module tarang f20 "atnmy", "atnda", "atnud" and few.. ATcommands are showing "error" insted of "OK"

How to make it work and atnud is not showing 0 (zero) as default i.e. networkID communication mode but showing 02 userid communication mode

Please Help me Out...

Thanks

Krishna Rao Mane said...

malampati surendra You can use same module(tarang f20/4) but u have to update firmware and has to configure it using ATCOMMANDS. other wise you can use digimesh which has all three in it and in this also u have to configure which mode module has to work.

Krishna Rao Mane said...

malampati surendra You can use same module(tarang f20/4) but u have to update firmware and has to configure it using ATCOMMANDS. other wise you can use digimesh which has all three in it and in this also u have to configure which mode module has to work.

VAMSI DANDA said...

Try using caps instead of small letters.

Coastal Institute said...

after getting Ok by pressing +++, we get only ERROR by entering any of the AT Commands , any one can help

Post a Comment