The ESP32 supports several different wireless communication protocols. Each protocol has its advantages and disadvantages and one can be more suitable than the other depending on the application. This guide is a compilation of all our articles about wireless communication protocols with the ESP32.
Communication Protocols
In this article, we’ll cover the following communication protocols:
We’ll keep this article updated as new tutorials are posted.
Bluetooth Low Energy (BLE)
Bluetooth Low Energy, BLE for short, is a power-conserving variant of Bluetooth. BLE’s primary application is short-distance transmission of small amounts of data (low bandwidth).
Unlike Bluetooth which is always on, BLE remains in sleep mode constantly except for when a connection is initiated. This makes it consume very low power. BLE consumes approximately 100x less power than Bluetooth (depending on the use case).
Additionally, BLE supports not only point-to-point communication, but also broadcast mode, and mesh network. Due to its properties, BLE is suitable for applications that need to exchange small amounts of data periodically running on a coin cell. For example, BLE is of great use in healthcare, fitness, tracking, beacons, security, and home automation industries.
- Low power consumption
- Short distance transmission
- Low bandwidth (small amounts of data)
- Ideal for exchanging small amounts of data periodically
- Supports point-to-point, broadcast, and mesh network
Learn how to get started with BLE on the ESP32 with our guides:
- Getting Started with ESP32 Bluetooth Low Energy (BLE) on Arduino IDE
- ESP32 BLE Server and Client (Bluetooth Low Energy)
Bluetooth Classic
Bluetooth is a wireless technology standard used for exchanging data between fixed and mobile devices over short distances. It is optimized for continuous data streaming, while BLE is optimized for short burst data transmission. It consumes approximately x100 more power than BLE.
- Short distance transmission
- Optimized for continuous data streaming
Learn how to use Bluetooth Classic with the ESP32:
ESP-NOW
ESP-NOW is a connectionless communication protocol developed by Espressif that features short packet transmission. This protocol enables multiple devices to talk to each other in an easy way.
Stating the Espressif website, ESP-NOW is a “protocol developed by Espressif, which enables multiple devices to communicate with one another without using Wi-Fi. The protocol is similar to the low-power 2.4GHz wireless connectivity (…). The pairing between devices is needed prior to their communication. After the pairing is done, the connection is safe and peer-to-peer, with no handshake being required.”
- Fast communication protocol
- Up to 250-byte payload can be carried
- Encrypted and unencrypted communication
- Range communication (220 meters in opan en field accordingly to our experiments)
Read our articles about ESP-NOW:
- Getting Started with ESP-NOW (ESP32 with Arduino IDE)
- ESP-NOW Two-Way Communication Between ESP32 Boards
- More ESP-NOW tutorials…
Wi-Fi (client-server communication protocols)
HTTP Requests
You can exchange data between ESP32 boards using HTTP requests. One board acts as a server (Wi-Fi access point) and the other board acts as a client (Wi-Fi station).
Learn how to send data from one ESP32 board to the other using HTTP requests:
The ESP32 can also make HTTP requests to third-party services on the internet to send or receive data. For that, the ESP32 needs to be connected to a Wi-Fi network with internet access.
Server-Sent Events
Server-Sent Events (SSE) allow the client to receive automatic updates from a server via HTTP connection.
The client initiates the SSE connection and the server uses the event source protocol to send updates to the client. The client will receive updates from the server, but it can’t send any data to the server after the initial handshake.
Server-sent events are useful when you need to send new data to the server without the need for a request by the server, for example send sensor readings periodically or notifications.
Learn how to use server-sent events on an ESP32 web server:
WebSocket
A WebSocket is a persistent connection between a client and server that allows bidirectional communication between both parties using a TCP connection. This means you can send data from the client to the server and from the server to the client at any given time.
Get started with WebSocket protocol on the ESP32 by following the next tutorial:
MQTT
MQTT stands for Message Queuing Telemetry Transport. It is a lightweight publish and subscribe system where you can publish and receive messages as a client. MQTT is a simple messaging protocol, designed for constrained devices with low-bandwidth.
To use MQTT to exchange data, you need an MQTT broker that is responsible for receiving all messages, filtering the messages, and publishing the message to all subscribed clients. MQTT is perfect for IoT projects with multiple devices.
Read our articles about the MQTT communication protocol with the ESP32.
- What is MQTT and How It Works
- ESP32 MQTT – Publish and Subscribe with Arduino IDE
- MicroPython – Getting Started with MQTT on ESP32/ESP8266
LoRa
LoRa is a wireless data communication technology that uses a radio modulation technique that can be generated by Semtech LoRa transceiver chips.
LoRa allows long range communication of small amounts of data (which means a low bandwidth), and high immunity to interference while minimizing power consumption. So, it allows long distance communication with low power requirements.
- Long range communication
- Low bandwidth (small amounts of data)
- High immunity to interference
- Low power consumption
To use LoRa with the ESP32 boards, you need a LoRa transceiver chip. The word “transceiver” means that the chip can send and receive LoRa messages. There are ESP32 boards that already come with an on-board LoRa transceiver chip, which makes wiring much simpler.
Read our articles about LoRa communication:
- ESP32 with LoRa using Arduino IDE – Getting Started – learn what is LoRa, how to connect a LoRa chip to the ESP32, and exchange data between boards.
- TTGO LoRa32 SX1276 OLED Board: Getting Started with Arduino IDE – learn how to get started with LoRa with a board with a built-in LoRa chip and OLED display.
- ESP32 LoRa Sensor Monitoring with Web Server (Long Range Communication) – set up an ESP32 as a LoRa receiver and as a web server to display received readings.
GSM/GPRS/LTE
You can connect your ESP32 board to a modem to be able to send and receive SMS and phone calls and connect to the internet using a SIM card as you would do with your smartphone. Some of those modems can also get GPS data like latitude, longitude, altitude, and date and time.
There are different modules available that are compatible with the ESP32 and there are also ESP32 boards that already come with a built-in modem and all the necessary circuitry.
We’ve experimented with the ESP32 SIM8000L (2G), and the ESP32 SIM7000G (3G and 4G), and we had pretty good results.
To get started with those boards, you can take a look at the following tutorials:
- Getting Started with LILYGO T-SIM7000G ESP32 (LTE, GPRS, and GPS)
- ESP32 Publish Data to Cloud without Wi-Fi (TTGO T-Call ESP32 SIM800L)
- ESP32 SIM800L: Send Text Messages (SMS Alert) with Sensor Readings
- Connect ESP32 to Cloud MQTT Broker (TTGO T-Call ESP32 SIM800L)
Wrapping Up
There are many different wireless communication protocols compatible with the ESP32 boards. This makes it one of the most versatile boards for IoT and Home Automation projects. In this article, we’ve covered LoRa, Bluetooth, Bluetooth Low Energy, ESP-NOW, Wi-Fi, MQTT, and GSM/GPRS/LTE.
If you want to learn more about those protocols with the EPS32, check out the corresponding links throughout the article.
We hope you found this useful.
Learn more about the ESP32 with our resources:
- Learn ESP32 with Arduino IDE
- Build Web Servers with ESP32 and ESP8266
- Firebase Web App with ESP32 and ESP826
- SMART HOME with Raspberry Pi, ESP32, and ESP8266
Thanks for reading.
WWOWOWOWOWOWOW! Great article. Its wonderful to see a complete and comprehensive post about the communication capabilities of the ESP32!
Thanks 😀
Thank you for this nice article, again 😉
I was wondering about how you can have secure/encrypted communication over these protocols? Do you have links/insights on this topic related to ESP32?
Are you considering an article about such topic?
Would be much appriciated!
Hi.
About ESP-NOW encrypted messages: https://randomnerdtutorials.com/esp32-esp-now-encrypted-messages/
For WiFi, you can use WiFiClient secure: https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino
At the moment, we don’t have any in-depth tutorials about these subjects.
I’ll write something about it in the future.
Regards,
Sara
Hi. This is very useful, as most of the stuff you publish is.
Thank you very much for your constant research and support.
Thanks 🙂
A great and useful overview. Thank you!
Thank you!
Excellent article. Really one of the first decisions you need to make with any ESP32 is what protocol to use. Keep up the good work.
Thanks 😀
No mention of the NRF24, good range, up to 2mb speed and reasonable packet size?
Rui, Sara, You are THE BEST!
Very much appreciate your tutorials and articles, and your response to emails!!
And love your eBooks!
Have greatly benefitted from your contributions in this space!
Thank you!
Thank you so much for your nice words!
Regards,
Sara
I’m questioning the ESPNow portion of this article. In my experience, pairing is not required, only address. Additionally by default it is not secure or encrypted.
One thing I’m very curious about is Long Range mode for ESP32. There is not much documentation or examples utilizing it. I’m curious if it’s just using the antenna at a higher DBI.
Hello.
Sarah and Rui = one-click help:)
If you read carefully what they write and then work consistently, 99.9% of the time everything works – one-tenth is because no person is infallible – my experience so far. And a lot of their work is just for thanking you here, so warm thanks.
On the topic: my esp 8266 is updated via wifi and OTA, esp32 should also be done.
Hi, thanks for the great job.
I have a question about ESM32CAM client stream on TTGO server, that is must power on server first, and power on client next, any way to improve this please?
Thanks
Summer
Thanks for the article. Unfortunately, most of the Maker Advisor links for LoRa boards are expired. You may not be benefitting from any referrals there also. I am a little cautious in searching for my own items, as there are so many variations and not all of them might work. Perhaps you could have a look into this ?
Best regards – Noel
Hi.
Thanks for the warning. I’ll try to update the page today.
Regards,
Sara
Hi.
I updated the Maker Advisor page.
Basically, these boards are deprecated. You can only find them on Banggood, Aliexpress or eBay.
On Amazon, you can find the most recent and improved version 2.1. I haven’t tried the 2.1 version, but it should work similarly, with enhanced features and better range.
Regards,
Sara