I have two different sensors connected to my Raspberry pi and I have to send the data to other device. The transmission of data is through wireless network. I have been asked to send the data in synchronization (i.e. data collected together from sensors must reach/ process at destination together).

I have no prior experience in field of Networking or IoT (I'm currently reading Data Communications and networking by Forouzan for the same). I have searched Google but no relevant website comes up.

*Using LoRa for transmission.

  • reach/ process at destination together ... what does that mean exactly? ..... the data cannot arrive at the same time because the communication is serial ..... does it mean that it needs to arrive in one message?
    – jsotola
    Feb 11 '19 at 7:30
  • 1
    it means that data collected at nth second should be processed together. for example if image and sound are sent then image of 10th second should reach destination with sound of 10th second. Is it possible? or is there a other way round?
    – Breakpoint
    Feb 11 '19 at 10:43
  • This is a pure programming question. Just collect the data and send JSON or two parameters to an HTTP GET, etc Feb 12 '19 at 11:16

This is a programming task. In your code, you can probably read values of the sensors separately. Now you have to write 2 threads(2 equals number of different sensors) that wait for data to be read, and put a mutex that holds the program until both data is read. When both data is read, unlock the mutex, combine your data variables in a JSON(or any other) and send them once.

  • Thank you, this answer seems to be closet to what I have been asking for. But since, I haven't implemented it yet it's hard to mark it as the answer. I'll do the same once the implementation is done successfully! thanks once again
    – Breakpoint
    Feb 11 '19 at 16:24
  • It's the correct answer (to an off-topic question). Please accept it now, which will help others who read the question in future. If you wait until it is implemented, there is a chance that you will forget & then others won't have the benefit of an accepted answer. Feb 12 '19 at 11:28

You can send it to the other device if the other device can be a web server. Another possibility is to create a web server in the Raspberry Pi (RPi). Then, with the other device, you can connect to the RPi when you need to update the data of those sensors.

In both cases, you can collect the data of both sensors and after that, work with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.