Xbee Address problem for making a breadcrumb network - xbee

Sir , i am trying to make a breadcrumb network using raspberryPi and Xbees. Please tell what destination address should i put in Coordinator node so that it receives data only from a single router.I am using all Xbees in API modes. Thanks in advance.[Image of the Addresses of my xbees i am using.Click to get image
Router3 Router2 Router1 Coordinator
Please suggest what addresses should i put so that Router3 send data to Router2, Router2 to Router1 and Router1 to Coordinator.
If suppose Router3 send some data, it first goes to Router2, then to Router1 and then reaches Coordinator.
I am trying to connect the GPS to all the Router RaspberryPis and trying to send these to Coordinator Node.

With a mesh network, you direct your message to the final destination and the nodes take care of relaying it as necessary to reach the destination.
So nothing to do on the coordinator, and each router uses a destination address of 0 in their API frames to send to the coordinator.
If you really want to force the messages to hop from router to router, just use the router's 64-bit address (the ATSH and ATSL values) in the API frames you're using to send your data. When you receive a frame on a node, just replace the destination address with the next hop and resend it.

Related

Extra Transmission Event logged in the trace.json file

I have created a 4 node network, where node-A and Node-B are routed to send data to node-D via node-C. I sent one data packet from node-A to node-D via node-C. While analyzing the trace.json file, I got that there are two transmission events are logged in the trace.json file from node-A. I tried turning off reliability but the same thing happen. What could be the reason? Please help.

Duplex communication between Client and server open62541(OPC-UA)

I would like to establish bidirectional data communication between client and server. The following example explains what I am trying to acheive.
Ex: Client sends a request to read the value of the two node ids(these node ids are numeric) every sec. Then in the client program it adds these numbers and gives it to the user.
Then after 60 seconds ,the server tells the client to multiply the number .So now every second the client is multiplying the values of the node ids. Then after 60 seconds , it switches back to addition again.
I am able to request the data from the server through the client but I am trying to figure out how to make server request for data from the client?
Edit: I would like to add some new information to my original question.The reason is to make the post more clearer.The following image describes what I am trying to acheive.
In the above image,provider can be visualised as a server method and consumer can be visualised as a client method. Now if safety consumer2(client2) is connected to safety provider2(server2),how to pass the data received from safety provider2 to safety provider1.(as client can only be connected to a single server).Does the features of open62541 allow the following data flow:
safety provider 2-->safety consumer2 --> safety provider1? If yes, can you provide an example? Thanks
That's not really how OPC UA works.
Instead, your client could monitor the Value attribute of some VariableNode in the server and then behave a certain way based on the current value.
The OPC UA protocol does what its documents specify and what you ask is not possible.
But you can make the client read both the values and the multiplier and do the operations you want on the client side, apart from OPC UA

Setting up zigbee network with X-CTU 6.3.2

I'm trying to create Zigbee P2P using XB24C27WIT-004 modules with Digi USB explorers(CP2102). I am using 2 laptops and connected the XBee modules to each of them. I have added the modules to X-CTUs and changed the DL of one module as MY of another module and vice versa. Both are on same channel and same PAN ID. But i couldn't see the serially transmitted data from one console to another. The console window is as shown in the image. The commands are being seen when i'm trying to discover other radio.The console window. The function is set to ZIGBEE TH Reg for both modules.
Have you configured one as a coordinator (ATCE=1) and the other as a router (ATCE=0) so they can join to each other? The Router can keep ATDH and ATDL as 0 to target the coordinator. I'm not familiar with using the 16-bit network address for the destination, so I'd recommend setting ATDH to the router's ATSH, and ATDL to ATSL.
To confirm that the devices are joined to each other, their operating PAN ID (ATOI and ATOP) must match. Once you see that, see if the router can send data to the coordinator, and then from the coordinator to the router. You can use ATNR on the router to perform a Network Reset so it will try to re-join your coordinator. You might need to set ATNJ to 0xFF on the coordinator to allow joining.

Apache Camel for TCP based streamer

The need is to have a Camel (Mina/Netty) based TCP server running on a specific port, which allows multiple TCP clients to connect to it. The content to be streamed is available in files and the TCP server has to send each line in the text files to one of the connected clients (round robin).
Can someone help me with the outline of a camel route to achieve this?
Also it is possible to throttle the streaming speed for example 100 msg/sec per connected client?
Thanks in advance.
MK
I have done something like this. Well not quite exactly to what you want but I can make some suggestions on how to get started.
Lets use the MINA component for this route as I had some issues with the Netty component see this link Exception thrown from Apache Camel Netty Consumer When more than one client sends data. Apparently this has been fixed but as my project got cancelled I never tested it again.
So from your description this will be a text line based protocol a simple route for this would look like this in the DSL
<route>
<from uri="mina2:tcp://localhost:5555?textline=true"/>
<to uri="bean:fileProcessing"/>
</route>
This route will open a listening socket on the localhost on port 5555. The route is also setup to use a textline codec. A textline codec is essentially a line of text terminated end of line character i.e. \n. If you are going to be using some other protocol you will need to look into the following items:
ProtocolEncoder—The ProtocolEncoder handles the task of taking an input
payload and putting bytes onto the TCP channel.
ProtocolDecoder—The ProtocolDecoder interprets the custom
binary protocol message to something your application can understand.
ProtocolCodecFactory— This creates the encoder and decoder.
You could implement some logic in the fileProcessing bean to send the replies back. There is a catch however the clients will have to request when they are ready to get a new line. From my understanding this follows a request reply scenario. However from what I have seen the route is only active when there is a message coming in from the client to the server.
There might be a way to initiate the sending from the server but you will need to experiment with that by yourself on getting it done I have not done anything like that myself.
Critical reading would be the following.
Mina Documentation
Blog Entry On Using MINA
My suggestion is to start with a basic route like this and then expand your logic and then come back with problems you might encounter.
UPDATE:
So I did a little research on this and it does not appear possible to send events from the server to the client without following one of the following patterns InOnly and InOut.
Try just using MINA or Netty then.

Communicate to public IP from a local network (WinSock, C)

I'm new to this forum (at least at asking questions), so please be patient. I'm trying to write simple client-server applications to communicate using datagram (UDP) sockets, with C and Windows.
The scenario is very simple, I want to be able to send/receive data from a machine in some local network (behind a GATEWAY/NAT) to some host having public IP. I can send the data, but it seems impossible to receive any data back, because the remote server can't see the client's local IP.
I don't want the user to perform manual port forwarding on the GATEWAY, and I also don't want to use UPnP because of security issues (though it also should be enabled by the user).
I think it is possible because applications like Skype or Browsers can do it, but how ?
Are there some automatically forwarded ports or things like that ? I'm exhausted of searching the web ... PLEASE HELP !
For UDP connections, most home NAT gateways will automatically create a temporary reverse mapping for each outbound packet.
Consider a scenario where your client is running on the internal machine with IP address 192.168.4.5, sending a UDP packet from port 65000 to the external address 64.34.119.12:6789, via a gateway with external IP address 192.0.43.10. When the gateway sees your internal client send a UDP packet from 192.168.4.5:65000 to the external address, it will NAT it to an external address and port, like 192.0.43.10:5500. Your server will see a packet with a source address of 192.0.43.10:5500 and destination address 64.34.119.12:6789. The router also sets up a reverse mapping, so that if it sees a packet arrive on the external interface with a source of 64.34.119.12:6789 and a destination of 192.0.43.10:5500, it will redirect it back to 192.168.4.5:65000. This mapping typically times out after a short while.
This means that in simple cases, all you need to do is:
On the client, use the same port to send to the server and listen for responses;
On the server, respond to the client at the address and port that the client's packet was receieved from, using the same server port that recieved the packet;
Have the client send the initial packet in the conversation;
Don't leave the "connection" idle for more than a few minutes at a time.

Resources