Page 1 of 1

NodeMCU / 0.96 OLED Not Working

PostPosted: Mon Sep 16, 2019 9:53 am
by JohnAPA
Hello I am using NodeMCU ESP8266, and trying to connect SD1306 0.96 OLED Display. I've been troubleshooting for a week and can't seem to find an answer. It was previously working, and then somewhere, somehow it just stopped.

My setup is derived from Rui Santos and Random Nerd Tutorials.

I additionally ran a an i2c scanner provided by Rui Santos to troubleshoot.

The Output is
Code: Select allScanning... No I2C Devices found

I've confirmed that all wires are in place including SCL/SDA.
-D1 -- SCL
-D2-- SDA

I then Tried to connect a second OLED I had to see if it was a hardware issue.
The OLED was found. However, no output!

when running my original code which would display information, the second OLED still didn't work. So at this point the issue must be the board (Esp8266) itself.

To see if it was a library issue I tried installing the specific libraries for Node MCU ESP8266, that didn't work.
To see if it was my coding, I tried running the example code for the OLED Demo. Didn't work.

At this point I feel this may be a ESP8266/NodeMCU firmware issue, and unsure where to go from here. I looked into firmware reloading but it seems really complicated on a mac. Unless maybe someone may have an idea of what could be the problem I am running into? If you want to see the code I used to run the program see below (you will see in void loop, that i've added the I2C Scanner in there for troubleshooting:

Does anyone else have any suggestions?

Code: Select all

/**********Include Libraries**********/

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>


// Definitions
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)

#define DHTPIN 0    // Digital pin connected to the DHT sensor (D3)
#define DHTTYPE    DHT11     // DHT 11

// Create the DHT22 temperature and humidity sensor object

//-----/**********--VOID SETUP--**********/-----//

void setup() {



    if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever

//-----/**********--VOID LOOP--**********/-----//

void loop() {

// Read Temperature and Humidity
  float t = dht.readTemperature();
  float h = dht.readHumidity();
  float f = dht.readTemperature(true);
  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");

// Compute Heat Index
  // Must send in temp in Fahrenheit!
  float hi = dht.computeHeatIndex(f, h);
//print data to serial
  Serial.print("Humidity: ");
  Serial.print(" %\t");
  Serial.print("Temperature: ");
  Serial.print(" *C ");
  Serial.print(" *F\t");
  Serial.print("Heat index: ");
  Serial.println(" *F");
  // Display
  display.print("Temperature: ");
  display.print(" ");
  display.setCursor(0, 35);
  display.print("Humidity: ");
  display.setCursor(0, 45);
  display.print(" %");


Re: NodeMCU / 0.96 OLED Not Working

PostPosted: Mon Sep 16, 2019 7:52 pm
by rudy
So at this point the issue must be the board (Esp8266) itself.

That is a poor assumption to make. While that is a possibility, you might have done something electrically marginal the may have worked before. And may have damaged the first oled. It is possible that the second oled could fail given some time.

There are a number of possibilities and you will only know what was the cause once you have resolved the problem.

Re: NodeMCU / 0.96 OLED Not Working

PostPosted: Thu Sep 19, 2019 7:53 am
by amar1
Are you using 4 pin OLED or 7 Pin? If you are using 7 pin OLED and using SPI communication, then why are you running I2C scanner?
In NodeMCU, firmware should not be a issue, it can be easily programmed with Arduino IDE, there are lot of tutorials on it like this one:
If it were ESP8266-01 then there may be struggle with firmware.
Coming to the connections, connecting OLED with NodeMCU is also easy and the coding should also not a problem as you are already using Adafruit Libraries. Commonly the connection should be like this:
Cross check the connections and test check by dumping the code from the same circuit diagram link page here:
THen update here if it works.

Re: NodeMCU / 0.96 OLED Not Working

PostPosted: Sat Sep 28, 2019 5:42 pm
by JohnAPA
Hey thank you for your response. I am actually using the 4 pin OLED. I went through all of the tutorials and seem to come up with no solution still. I also have a github account with the OLED coding in it if anyone would like to look it over maybe, to see where I may be going wrong?

Also, one thing I noticed I did.
I connected the VIN and GRD (5V) to the breadboard's power input. I then powered the ESP board using my USB Cable to computer. Could that have caused some sort of hardware damage?