Embedded and IoT

How can an ESP32 send data to a phone without Wi-Fi?

The usual way is Bluetooth Low Energy. The ESP32 runs a GATT server, and the phone app connects to it as a central and reads, writes or subscribes to its characteristics. The alternatives are a USB or serial cable, or the ESP32 running its own Wi-Fi access point for the phone to join, which still uses the Wi-Fi radio but needs no router or internet. Espressif's ESP-NOW protocol is best kept for links between boards, since its documentation does not describe a way for a phone app to take part.

Learning objectives

After reading this article you will be able to:

  • Identify which radios each ESP32 variant has before choosing a link
  • Explain how a phone reads ESP32 data from a Bluetooth LE GATT server
  • Describe when to use a cable or the board's own access point, and why not ESP-NOW

Check which radio your chip has

“ESP32” covers a family of chips with different radios, so start with the datasheet. Espressif’s own datasheets describe them like this:

ChipRadios, per Espressif’s datasheet
ESP322.4 GHz Wi-Fi, Bluetooth v4.2 BR/EDR (Classic) and Bluetooth LE
ESP32-S22.4 GHz Wi-Fi only
ESP32-S32.4 GHz Wi-Fi and Bluetooth 5 (LE)
ESP32-C32.4 GHz Wi-Fi and Bluetooth 5 (LE)
ESP32-C6Wi-Fi 6 in 2.4 GHz, Bluetooth 5 (LE), and 802.15.4 for Zigbee and Thread
ESP32-H2Bluetooth LE and 802.15.4, with no Wi-Fi

An ESP32-S2 has no Bluetooth radio of its own, and an ESP32-H2 has no Wi-Fi, so it cannot run an access point. On the software side, ESP-IDF offers two Bluetooth host stacks: Bluedroid, which supports Classic and LE, and NimBLE, which is LE only and smaller.

Bluetooth LE: the ESP32 as a GATT server

This is the path that works for phone apps on both major platforms. Espressif’s getting-started guide describes the roles: the ESP32 advertises, the phone scans and connects, and after connecting the advertiser becomes the peripheral and the phone becomes the central.

The ESP32 then acts as a GATT server. It exposes services, each made of characteristics, which are small values the phone can read or write. For data the ESP32 produces, such as sensor readings, the phone subscribes to a characteristic by writing to its Client Characteristic Configuration Descriptor, and the ESP32 pushes updates as notifications or indications. ESP-IDF’s tutorial builds exactly this with its NimBLE_GATT_Server example and tests it with a phone app.

On the phone side, Android provides built-in support for BLE in the central role. Its documentation describes GATT as a specification for sending and receiving short pieces of data, so larger transfers are split into many writes or notifications. On iPhone, Apple’s Core Bluetooth framework is an abstraction of the Bluetooth Low Energy stack, with the same central and peripheral roles.

ESP-IDF also includes ESP-BLE-MESH, its implementation of Bluetooth LE Mesh, for networks of boards.

A cable: USB or serial

A wire avoids radio questions entirely. Some ESP32 development boards carry a USB-to-UART bridge: the host sees a USB device, and the bridge talks to the ESP32 over UART. Some chips, such as the ESP32-S3, also have a built-in USB Serial/JTAG controller that works as a serial port.

On Android, an app can use USB host mode, where the phone powers the bus and enumerates connected devices, then talk to the board through the android.hardware.usb APIs. Check the rules for USB accessories on any other phone platform before choosing this path.

The ESP32’s own access point

If “without Wi-Fi” means without a router or internet, the ESP32 can be the network. In AP mode, the ESP-IDF Wi-Fi driver starts broadcasting beacons and accepts connections from stations, so a phone can join it and exchange data with a local web server, WebSocket or UDP socket on the board.

Be clear about what this is: Wi-Fi without the internet, not an alternative to Wi-Fi. It uses the Wi-Fi radio on both sides. On Android 10 and higher, an app can ask to join such a network with WifiNetworkSpecifier, which prompts the user, and Android’s documentation states that a connection made this way does not provide an internet connection to the app or the device.

Why not ESP-NOW

ESP-NOW is attractive between boards. Espressif describes it as a connectionless Wi-Fi communication protocol that it defined, which carries application data in vendor-specific action frames from one Wi-Fi device to another without a connection. Espressif’s documentation describes it between devices running ESP-NOW and does not describe a way for a phone app to send or receive it. A practical design uses ESP-NOW between boards and has one board pass data to the phone over Bluetooth LE, a cable or its access point.

Whatever the link, its own security covers only that one hop. If readings travel on through other devices or to a backend, encrypt them end to end, which running encrypted messaging on a microcontroller covers.

Frequently asked questions

Which kind of Bluetooth should an iPhone app use to reach an ESP32?

Bluetooth Low Energy. Apple's Core Bluetooth programming guide describes the framework as an abstraction of the Bluetooth Low Energy protocol stack, so pick an ESP32 variant that has Bluetooth LE.

Build it with Offline Protocol

Offline Protocol's constrained-device integration is `offline-protocol-leaf`, a Rust no_std component that joins encrypted sessions set up by a full peer such as a phone, over a radio path the firmware provides. The embedded docs list what the firmware must supply and how to qualify a target part.

Read the Rust and constrained devices docs