3

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.

3
  • 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
    Commented Feb 11, 2019 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
    Commented Feb 11, 2019 at 10:43
  • This is a pure programming question. Just collect the data and send JSON or two parameters to an HTTP GET, etc
    – Mawg
    Commented Feb 12, 2019 at 11:16

2 Answers 2

2

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.

1
  • 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
    Commented Feb 11, 2019 at 16:24
1

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 and acknowledge you have read our privacy policy.

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