Topics
Data Transmission

Data Transmission

Every solution needs data to be transmitted between microcontrollers and connected components and between multiple microcontrollers.

Data transmission can be categorized into two forms:

  • Between two or more computing devices over a computer network over a wired or a wireless connection.
  • Between the computing device and connected components, such as from a processor to a peripheral, or between two microcontrollers through direct connection.

The first form of data transmission happens over networks using communication protocols such as WiFi which we have read about in the topics on Networking. The second form of data transmission between directly connected components and microcontrollers uses a different set of protocols which we will cover here.

Data is transmitted in a digital bitstream (a sequence of bits). Digital data can be transmitted without any conversion, but analog data (or analog signals) must be converted to a digital bitstream first. Analog data includes voice and other audio or video information that is a continuous signal, which varies in amplitude, phase, or other properties.

Analog data needs to be digitized for transmission and then converted back to analog data at the receiving device only if it has to be sent to an analog output device (such as an audio speaker). This conversion is carried out using analog-to-digital conversion and data compression mechanisms, such as pulse-code modulation (PCM). It often requires specific components or devices known as codec (an abbreviated version of code-decode) devices.

Data Tranmission

When designing or building circuits using microcontrollers, such as Arduino boards, it is important to know these protocols. Each sensor, controller, or any other component may have a different data transmission protocol. They will have to be connected to the board accordingly, and the instructions will also have to be programmed depending on the protocol being used.

The three most common protocols are:

  • Serial Peripheral Interface (SPI)
  • Universal Asynchronous Receiver/Transmitter (UART)
  • Inter-Integrated Circuit (I2C)

All three are quite a bit slower than protocols like Ethernet, WiFi, and Bluetooth. However, they are a lot simpler and use less hardware and system resources, thus ideal for communication between microcontrollers and between microcontrollers and sensors where only very small volumes of data need to be transferred.

Microcontroller boards are connected to your computer to upload programs to them and to send and receive data to and from the microcontrollers. This data exchanges happens using UART. All other sensors and module may use any of the three protocols listed above. You have to check the specifications and the pinout diagrams and make the connections and code accordingly.

Data Transfer Characteristics

Data transmission has several characteristics, depending on the type of data being transmitted between the devices. There are two main characteristics for digital data transmission: Serial and Parallel and Synchronous and Asynchronous.

  • Serial and Parallel transmission The communication links across which computers (or parts of computers) talk to one another, either in serial or parallel. In serial communication, the bits are sent one by one through a single wire, while in parallel communication, multiple bits are sent together, each through a separate wire.

    For example, an 8-bit parallel channel will convey 8 bits simultaneously, whereas a serial one would convey those same 8 bits sequentially, one at a time. If both channels operated at the same clock speed, the parallel one would be eight times faster.

    Although serial communication appears to be inferior to parallel communication, there are many reasons why it is still preferred, especially with advances in technology that have improved its data transmission speeds.

    Serial communication requires fewer wires/pins, which results in a significant reduction in the size, complexity, and cost of connectors. Designers of devices like smartphones benefit from the development of connectors/ports that are small, durable, and still provide adequate performance. Integrated circuits are expensive when they have more pins. To reduce the number of pins in a package, many ICs use a serial connection to transfer data when speed is not important.

    Crosstalk creates interference between the parallel lines, and the effect worsens with the length of the communication link. It places a limit on the length of a parallel data connection as compared to a serial one. Therefore, serial communication is used for all long-distance communication and most computer networks, where the cost of the cable, synchronization challenges, and the crosstalk make parallel communication impractical.

    On the other hand, parallel data connections are easily implemented in hardware, making them a better choice for connecting peripherals and memory devices such as RAM, where speed is important.

  • Simplex and Duplex In simplex transmission, the communication between devices takes place in only one direction. The sending device can only send the data, and the receiving device can only receive data. A reverse transmission is not possible. For example, a keyboard or a mouse can only send data to the processor as it cannot (and need not) receive any data back from the processor. Similarly, the processor sends data to the monitor for display but cannot receive data back from the monitor.

    As technology evolves, the monitor example may not hold true since touch-screen monitors or touch screens on smartphones can also send input back to the processor.

    In duplex transmission, devices can communicate with each other in both directions. There are two modes of duplex transmission: Half-duplex and Full-duplex.

  • Half Duplex The communication between two devices occurs in both directions, either one device sends and the other will receive, but only in one way at a time. If one device is sending data, the other device must wait for all data to be sent before it can start sending. In telecommunication, an example is walkie-talkies, where either side can speak, but only one of them has to speak at a time as they cannot speak parallelly.

  • Full Duplex The communication between two devices occurs in both directions, either device can send and the other will receive, or both can send and receive simultaneously. For example, in a telephone conversation, two people communicate, and both are free to speak and listen at the same time. The conversation is likely to get a bit garbled if both are speaking at the same time. Therefore, speakers have to follow some protocols to use full-duplex effectively.

  • Synchronous and Asynchronous transmission When a device transmits data to another device, there must be a specific pattern the devices must follow. From the continuous bitstream of data it receives, the receiving device must have some way of determining where each unit of data begins and where it ends. There are two modes of data transmission: Synchronous and Asynchronous.

    In synchronous transmission, the sending and receiving devices rely on an external clock pulse to indicate when to start to send stop sending and receiving data. In asynchronous transmission, there is no reliance on a clock; instead, bits of data to indicate the start and end of data transmission are inserted into the actual bitstream of data.

    Synchronous transmission is faster, easier to implement, but if the clocks the two devices refer to are not in sync, the data transmission will fail. Asynchronous transmission is slower but more difficult to implement since the start and end of every byte of data has to be inserted while sending and read while receiving.