ESP32 Wireless Communication Protocols
Communication protocols is a set of different rules that allows two or more entities to exchange data between them via any kind of external variations due to physical activity. These protocols define the synchronization, syntax and rules of communication and possible method for error recovery.
Similarly Wireless communication protocols is a set of rules used by IoT devices to exchange data wirelessly. Following is the list of wireless communication protocols used by ESP32.
- Bluetooth Low Energy (BLE)
- Bluetooth Classic
- ESP-NOW
- Wi-Fi (client-server communication protocols)
- MQTT
- LoRa
- GSM/GPRS/LTE
1: Bluetooth Low Energy (BLE)
Bluetooth Low Energy (BLE) is a power conserving Bluetooth technology. Its prime usage is for short distances and low data transfer using a minimum power that makes it a good choice for wearables and home automation devices.
Unlike Bluetooth classic which always remains on, BLE goes into deep sleep mode until a connection is initiated which makes it consumes relatively less power than classic Bluetooth. BLE supports point to point communication, broadcast mode and mesh network. Following are some main highlights of BLE:
- Low power consumption
- Transfer small amount of data
- Low bandwidth
- Short distance communication
2: Bluetooth Classic
Bluetooth classic is a wireless communication protocol that allows two devices to communicate without any need of wire support. Bluetooth Classic working depend upon the short-range frequency and devices that supports that frequency in a specific range can communicate easily.
Bluetooth classic is optimized for continuous data transfer, and it consumes much more power than BLE. Following are some main highlights of Bluetooth classic:
- Short distance transmission
- Large data transfer
- Continuous data stream transfer
3: ESP-NOW
ESP-NOW is a wireless communication protocol designed by Espressif Systems that can do short packet data transfer. Using ESP-NOW multiple devices can communicate together without any Wi-Fi.
The protocol is similar to low power 2.4GHz wireless connectivity and once the two devices are paired the peer-to-peer connection is established between them and no handshake is required. Following are some amazing ESP-NOW features:
- Fast communication
- Both encrypted and unencrypted communication
- Up to 250-byte of payload
- Range can go up to 250 meters in clear and open line of sight
4: Wi-Fi (client-server communication protocols)
Wi-Fi (Wireless Fidelity) is a wireless communication protocol that is commonly used for local area devices and for providing internet services inside a network. It allows nearby devices to exchange data using radio waves. Following are some main modes for Wi-Fi working:
- HTTP Requests
- Server-Sent Events
- WebSocket
HTTP Requests
HTTP (Hypertext Transfer Protocol) is used by clients for structuring requests and responses over the internet. The main aim of the request generated is to access the data on the server. To generate this request client uses a URL (Uniform Resource Locator) which is the address for the information source.
HTTP requests allow the exchange of data among ESP32 boards. Where one board can act as servers and other as clients. ESP32 can also make requests to third party servers over the internet for that ESP32 needs an internet connection.
Server-Sent Events
SSE or Server-Sent events allows the client to receive an automatic data stream from the server using the HTTP channel. The client generates the SSE connection request and the server sends data to the client. Clients can receive updates from the server, but after the initial handshake it cannot send any type of data.
Server sent events are useful when we need to send some sensor readings without any need to request by server. For example, sending a sensor data periodically or in notification form.
WebSocket
A WebSocket is a dual and bidirectional communication between client and server that uses TCP connection. This means data from client to server and vice versa can be easily sent at any given time. It is a full duplex communication protocol over a single TCP channel.
5: MQTT
MQTT (Message Queuing Telemetry Transport) is designed for remote devices having limited network support and bandwidth.
MQTT is a perfect choice for Iot devices. To use MQTT service a MQTT broker is needed that receives all the messages and filters the message and publishes it to subscribed clients.
6: LoRa
LoRa stands for Long Range Radio which usually targets IoT networks. This technology enables public networks to connect to several applications running over the same network. LoRa is a hardware-based technology that uses modulation techniques generated by Semtech LoRa transceiver chip.
LoRa has low bandwidth which means a small amount of data can be transferred for long range communication. Also, it allows long range communication with less power consumption. Following points highlights main working of LoRa:
- Long range communication
- High immunity to interference
- Less power consumption
- Low bandwidth less amount of data transfer
7: GSM/GPRS/LTE
ESP32 also supports modems that can send and receive data such as SMS, phone calls and can connect to the internet using a sim card just like we do in smartphones. Some of the modems can also give us data like altitude, location data and time.
Multiple modules are available for interfacing GSM with ESP32 however there are different boards available that come by default with these features.
Conclusion
Communication protocols are necessary for every microcontroller to communicate. Wireless communication protocol inside ESP32 highly depends upon the Wi-Fi and dual Bluetooth technology. Having a wireless communication set of protocols makes ESP32 an ideal choice for an IoT base project. To read more about communication protocol read the article in detail.