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)
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
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);
}
Sincerely,