Skip to main content

TLS energy consumption on the ESP32-S31, measured with Otii

TLS energy consumption on the ESP32-S31, measured with Otii

Created: November 25, 2026
Updated: November 25, 2026

Each time the ESP32-S31 sent a report, a full TLS handshake used about 40 µWh. Switching to TLS session resumption cut that energy by roughly two-thirds. This article shows how we measured TLS energy consumption with Otii and how you can explore the recordings yourself.

From the workshop: Introduction to the ESP32-S31: Security

This article is an excerpt from Introduction to the ESP32-S31: Security, a hands-on workshop that covers the ESP32-S31 security features and how they map to the technical requirements of the EU Cyber Resilience Act (CRA). The measurements were made on the ESP32-S31-Function-CoreBoard-1 running ESP-IDF v6.1. The complete workshop, with the full agenda and the hardware and software requirements, is available on the Espressif Developer Portal.

You don’t need an Otii instrument to follow along. The recordings are shared as an Otii project that you can open in the free Otii desktop software, as described below. Better yet, if you have your own Otii instrument, you can take this a step further and repeat the measurement on your own board, firmware, and network. That way, you’ll see exactly how TLS energy consumption behaves in the environment you’re actually validating.

Measurement setup

The measurement uses the Otii Ace Pro, which powers and measures the board, and the Otii desktop software sets up the instrument, records the data, and analyzes it.

We powered the ESP32-S31 directly from the Otii Ace Pro through the board’s 3V3 rail, bypassing the USB power path and the regulator. This way, the trace only shows the chip’s usage. A second wire connects the Ace Pro’s UART input to the debug pins on the header. In the Otii desktop software, we set 3.3 V, selected the channels (current, voltage, UART), and started recording.

The firmware prints  STAGE= messages at each phase, such as Wi-Fi connected, report connecting, report done, and deep sleep. This lets you tie every change in current to a firmware event. In the desktop software, named selections (First and Second) mark the cycles being compared across all recordings.

The Otii Ace Pro power supplies the ESP32-S31 directly, measures the energy and records its debug UART

Three ways to send the same report

All three variants use the same firmware and send the same small report to the same server. The only difference is the transport method. In each cycle, the board connects to Wi-Fi, sends the report, and then returns to deep sleep. If the session ticket has expired or the server rejects it, the board falls back to a full handshake.

VariantWhat happens before the data is sent
HTTP (baseline)Wi-Fi connection, DHCP and TCP connection
HTTPS, full handshakeEverything in HTTP, plus certificate verification and an ECDHE key exchange, with one extra round trip
HTTPS, resumed sessionEverything in HTTP, plus a short handshake using a session ticket from the previous connection, kept in LP memory during deep sleep. Certificate verification and key exchange are skipped.

Each recording holds four reporting cycles. We analyze the first two:

  • First: a cold boot after power-on. No session ticket exists yet, so both HTTPS variants run a full handshake.
  • Second: a wake-up from deep sleep about 10 seconds later, the normal operating case. Wi-Fi reconnects faster, and the resumed-session variant uses its stored ticket.

The third and fourth cycles are further wake-ups you can use to check how consistent the results are.

Results

Energy and average current are measured over the same selection for all three recordings. Each value includes boot, Wi-Fi connection, the report, and entry into deep sleep. Active time is measured from boot to deep sleep in the UART log.

First cycle: cold boot

VariantActive time per reportEnergy per reportAverage currentCompared to HTTP
HTTP4.43 s383.0 µWh85.77 mABaseline
HTTPS, full handshake4.75 s422.5 µWh94.61 mA+10.3%
HTTPS, resumed session (no ticket yet)4.84 s427.2 µWh95.67 mA+11.5
First selection in the recording (blue): Cold-boot energy measurements

Second cycle: wake-up from deep sleep

VariantActive time per reportEnergy per reportAverage currentCompared to HTTP
HTTP3.24 s265.6 µWh79.23 mABaseline
HTTPS, full handshake3.59 s307.5 µWh91.73 mA+15.8%
HTTPS, resumed session3.32 s278.8 µWh83.17 mA+5.0%
Second selection in the recording (red): Deep-sleep wake-up energy measurements

What the measurements show:

  • The handshake is the most energy-draining part. A full handshake added about 40 µWh per report in both cycles, and stretched the server connection from about 17 ms to about 332 ms. Encrypting and sending the report itself took only a few milliseconds more than plain HTTP.
  • Session resumption recovers most of the cost. With a stored ticket, the server connection took about 29 ms. On wake-up, this reduced the TLS overhead from 41.9 µWh to 13.2 µWh, which is about two-thirds less.
  • Resumption does not help the first connection. After a cold boot, there is no ticket yet, so the resumed-session variant runs a full handshake and stores a ticket for the next wake-up.
  • The same cost has a different impact. The full handshake costs about the same in both cycles, but it is 10% of the total on a cold boot and 16% on a wake-up, since the wake-up cycle is shorter.

Why debug energy, not just measure it

Nobody should drop TLS to save energy. But you should know what it costs, because that cost follows the product for as long as it’s in the field. It matters when you pick a reporting interval. It matters even more after a firmware update, when nobody re-checks whether session resumption still works. A product receives security updates throughout its support period, so the firmware you measure today is not the firmware it will run in five years.

Average current alone does not show where the energy cost comes from. By combining the current trace and the firmware log on one timeline, you can trace each phase back to the code behind it. This also reveals costs you might not have planned to measure:

  • About 2.5 seconds of each wake-up cycle are spent connecting to Wi-Fi and getting an IP address, compared to 21 to 339 ms for the report itself. In every cycle, the WPA2 handshake took about 1.3 seconds and DHCP about 1.1 seconds.
  • The server in this test was on the local network. With a remote server, each round trip takes longer, which increases the cost of a full handshake more than a resumed session.

It’s better to find these issues during development than after the product is deployed in the field.

Imagine a fleet of 10,000 devices built on this design, each waking every 5 minutes to send a report, with a 10-year support period. If a server or firmware update silently disables session resumption, every wake-up falls back to a full handshake. The devices keep working. Every report arrives. Nothing looks wrong. But each report now costs 307.5 µWh instead of 278.8 µWh, and keeps the radio on for an extra quarter of a second.

Example: Impact on 10,000 device fleetPer device, per yearFleet, over 10 years
Reports105,12010.5 billion
Extra energy3.0 Wh302 kWh
Extra active time (CPU and radio on)7.9 h788,000 device-hours

No functional test catches this regression, but measuring energy per report does, in minutes, before the update ships.

Check the TLS energy consumption numbers yourself

The recordings are available as an Otii project, and you can open them without any measurement instrument.

  1. Download and install the free Otii desktop software, available for Windows, macOS, and Ubuntu: home.qoitech.com/download
  2. Download the demo project: ESP32-S31_TLS_measurement.otii3.zip
  3. Open the Otii project. It contains one recording per variant (HTTP, HTTPS_FULL, HTTPS_RESUME), each with the current trace and UART log of four reporting cycles.
  4. Open the First and Second selections to see minimum, average, and maximum current and energy for all three recordings.
  5. Select a recording in the Recordings list to view its UART log.
  6. Use the selection tool to analyze the third and fourth cycles, or a single phase like the TLS handshake.

When you compare selections of different lengths, compare energy instead of average current.

Resources

Sign up for more technical articles

A monthly dose of articles, tips & tricks, and know-how – everything you need to extend battery life in embedded electronics and IoT.