Hello guys,
I am working on a project of a vibration sensor wireless network. Have two Arduinos UNO with MPU6050 and XBee S1 sampling data and transmitting to a coordinator, which is an Arduino UNO with a XBee S1 connected to my PC via USB, that by its turn sends the data to PC and MatLab plots graphs with it in real time.
My doubt is related to the communication modes I can use: API and AT.
-
First of all, a very basic doubt: Do you know if it is possible to build a three node communication using AT? I know I can`t just say to sensors -"Scream all your data to coordinator as you sample", cause this would create packet crashes, but is there anyway to coordinate this transmission using AT in a reasonable speedy way? This question is just to see if I am in the right track, since I have eliminate the possibility of using AT from the very beginning because couldn't find anyone saying this would be possible.
-
Is there any difference in terms of transmission speed between API and AT? For what I have learned, the way the XBee "physically" transmits is the same for both modes and the difference relies on how the code treats the data sent and received: while in AT I have just to say Serial.print and Serial.read in API I have to build/read the entire package. So, supposing I am sending the number "1" using both methods, would one be faster then another, in terms of transmissions completed per, lets say, second?
-
All these questions are because I am facing a problem with my project. I was trying to reach sampling rates (in other words, I needed to sample from MPU) between 100Hz and 10000Hz. BUT, the coding I have produced, with my very limited knowledge, using the XBee API library, only allows me to reach around 40 Hz. The code of sensor basically follows the logic:
- Sample data and keep in an array;
- Listen for data request from coordinator: if yes send array, if not do another sampling
The code from coordinator just alternate data request between the two sensors.
I am kind lost because I cant identify if the capping is on my code or on hardware specifications. Tried to read the datasheets but it seems to arid for me yet, still trying to extract useful information about this matters.
I am not including my codes because the forum says I am exceeding 9000 characters, but I am attaching it. I think it is not necessary to read it to answer the questions, but nonetheless will include it if anyone is interested. Please consider this is my first Arduino project and this is by far not the final version, as I am still experimenting on it (so there might be some variables declared which are not being used in the code), although I think the gross structure is there, since it works (but far from the speed I intended).
Regards
*Obs: Tx is acctually the code for the Receiver (coordinator). Rx is the code for the Transmitter (sensors). Sorry for this confusion.
XBee_Tx_-tentativa_1-MODIFICADO-_2_sensores.ino|attachment (9.68 KB)
XBee_Rx_-tentativa_1-MODIFICADO_-2_sensores-_simplex.ino|attachment (4.9 KB)