I am acquiring data from 4 arduino boards (3 Nano and 1 Uno) using serial communication. The USBs of each ardunio is connected to a USB hub device. From USB hub outlet is connected to the PC. I am plotting the received data using Processing software.
I have experienced that several serial ports data becomes delayed with the time. I need to plot all 4 data synchronized in real time.
Is it a problem with the USB hub which delaying the data plotting in several serial ports?
How can I resolve this problem ??
This is hard to reproduce as nobody will have your hardware specs. I can only suggest to explore previous posts related to Arduino and multiple USBs and explore other online Arduino forums. If an online forum indicates it is possible to manage multiple data sources in sync in real time, then you can either try other libraries or debug the current one. Finally, I suggest that for every question you share a MCVE as it could help to reproduce by any member in the community, if they are in the position to do so.
If you have to capture sensor data in sync, I would suggest to label them with a timestamp when measuring it (on the Arduino). Then transfer the data to processing and re-order / plot them using the measured timestamp. Otherwise delays in your USB hub, serial implementation (or where-ever) will delay your measurements (more or less significantly).
The only problem is now, how to sync the different Arduino devices. But there are a lot of topics about that in the Arduino forum. Scrolling throuh some of the solutions, I would suggest to check if you really need multiple Arduinos, or if maybe one (a stronger one) is better suited for the task.