-
Notifications
You must be signed in to change notification settings - Fork 0
General Description
This is an application designed to allow communication between 2 autonomous devices, connected to the same Network.
This project was accomplished in order to let 2 devices (Arduino Board & Raspberry Pi computer) communicate with each other via the network using the predefined protocol. The Arduino chip is connected with the Light & PIR (movement) sensors and sends the information they provide to the Raspberry Pi. The Raspberry Pi is responsible for receiving and storing this information into a local file, in order to be used/analysed later.
The communication is done using UDP transmission protocol. Under the hood, it uses java.net.DatagramSocket to listen a specific port for incoming datagrams DatagramPacket. This ensures a simple approach on receiving information as we can extract the information contained in these datagrams to the format we need.
The data transmitted from the Arduino Board is received as a String of predefined format, which contains the information about the sensors' state.
- This String is parsed in order to extract the information about each sensor.
- Given the information extracted, a new object
Messageis created, which encapsulates the current status of the sensors and records it as aJSONObjectto the local file, usingJsonServiceclass.