Communication plays an important role in distributed applications. It allows devices in a system to communicate with each other in order to exchange information or coordinate to perform some tasks. Depending on the communication requirements of the application such as wired / wireless, short distances / long distances, data transfer rates, security etc., suitable communication methods can be selected. In this work, Serial communication (RS-232 protocol) is chosen to demonstrate its application through the following examples. (The examples are broken down into their own links for easy access)
EXAMPLE 1 demonstrates application of using Serial communication for exchanging data between DragonBoard and Raspberry Pi. The DragonBoard requests measurements from the MPU-9255 and LIDAR Lite v2 sensors and packs the sensor measurements into data packages. Before sending the data to the Raspberry Pi, the DragonBoard generates an interrupt signal to notify to the Raspberry Pi about its incoming messages. By using the interrupt technique, the Raspberry Pi can take initiative in receiving messages, thereby saving its CPU time instead of using polling technique to wait for the incoming messages. Upon receiving the message, the Raspberry Pi will unpack the data and extract the measurements of the sensors. In addition, a Producer / Consumer pattern is applied for the sending and receiving data.
EXAMPLE 2 demonstrates a collaboration of DragonBoard (or Raspberry Pi) and Arduino (Nano or Due) to control a 2-DOF Pan and Tilt mechanism using servo motors. The DragonBoard directs the movement of the Pan and Tilt mechanism by sending the control commands to the Arduino via Serial communication. The Arduino will process the commands and control the servo motors. Interrupt technique is also applied between the DragonBoard and Arduino to enhance the coordination.
EXAMPLE 3 demonstrates application of using Serial communication in transferring data between an IoT device and a computer. The DragonBoard requests measurements of temperature and humidity from the SHT21 sensor, packs these measurement data into data packages and then sends them to the computer. A LabVIEW application in the computer will receive these data packages and extract the temperature and humidity measurements.
EXAMPLE 4 introduces an application of using DragonBoard/ Raspberry Pi to get updated GPS information (Global Positioning System) from a Ublox Neo-M8N GPS Module. Basically, the Ublox GPS Module transmits NMEA messages carrying GPS satellite information via Serial communication to the DragonBoard/ Raspberry Pi. An algorithm is designed to filter the received NMEA messages and extract selected information such as GPS Latitude, Longitude and UTC Time.
Serial communication using RS-232 Protocol
Serial communication using the RS-232 protocol is one of the common communication methods. It is a wire-based communication that allows a direct connection between two devices. In a simple connection, the RX pin (Receiver) on one side is connected to the TX pin (Transmitter) on the other side. The UART (universal asynchronous receiver/transmitter) interface is the hardware that implements this Serial communication. However, the disadvantage is this hardware interface only allows two devices to communicate with one another. Moreover, the distance and the data transfer rate are limited.
Technically, DragonBoard 410c and Raspberry Pi 3 can directly communicate with each other via their UART hardware. However, personal testing showed that the direct connection between the DragonBoard 410c and Raspberry Pi (2/3) is unstable because the DragonBoard 410c is designed to operate at low logic level (1.8V).
To enable the computer to communicate with the DragonBoard 410c or Raspberry Pi, UART hardware must also be supported on the computer. However, new generation computers do not have built-in UART hardware on the mainboard.
To solve those problems, a USB to TTL Serial Adapter module might be a solution. In fact, this module integrates a popular FT232RL chip which is a USB to serial UART interface. Using this module enables a UART hardware interface available on a USB port. In addition, this module allows a baud rate of 1 Mbps can be reached on the Serial communication.