ESP-NOW with OLED Display: Wireless Communication and Real-Time Data Monitoring
ESPHow ToIoT HardwaresIoT ProtocolsProgrammingTutorials/DIY

ESP-NOW with OLED Display: Wireless Communication and Real-Time Data Monitoring

ESP-NOW is a powerful wireless communication protocol developed by Espressif that enables fast, low-power, connectionless data exchange between ESP32 and ESP8266 devices. When combined with an OLED display, ESP-NOW becomes even more useful for real-time monitoring of sensor data, device status, and control signals.

In this article, we will explore how to use ESP-NOW with OLED Display, its working principle, practical implementation, example projects, and step-by-step coding approach.


What is ESP-NOW?

ESP-NOW is a proprietary protocol created by Espressif that allows multiple ESP devices to communicate directly without the need for Wi-Fi infrastructure such as routers or internet connectivity.

Key Features of ESP-NOW

  • Peer-to-peer wireless communication
  • Works without Wi-Fi network
  • Very low latency
  • Low power consumption
  • Supports encrypted communication
  • Ideal for IoT and Wireless Sensor Networks (WSN)

Read This: ESP-NOW Protocol: A Complete Guide for ESP32 and ESP8266


Why Use OLED Display with ESP-NOW?

An OLED display provides a visual interface to show the received data wirelessly via ESP-NOW. Instead of sending data to cloud dashboards, you can instantly display:

  • Temperature and humidity
  • Button press status
  • ADC readings
  • Battery voltage
  • Debug messages

This is extremely helpful in offline environments like factories, farms, or home automation systems.


How ESP-NOW Works

ESP-NOW communication works using MAC addresses. Devices are paired as:

  • Sender (Transmitter)
  • Receiver

The sender broadcasts structured data packets, and the receiver processes them and performs actions such as displaying information on OLED.


Hardware Components Required

For Sender Node

  • ESP32 / ESP8266 board
  • Sensor (DHT11, BMP280, etc.)
  • Power supply

For Receiver with OLED

  • ESP32 (recommended)
  • 0.96 inch I2C OLED Display (SSD1306)
  • Connecting wires

OLED Display Basics

Most IoT OLED displays use:

  • I2C Interface
  • SSD1306 Driver
  • 128×64 resolution

I2C Pins

OLED PinESP32 Pin
SDAGPIO21
SCLGPIO22
VCC3.3V
GNDGND

ESP-NOW with OLED Display Architecture

The complete system workflow looks like this:

  1. Sensor data collected by Sender ESP
  2. Data transmitted via ESP-NOW
  3. Receiver ESP gets packet
  4. OLED display updates in real time

Programming Environment

You can program using:

  • Arduino IDE
  • Thonny MicroPython IDE
  • PlatformIO

But here we will focus on Arduino-based implementation as it is more common for ESP-NOW.


Required Arduino Libraries

Install the following libraries:

  • Adafruit SSD1306
  • Adafruit GFX
  • espnow (built-in for ESP32 core)

Make sure you have the latest ESP32 board package installed.


Implementation Example

Now let us implement a simple project where an ESP32 sends temperature data and another ESP32 displays it on OLED.


Step 1: Get MAC Address of Receiver

Upload this sketch to OLED receiver ESP32:

#include "WiFi.h"

void setup(){
  Serial.begin(115200);
  WiFi.mode(WIFI_MODE_STA);
  Serial.println(WiFi.macAddress());
}

void loop(){}

Note down the printed MAC address.


Step 2: Sender Code

Data Structure

We create a structure to send data:

typedef struct struct_message {
  float temperature;
  float humidity;
} struct_message;

Complete Sender Sketch

#include <esp_now.h>
#include <WiFi.h>

struct_message myData;

uint8_t receiverAddress[] = {0x24,0x6F,0x28,0xAA,0xBB,0xCC};

void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
  Serial.print("Send Status: ");
  Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Success" : "Fail");
}

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);

  esp_now_init();

  esp_now_register_send_cb(OnDataSent);

  esp_now_peer_info_t peerInfo;
  memcpy(peerInfo.peer_addr, receiverAddress, 6);
  peerInfo.channel = 0;
  peerInfo.encrypt = false;

  esp_now_add_peer(&peerInfo);

  myData.temperature = 25.6;
  myData.humidity = 60.3;

  esp_now_send(receiverAddress, (uint8_t *) &myData, sizeof(myData));
}

void loop() {}

Step 3: OLED Receiver Code

Complete Sketch

#include <esp_now.h>
#include <WiFi.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

struct_message incomingData;

void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
  memcpy(&incomingData, incomingData, sizeof(incomingData));
  updateOLED();
}

void updateOLED(){
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);

  display.setCursor(0,10);
  display.print("Temp: ");
  display.print(incomingData.temperature);
  display.println(" C");

  display.setCursor(0,30);
  display.print("Humidity: ");
  display.print(incomingData.humidity);
  display.println(" %");

  display.display();
}

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);

  esp_now_init();

  esp_now_register_recv_cb(OnDataRecv);

  Wire.begin();
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}

void loop() {}

Practical Applications

Using ESP-NOW with OLED display opens many possibilities:


1. Wireless Weather Station

  • ESP32 with BME280 sends climate data
  • OLED receiver shows values

2. Wireless Button Control

You have already built an article on:

Wireless Button Control Using ESP-NOW

Similarly, OLED can show:

  • Button ON/OFF
  • Device triggered

3. Industrial Monitoring Panel

  • ADC voltage readings
  • Motor status
  • Alert messages

4. Home Automation Dashboard

  • Smart switch feedback
  • Door sensor status
  • Light intensity

Advantages Over Cloud-Based Display

  • No internet required
  • More privacy
  • Faster response
  • Lower cost
  • Works during Wi-Fi outage

Limitations

  • Range limited to ~100m
  • Requires MAC pairing
  • Small packet size (250 bytes)

Tips for Better OLED Interface

  • Use larger fonts for critical data
  • Add icons
  • Implement scrolling text
  • Show RSSI signal strength
  • Display last update time

Troubleshooting Guide

OLED Not Displaying Data

  • Check I2C address (0x3C or 0x3D)
  • Verify wiring
  • Ensure receiver in STA mode

ESP-NOW Communication Fail

  • Correct MAC address
  • Use same channel
  • Reduce structure size

Best Practices

  • Always use structured packets
  • Add checksum if needed
  • Use encryption for sensitive data
  • Implement watchdog timers
  • Refresh OLED efficiently

Conclusion

ESP-NOW with OLED Display is an excellent solution for offline IoT projects requiring wireless data visualization. It simplifies real-time monitoring without complex networking or cloud dependencies.

For your multi-device experiments and WSN setups, an OLED-based ESP-NOW receiver can act as a portable debug terminal and monitoring screen.

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *