Back to Explorer

wemos-sh1106-example

Project Information

Author

Mikrobot.pl

Board

LOLIN(WEMOS) D1 R2 & mini

SDK Version

3.1.2

Platform

ESP8266

Created

Updated

Description

SH1106 OLED Text Portal with captive portal on LOLIN(WEMOS) D1 R2 & mini

Flash to Device

Login required: You need to login or create an account to flash this project.

Sorry, your browser doesn't support Web Serial.Web Serial requires HTTPS.

README

Wemos D1 SH1106 OLED Text Portal Wemos D1 SH1106 OLED Text Portal

Wemos D1 SH1106 OLED Text Portal

Wireless text sender with captive portal on Wemos D1 mini / D1 R2 (ESP8266)

This project turns a Wemos D1 mini or Wemos D1 R2 (ESP8266) plus a 128×64 SH1106 I2C OLED display into a small wireless text terminal.

After power-up, the Wemos:

  • creates an open WiFi Access Point,
  • runs a captive portal (browser login page),
  • shows a web form where you can enter any text,ą
  • displays that text on the SH1106 OLED.

Default text on boot: mikrobot.pl
On boot, the display also shows the network name and IP address at the bottom.


⭐ Features

  • Open WiFi Access Point (no password)
    • SSID: WEMOS-OLED
    • IP address: 192.168.4.1
  • Captive portal
    • Any domain (e.g. google.com) is redirected to the Wemos
    • Common OS captive checks handled:
      • Android /generate_204
      • iOS/macOS /hotspot-detect.html
      • Windows /ncsi.txt
  • Web interface
    • Shows current text on the display
    • Simple form to send new text to the OLED (up to 128 characters)
  • OLED rendering
    • Automatic word-wrap
    • Clear 128×64 monochrome display

📦 Hardware requirements

  • Wemos D1 mini or Wemos D1 R2 (ESP8266, CH340 USB chip)
  • 128×64 SH1106 I2C OLED display module (typically the 1.3" version)

This project uses the SH1106 driver. Modules with the SSD1306 controller (usually the 0.96" version) need a different driver.

🔌 SH1106 → Wemos wiring

On your SH1106 I2C module the clock pin is labeled SCK instead of SCL.
That is normal – it is still the I²C clock line.

Typical pins on the SH1106 module:

  • VCC
  • GND
  • SCK (I²C clock, sometimes labeled SCL or CLK)
  • SDA (I²C data)

Connect them to the Wemos as follows:

SH1106 Pin Wemos D1 mini Wemos D1 R2 Description
VCC 3V3 3V3 3.3 V Power
GND G GND Ground
SCK D1 (GPIO5) SCL I²C Clock (SCK on your module)
SDA D2 (GPIO4) SDA I²C Data (SDA)

On the D1 R2, use the header pins labeled SCL and SDA. Some D1 R2 clones also print other numbers next to them (e.g. D15/D14) – the SCL/SDA label is what matters.

In the code, I²C is initialized as:

#define OLED_SDA D2   // GPIO4
#define OLED_SCL D1   // GPIO5

Wire.begin(OLED_SDA, OLED_SCL); // SDA, SCK (clock)

🧩 Board selection

Select the board LOLIN(WEMOS) D1 R2 & mini – the same setting works for both the D1 mini and the D1 R2.

The Wemos boards use the CH340 USB-to-serial chip. If the board does not show up when connecting, install the CH340 driver and make sure you are using a USB data cable (some cables are charge-only).


🚀 How to use

  1. Flash the project and power the Wemos via USB.
  2. On your phone or laptop, connect to the WiFi network WEMOS-OLED.
  3. The captive portal page should open automatically.
    If it does not, open http://192.168.4.1 in your browser.
  4. Enter your text and press Send to OLED.
  5. The text appears on the display. After a reboot, the display returns to mikrobot.pl.

🛠 Troubleshooting

  • Display stays black – check the wiring (SCK → D1, SDA → D2), power from 3V3, and the I²C address. Most modules use 0x3C, some use 0x3D.
  • Portal does not open automatically – open http://192.168.4.1 manually. Your phone may warn that the network has no internet access; choose to stay connected.
  • Redirect does not work for some websites – only plain http:// addresses are redirected. Sites opened via https:// will show an error; use http://192.168.4.1 instead.
  • Letters with diacritics (e.g. ą, ę, ł, ö) look wrong – the built-in display font supports basic characters only.
  • Serial monitor – at 9600 baud it prints the network name and IP address after boot.

The WiFi network is open, so anyone nearby can connect and change the text on the display.