WSN temperature and humidity

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
maro
 
Posts: 1
Joined: Tue Mar 12, 2013 3:42 am

WSN temperature and humidity

Post by maro »

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.

Configuration:

--->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

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

from socket import *

 # Create the socket, datagram mode, proprietary transport:
sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_TRANSPORT) 

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

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

print "payload"
print payload
Arduino
How can I send a number from xbee to the gateway?!!

Code: Select all

#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() {
  xbee.begin(9600);
  Serial.begin(9600);
  } 

void loop() { 
 
  xbee.send(zbTx);  

  delay(1000); 
} 
Thanks...

Sincerely,

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”