sending a chunk of data using zigbee - zigbee

I have some nodes with installed Xbee s2 on them. the zigbee modules configured as routers and coordinator, in zigbee mesh topology. I want to send data from each node to some other nodes.
question:
how I have to send data? here is a pseudo code that I have in mind. I want to know if there is any API in zigbee stack that I can use for this, and if I miss anything:
init_network;
fragment_data_to_frames;
fork();
if(process_is_parent)
for(i=0;iMbum_frames;i++){
send_frame(i);
wait(x miliseconds)// how much do I have to wait? or do I have to wait upon receiving ack,i.e. wait(ack(i));
}
}
if(process_is_child){
check_acknowledgment_packets();//does zigbee notify me that the frame is lost? or I have handle it by myself, e.g. by assuming frame is lost after specific time.
}
resend_lost_frames;
in the destination node, how I can retrieve the data? Do I have to handle it by myself by checking the sequence number and profile, and concatenating the packets? or Zigbee stack will do it for me.

XBee radio modules in API mode will generate a "Transmit Status" frame to indicate that a frame number was received by the remote module. There's no guarantee that the host on the other side successfully processed it, since it's a network-layer acknowledgement and not application-layer.
How much data are you planning to send? ZigBee was designed for low-speed, low-volume data transmission. If you're just using XBee modules, you can make use of their proprietary protocols (like transparent serial). For interoperability, you'll need to read up on the ZigBee Cluster Library and how it uses general commands and attributes to transfer information between nodes.

Related

Achieve polling with Arduino and Lora Module

I'm using Lora 1276 and Arduino to collect data from here every nodes.
The example code I use is from here and it work successfully!
As far I know, LoraWAN is using TDMA to distribute the time to any nodes.
And polling by the gateway to get the data. That can make the nodes keep low power consume and let gateway to be control master.
I searched some information about preamble which is at the front of packet, nodes will decide whether to reply after received. If nodes receive a preamble that does not match,it will go back to sleep.
Is there any sample code for polling mode?
Thanks.
LoraWAN Class B devices do indeed use TDMA for scheduling periodic receive windows.
Here is sample code implementing Class B. https://github.com/Lora-net/LoRaMac-node/tree/master/src/apps/LoRaMac/classB

conceiving a bus can adapter using stm32

So here is the thing, I want to conceive a universal BUS CAN adapter using stm32 with a desktop interface using Qt.
Still in the conception phase, I'm wondering how to treat the frames coming from the stm to PC GUI, weather 1) as a USB frame; in this case, how to encapsulate and decapsulate them into CAN frames and is there a Qt library to facilitate the job, or 2) as a CAN frame in this case I found the QCanBusDevice and QCanBusFrame Class which seem to be so helpful but in this case a CAN plugin must be specified during the object creation. So what should i do?
It doesn't really matter what you do because you're designing a custom protocol that rides on top of USB. Here you have an option of implementing a USB communications class device so that you don't need custom drivers nor libusb - especially given that the performance of libusb on Unixes is abysmal.
Once the data is available to the userspace, you can access it using QSerialPort. You'll have to frame the CAN frames somehow, as serial port is a stream-oriented transport and doesn't know of any packets. Most trivially, you can encapsulate the frames using RFC 1662 HDLC octet-stuffed framing. You can encapsulate the commands to your device, and their responses, in the same fashion, using one of the fields, e.g. the ADDRESS field, to multiplex CAN data and commands/responses.
If you now wish to expose this device to the Qt Serial Bus framework, you'll have to write a custom CAN plugin to access it.
To give some idea of how much code this is: total for Qt code and microcontroller code should be well under 1500 lines for a proof-of-concept. A minimal demo would be probably <400 lines of Qt code and <400 lines of STM32 code.

Zigbee sniffing using killerbee channel detecting error

I configured two Digi xbee s1 module with same channel and PAN ID and both as end device. Communication happens perfectly between these modules.
Problem is when i use rzusbstick with killerbee firmware to look for all the available PAN ID and channel.
using zbstumbler it didnt detect any PANID on my channel.
when enabled verbose i get
"Received frame is not a beacon (FCF=6188).
Received frame."
I tried with different channel, PANID and Destination/MY address. Still the same.
Is it a problem with the module or the configuration or something else?
XBee Series 1 modules are 802.15.4 only, and don't implement the ZigBee protocol. Make sure you're sniffing tools are only looking at 802.15.4 frames, and not assuming they're ZigBee. It's even possible that the XBee modules are using a proprietary protocol on top of 802.15.4 for their features like Remote AT Commands and Transparent Serial Data.

Sending data on COM Port while receiving data on it?

My application can send and receive data independently on COM Port (9 pin). Now the scenario is that, the destination device while sending data can also request some data. Now, in that case my application while receiving the data from the device, would have to send the requested data as well. So the question is, is it possible conceptually to send some data while receiving data from the same COM port ?
Note: If this is not the right place to ask this question, please let me know which SO site is apt for this.
Sure it is. The RS232 is a full duplex interface, hence there are two independent channels for each direction.
But note that these two channels are different pins of course. You cant send and receive on the same pin with the RS232 (Although it is theoretically possible to transmit and receive data over a single line simultaneously - but not in this case).

XBee Send To All

I have a simple xbee network operating where there are a bunch of slaves operating remotely and all talking to one master, who is connected to the server computer. That works no problem.
The slaves all send their ID as part of the packet and I'd like to have the master deliberately send an Ack after a delay. I'm trying to figure out how to do this efficiently and it seems that the only plausible way that doesn't involve reprogramming the master before each Ack is to send the Ack to all slaves and have them ignore the packet if it's not meant for them.
That solution is ok - I just can't figure out the command to use to do this. Is there some sort of Serial sendAll command? All of the devices are on the same ATID.
Typically in this situation, you would configure the master in API mode so you would get "Receive Explicit" frames with source addressing information, and could send with the "Transmit Explicit" frame type, and include addressing information in your frames.
If you use AT mode (transparent serial mode), then you're stuck having to change the DH and DL parameters on your coordinator every time you want to change who you send to. You should avoid using broadcast packets, since each one results in lots of network traffic (IIRC, each router will send the broadcast packet three times).
I do not know of a good XBee library on the Arduino, but it might be possible to port Digi's Open Source ANSI C XBee Host Library to that platform.

Resources