WSN temperature and humidity
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

WSN temperature and humidity

by maro on Tue Mar 12, 2013 4:19 am

Dear forum member,
I want to build my ZigBee networks containing 5 XBee Pro S2(5 Arduino Uno) as Router and one gateway CPX4 as Coordinator.


--->In the gateway:

*PAN ID: 0x4a59
*channel: 0xc
*scan all channels

---->In router XBee Pro 2:

*PAN ID: 4a59
*channel scan: 16
*DH, DL destination: 0

I choose the star topology because each xbee module will send a temperature and humidity value to the server through the gateway.
These XBee modules receive nothing from gateway.(modules---->gateway).
It's the best choice or not ?if you can give me suggesions?

in script python:

To start,I tested this code which i can find my network XBee (it work 100%):
Code: Select all | TOGGLE FULL SIZE
print 'Starting up...'

#print ("We have " + nodes.size() + " Nodes. Checking to see if incoming is new...")

nodes = zigbee.getnodelist(refresh=True)
nodes = filter(lambda x: x.type != 'coordinator', nodes)

# Print the table:
print "%12s %12s %8s %24s" % \
    ("Label", "Type", "Short", "Extended")
print "%12s %12s %8s %24s" % \
    ("-" * 12, "-" * 12, "-" * 8, "-" * 24)
for node in nodes:
  print "%12s %12s %8s %12s" % \
        (node.label, node.type, \
            node.addr_short, node.addr_extended)

I can implemented the protocol CSMA / CD (Carrier Sense Multiple Access / Collision Detection): the module xbee sent these doonnes when the channel is available (in script)?

With this code , i read a data (Byte) from one XBee (with the x-ctu , i send a number and I receive.. work 100%) ..but ...How do I get the data from the 5 XBee?

Code: Select all | TOGGLE FULL SIZE
from socket import *

 # Create the socket, datagram mode, proprietary transport:

sd.bind(("", 0xe8, 0, 0))
# Block until a single frame is received, up to 255 bytes:

print "Waitting For New Packet"
payload, src_addr = sd.recvfrom(255)

print "payload"
print payload

How can I send a number from xbee to the gateway?!!
Code: Select all | TOGGLE FULL SIZE
#include <XBee.h>
#include <string.h>

XBee xbee = XBee();
char basehtml[30] = "ok";
XBeeAddress64 addr64 = XBeeAddress64(0x00000000, 0x00000000);
ZBTxRequest zbTx = ZBTxRequest(addr64, (uint8_t*) (basehtml) , sizeof(basehtml));

void setup() {

void loop() {



Posts: 1
Joined: Tue Mar 12, 2013 3:42 am

Please be positive and constructive with your questions and comments.