WSN temperature and humidity

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

WSN temperature and humidity

Postby maro » Tue Mar 12, 2013 3: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.

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,
maro
 
Posts: 1
Joined: Tue Mar 12, 2013 2:42 am

Return to General Project help

Who is online

Users browsing this forum: ~Snail~ and 8 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [107]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]