I2C Port Scanner Sketch For ESP8266-Node MCU 1.0 (ESP-12E) built-in OLED display module

For the HW-364A, which is an ESP8266 development board with an integrated 0.96" OLED display, the internal connections between the ESP8266 chip and the display are pre-wired. Unlike a standalone OLED module that typically uses default pins (D1/D2), this board uses a specific pinout that must be declared in your code. The Attached I2C Port Scanner Sketch will test and check for the correct SDA , SCL common pairs like GPIO 4/5 (D2/D1) or 12/14 (swapped D5/D6). Zip File ( Port scanner & read instruction txt file ):wink:

Read First HW-364A, ESP8266 I2C Port Scanner Sketch.txt (2.6 KB)

INTERNAL PIN MAPPING
The integrated display is connected to the following GPIOs:

OLED Pin ESP8266 GPIO NodeMCU Pin Label
SDA (Data) GPIO 14 D6
SCL (Clock) GPIO 12 D5
Software Configuration
To use this display with common libraries like the Adafruit SSD1306 or the ThingPulse OLED SSD1306 driver, you must manually specify these pins in your setup() or For Arduino Wire Library:

c++
Wire.begin(14, 12); // Wire.begin(SDA, SCL)

For ThingPulse SSD1306Wire:
c++
SSD1306Wire display(0x3c, 14, 12); // (Address, SDA, SCL)

Key Technical Details
I2C Address: Typically 0x3C.
Resolution: 128x64 pixels.
Driver IC: SSD1306.
Power: The display is powered internally via the board's 3.3V rail.
Important Note: Documentation from some sellers may incorrectly claim the SDA/SCL pins are swapped (12 for SDA, 14 for SCL). If the display doesn't respond, try reversing the pins to Wire.begin(12, 14)

To verify the exact pins for your HW-364A board, you can use an I2C Port Scanner sketch. While a standard I2C scanner only checks for device addresses on the default pins, the specialized version below scans multiple GPIO combinations specifically for the ESP8266 to find exactly where the integrated OLED is mapped

I2C Port Scanner Sketch
Copy & Paste (ie) from the (First Tab) then upload this code to your board. It will cycle through the most common pin pairs used on these development boards and report which ones successfully detect the OLED

How to use this sketch:
Open Serial Monitor (Top Right Mag Glass Symbol): -> Set the baud rate to 115200.
Upload the Code: Select "Generic ESP8266 Module" as your board usually (ESP8266->NodeMCU1.0(ESP-12EModule)

Read the Output:
If it reports a device at 0x3C (the standard OLED address) when testing SDA: GPIO 14 and SCL: GPIO 12, then those are your confirmed pins.
If it finds nothing, it will test other common pairs like GPIO 4/5 (D2/D1) or 12/14 (swapped D5/D6)

Troubleshooting
No devices found: Ensure your board is getting enough power via USB; some integrated displays fail to initialize if the voltage is slightly low.
Garbage text in Serial: Ensure your Serial Monitor baud rate matches the Serial.begin(115200) in the code.
"D" Labels vs GPIO: Remember that NodeMCU labels like D5 and D6 correspond to GPIO 14 and GPIO 12 respectively.

I2C_Port_Scanner_Sketch.ino (905 Bytes)

#include <Wire.h>

// Common pin pairs for ESP8266 boards with integrated OLEDs
int sda_pins[] = {14, 12, 4, 2}, scl_pins[] = {12, 14, 5, 0};

void setup() {
  Serial.begin(115200);
  delay(2000);
  Serial.println("\n--- HW-364A Pin Discovery Scan ---");
}

void loop() {
  for (int i = 0; i < 4; i++) {
    int sda = sda_pins[i], scl = scl_pins[i];
    Serial.printf("Testing SDA: GPIO %d, SCL: GPIO %d... ", sda, scl);
    Wire.begin(sda, scl);
    byte count = 0;
    for (byte address = 1; address < 127; address++) {
      Wire.beginTransmission(address);
      if (Wire.endTransmission() == 0) {
        Serial.printf("FOUND device at 0x%02X!\n", address);
        count++;
      }
    }
    if (count == 0) Serial.println("No devices.");
    delay(500);
  }
  Serial.println("Scan complete. Restarting in 10s...\n");
  delay(10000);
}

I won't open a zip file from an unknown source.
Post the code please.

Done Code Now Posted. :wink:

Word salad, is there a question buried in there somewhere, or is this yet another I2C scanner?
BTW, use Auto Format and reduce vertical white space so we can read the code easiy.

No question, just another AI generated/augmented I2C scanner promo.

Ah yes, AI always double spaces for some stupid reason.

I have a simiar scanner, forget where I got it that does what that one does BUT prints actual device names for the well known devices. This version is inferior to that.

BTW , select the ( I2C_Port_Scanner_Sketch.ino ) link and the code can be read easily.

The pinned post re 'How to get the most from the forum' tells you to post the code in code tags, NOT as a link or zip.

Here is a simple tool that checks the I2C bus. It can be adapted to 3V3 systems: GitHub - gilshultz/i2c-hardware-probe: I²C hardware probe using an Arduino Nano to detect and test I²C devices on a bus. It’s designed for quickly identifying device addresses and verifying communication without needing a full setup. · GitHub

I just downloaded the repo. Am I missing something, the readme Project Contents looks different than the expanded zip.


No idea what you expected but that is what is there.