Communication protocol

What is the difference between UART and MQTT protocol ? How does it work in bolt?

MQTT is basicaly a communication protocol designed for connection of devices which has limited hardware capabilities using low bandwith and carrying not much overhead information with the data.

UART is actually not a communication protocol but a physical circuit whose main purpose is to transmit and receive data signal between devices.it is basically a language for communicating between devices.

In bolt we use the mqtt protocol to send data from the device to the bolt cloud while UART is used for connecting bolt to other microcontrollers like arduino

1 Like

MQTT:
so it’s a messaging protocol as mentioned above. It use for m2m communication. Due to its light weight efficiency it drain less power to communicate. we call it a pub/sub protocol. It comprises of some terms as :Broker, Client, Topic, Publish, Subscribe

  • Broker is a MQTT server which holds all data
  • Client is connected devices to it
  • Topic is a container of specified information/message
  • Publish used to send data from device to broker
  • Subscribe used to receive data from broker to device
    So while taking a simple example-
    let’s suppose we used to calculate the intensity of light using bolt device. So our bolt device is a broker where we are connecting other devices such as light bulb or mobile. The LDR sensor is publishing the data to broker on a perticular topic let say topic/intensity. And our light bulb and the mobile device is subscribe to that topic. So whenever the data reached low that is light intensity low it tells bulb to switch on and notify to mobile device through broker.
  • It’s a lightweight protocol. So, it’s easy to implement in software and fast in data transmission.
  • It’s based on a messaging technique. Of course, you know how fast your messenger/WhatsApp message delivery is. Likewise, the MQTT protocol.
  • Minimized data packets. Hence, low network usage.
  • Low power usage. As a result, it saves the connected device’s battery.
  • It’s real time! That’s is specifically what makes it perfect for IoT applications.

UART:
So it’s a protocol for physical device to communicate serial data. Some module which work on UART are GPS module, Blutooth, RFID module. It uses 2 wires for communication i.e rx and tx. It doesn’t required clock signal i.e it’s a asynchronous.
Simply it collect the parllel bits and converts it to serial data packet which include start bit,data bit, parity bit and a stop bit. That data packet used to send and receive at other end and same data packet is used to receive for communicaion.
so when it gets parallel data from microcontroller it add all extra stuff.
start bit: It gets high to low for transmission
data bit: it contains the information and send in less significant bit.[5-8 bit contain with parity bit].
parity bit: it’s type of confirmation that right data ha received at other end. No data had destroyed in between communication
stop bit: Same as start bit it turns low to high when transfer of packet gets stop.

UART-
UART is not a communication protocol but a physical circuit,its main purpose is to trasmit and receive serial data.
In UART communication twi UART’s communication directly with each other .The transmitting UART converts parallel data from a controlling device like a CPU into serial form, transmitts it in serial to the receiving UART,which then converts the serial data back into parallel data for the receiving device.
UART Circuit Connection

The minimum connection required for bi-directional communication is three.

  1. Transmit (TX)
  2. Receiver (RX)
  3. Ground (GND)

MQTT-
MQTT is one of the most commonly used protocols in IOT projects. It is designed as a lightweight messaging protocol that uses publish/subscrib options to exchange data between clients and the server.

Actually, there are two types of protocol in all

  1. IoT network protocol
  2. IoT data protocols
    Here network protocol has all protocol like BLE, Zigbee, wifi for all wireless communication and this protocol are mostly used on things side between a thing(sensors and other devices) and a gateway.
    Now you would have a question that what is the gateway. A gateway has the responsibility to establish communications between things and cloud services and also orchestrate the actions between the things
    On the other side, we have a data protocol they are closer to cloud service the data protocol help to establish communication between gateway and cloud and data protocol includes MQTT, CoAp and etc, and MQTT is used for message service. And UART is a protocol but it is used for serial communication only between any two devices and needs wiring, so has short-range other serial communication protocols are SPI, I2C.

Hope this helps!!
Thank you