On my project, I'm using XBeeS2C+Digispark and connect each other as Serial communication(UART). I'm using SoftSerial on Digispark to set XBee. I have 1 coordinator and 3 routers in the same network.
Now I'm trying to tell routers the coordinator time. I don't now well how can I get time information(year, month, day, hour etc..) using XBee. Is it possible to get time information from Coordinator?
Or should I use RTC?
XBee hardware does not keep track of date/time. You could have a single device on your network use an RTC or some other connection (maybe a gateway with Ethernet/Wi-Fi connectivity to the Internet?) to track time and broadcast that information to the other devices periodically.
Related
I know that when a PC is OFF, some components still working ,like the motherboard, the NIC (network card), and others. I thought that like the 'magic packet' send to the NIC on the Wake-on-Lan do, there is a form of sending another signal to this one.
How can I get the SMBIOS table, through the Network Card of a remote and power-off PC?
If someone knows of some code example, or manual which can read to learn, it would be very helpful.
How can I get the SMBIOS table, through the Network Card of a remote and power-off PC?
You can't. WoL is a function of the NIC. When it receives a magic packet it triggers a PMI event, waking up the mainboard - that's it. You can't magically talk through the NIC to the powered down system.
There are two solutions, depending on your actual goal:
Many servers, some workstations and PCs feature lights-out management through a baseboard management controller - features differ, you'll need to select the appropriate product.
Wake the machine, run whatever queries you need and shut it down again. This is a standard procedure for client management.
I am doing a project with 2 raspberry pi which work as servers and a laptop which is the client.
I have attached to each raspberry and usb microphone and using the Portaudio Library im capturing audio streaming
and send it back to the laptop through a tcp/ip connection.
The scope of this project is to locate sound sources and it works like this. I run a .c file on each raspberry which are
connected on the same LAN as with the PC laptop. When this program is running on both raspberryies i have a message
"Waiting connection for a client". The next thing to do is just to run the matlab file which will start the both raspberries
and record. I have managed to synchronize the raspberries to start in the same time through a simple condition like
do
{
sleep(0.01);
j = read(newsockfd, &start,1 );
} while (j==0);
so right before both raspberries have to start recording i pause them in order to finish the initialization commands and so on
and then i just send a character "start = 'k'" through my matlab program
t1,t2 are tcp connections
start = 'k';
fwrite (t1, k);
fwrite (t2, k);
from this point both raspberries open the PortAudio stream and call recordCallBack function.
When I run the application and clap, i still get a delay of 0.2s between them which causes
an error of 60 meters. I have also checked the execution time of the fwrite function but that might
save me about 0.05 seconds which will still lead to results far from reality.
This project is based on TDOA measurement and it is desired to have a delay under 0.01 seconds to get accuracy <1m.
I have heard that linux has some very accurate timers, and i was thinking that maybe i could use that to
clock the time inside the functions in the .c file. Anyway if you have any ideas of how i can measure the delay from
the point i send the character 'k' from matlab until the point where the audio stream is opened in microphone, or any
way how i could synchronize the 2 linux servers please help.
ps: both are raspberry 2 pi and connected through UTP cables so the processing and transmission rates should be the same
It looks like an interesting project but I think you underestimate the problem a little bit. The first issue is that you need to synchonize the two sensors. Given the speed of sound and if you want an accuracy of about 1m you need to synchronize them with about 1ms accuracy. You could try with the Network Time Protocol but I'm not sure you can reach this accuracy even with a master on the local network. Better synchronization can be achieved with PTP (over ethernet) or GPS if you can receive a GPS signal.
Then if you manage to achieve this, a first step could be to record a few hand claps on both raspberry pi, save the timestamp when you start recording on both and see if you actually obtain something significant. Maybe you will also need to use a microcontroller and a real-time operating system instead!
There are many ways to synchronise clocks. It could be in a system level or in application level.
System level tend to be easier because there are already tools to do the job. I don't recommend you doing PTP at this stage, as mentioned by Emilien, since it is quite complicated to make it work. Instead I would recommend you to use normal setup via the same NTP network on all machines.
Example of NTP setup:
Query the server with # ntpdate -q 0.rhel.pool.ntp.org
If it is running, setup your local clock with # ntpdate 0.rhel.pool.ntp.org 1.rhel.pool.ntp.org
OBS: # means root user (which most likely means that you will need to run the command with sudo), whilst $ means normal user.
Check all machines times with $ date +%k:%M:%S.%N which will return the clock down to a nanosecond resolution.
If that doesn't acheive the desired result then try the PTP aproach, or just synchronise all your devices when they connect to the master, where your master can normalise each independant clock. I will not go into details here.
Then you can send your audio data via TCP/IP (or perhaps UDP/IP to lower latency) like you mentioned before, but always send the timestamp of your slave machine associated to a audio frame using clock_gettime() function with CLOCK_REALTIME as the clk_id argument.
My project will have two "companion computers" on-board a quadcopter. One will speak to APMCopter autopilot running on a pixhawk, using dronekit python, and the other will communicate with it's peer over ethernet.
I'd like both computers to have closely synchronized time, and I'd like them both to be synchronized to the GPS time from the GPS connected to the pixhawk.
The documentation for mavlink indicates that there is a "system time" message which includes the GPS time in uSec. How do I obtain this data on the companion computer, using DroneKit?
#vehicle.on_message('SYSTEM_TIME')
def listener(self, name, message):
print message.time_unix_usec
ArduCopter will send the system time about 4 times per second. This method will run every time.
i have a webserver application using PHP, this application have to send 200MB of data to every device connected to the local network using wifi (Devices are a minimum of 100 to 300). I can send it using a ZIP file (200MB) or sending every single file (from 1 to 10 MB for each file).
Actually i have used TCP protocol on a very good hardware and all works very good! but now, i have to send it using a raspberry Pi 2..
what is the best protocol to do it? I can use a multicast approach? someone know the best way for do it on a raspBerry? I need this operation takes a very short time ;)
ps: For wifi network i have a very good antenna and i can link my raspeberry to the router using cable.
How can I make multiple nodes communicate to a coordinator without loss of data?
When more number of XBee nodes send their data simultaneously to the same XBee coordinator won't there be problems of congestion? To my knowledge, it's an yes.
In such case, how can I avoid this congestion? Also, I want the system to work in real time. So there should not be any delay.
I came across Stack Overflow question XBee - XBee-API and multiple endpoints. I deal with a similar problem.
How was this was solved?
As you add devices on a network, the only way to avoid congestion is to transmit less frequently.
If you look at the XBee documentation, most of the modules have a "Transmit Status" frame that the host receives once the message has been successfully delivered (or abandoned due to errors). I believe the success response is triggered by a MAC-level ACK on the network.
If you have smart hosts on your nodes, they can adjust their transmit frequency by waiting for an ACK before sending their next frame, and maybe even using the retries counter in the Transmit Status frame to set a delay before sending.
While the 802.15.4 protocol sends data at 250 kbit/s, the overhead of headers, relaying of messages across a mesh network, and dealing with collisions brings that down to around 100 kbit/s of useable bandwidth. Try to maximize the payload from your devices, to increase the data-to-headers ratio. Sending five pieces of data in a single frame every five seconds is better than one piece in a frame every second.
How much data do you need to send, and what is your definition of "real time"? Is a 10 ms delay acceptable? How about 100 ms? 500 ms? How many devices will try to send at the same time? How often will they send?
All of those questions will figure into your design, and you may find that 802.15.4 isn't suited for what you need to do.
I have setup 15nodes of Series 2 XBee.Node will have multiple sensor like Light,motion etc. XBee placed on Fio board and send data for every 3 min.
Node will be in AT mode and Co-ordinator in API mode.Nodes go through few Router XBee ( AT mode). Co-ordinator collects data (Connected to R'pi) and upload data to server.
It is not mesh network and Xbee will not sleep.
So,i did not encounter any congestion issue at this level.
Hope this helps.