0.9 inch oled hangs after about 1 Minutes

shrimps
Posts: 3
Joined: Tue Apr 10, 2018 6:04 pm

0.9 inch oled hangs after about 1 Minutes

Postby shrimps » Tue Apr 10, 2018 7:26 pm

Hi all,
sorry this is my first message in this board.
Iam not very well at englisch, so please sorry
My problem:
I coded some tiny sketch to be displayed on the oled
my board:
https://www.amazon.de/gp/product/B071P9 ... UTF8&psc=1
Oled:
https://www.amazon.de/gp/product/B01L9G ... UTF8&psc=1
All things ar display at the seriel att all time but on the oled it hangs after about 1 minute ???
Whats wrong
Thanks for any help
greetings from D

Code: Select all

#include <WiFi.h> 
#include "time.h"
#include <Adafruit_SSD1306.h>  // 0.9 Zoll OLED

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET); 

const char* ntpServer = "pool.ntp.org";
const long  gmtOffset_sec = 3600;
const int   daylightOffset_sec = 3600;


char ssid[] = "***";    // Your network SSID (name)
char pass[] = "***";  // Your network password (if any)

static float  TempS = 7.8;
static float  TempG = 15.3;
static short  Lux = 59;

void setup() {
  Serial.begin(115200);
  Serial.printf("Connecting to %s ", ssid);
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) 
  {
      delay(500);
      Serial.print(".");
  } 
  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.print("Local IP address : ");
  Serial.println(WiFi.localIP());

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE); 
  display.setCursor(0,0);
  display.println("Modul startet...");
  display.println("Locale IP addresse: "); 
  display.println(WiFi.localIP());
 
  configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
  printLocalTime();
  display.display();
  delay(5000);  
  
}

void loop() 
{
    Serial.print("Temperatur Schlafhaus: ");  
    Serial.printf("%3.1f \n",TempS);
    Serial.print("Temperatur Vorraum   : ");  
    Serial.printf("%3.1f \n",TempG);
    Serial.print("Helligkeit (LUX)     : ");  
    Serial.println(Lux);  
    Serial.println("");  

    display.clearDisplay();
    display.setCursor(0,0);
    display.setTextSize(1);
    printLocalTime();

    display.setTextSize(2);
    display.setCursor(0,10);
    display.print("SH :");  
    char anzeige[10];
    dtostrf(TempS, 4, 1, anzeige);
    display.println(anzeige);  
    
    display.print("GH :");  
    dtostrf(TempG, 4, 1, anzeige);
    display.println(anzeige);  
    display.print("LUX:");  
    display.println(Lux);  

    display.display();
    delay(1000);  

}  //void loop


void printLocalTime()
{
  struct tm timeinfo;
  if(!getLocalTime(&timeinfo)){
    Serial.println("Failed to obtain time");
    return;
  }
  Serial.println(&timeinfo, "%d.%m.%Y %H:%M:%S");
  display.println(&timeinfo, "%d.%m.%Y %H:%M:%S");
}



rin67630
Posts: 141
Joined: Sun Mar 11, 2018 5:13 pm

Re: 0.9 inch oled hangs after about 1 Minutes

Postby rin67630 » Wed Apr 11, 2018 7:56 am

You might just have got a crappy hardware.
I had much trouble with those modules.

Archibald
Posts: 110
Joined: Mon Mar 05, 2018 12:44 am

Re: 0.9 inch oled hangs after about 1 Minutes

Postby Archibald » Wed Apr 11, 2018 8:58 am

Other people are reporting the same issue with I²C.

Alternative 'Wire' library is available here:
https://github.com/stickbreaker/arduino ... aries/Wire

mikemoy
Posts: 627
Joined: Fri Jan 12, 2018 9:10 pm

Re: 0.9 inch oled hangs after about 1 Minutes

Postby mikemoy » Wed Apr 11, 2018 12:47 pm

@shrimps, I was getting I2c Errors after about 2-3 hours. I switched to ESP-IDF and have not had any so far.

shrimps
Posts: 3
Joined: Tue Apr 10, 2018 6:04 pm

Re: 0.9 inch oled hangs after about 1 Minutes

Postby shrimps » Thu Apr 12, 2018 11:03 am

Thanks for all Answers...

I will have a look at new Librarys...

Actually my i2c dosn´t answers... :geek:

But theese tiny things make a lot of fun

Greetings from D

BTW: Is anyone near my country (PLZ 41x) ?

shrimps
Posts: 3
Joined: Tue Apr 10, 2018 6:04 pm

Solved: 0.9 inch oled hangs after about 1 Minutes

Postby shrimps » Fri Apr 13, 2018 9:41 am

Hello, Feedback:
I changed the library from adafruit to esp8266-ole-ssd1306-master.
And secondly i found some skaky connection in my cables (seen at the i2c-scanner)

Now it runs 24h without problems...

Thank at all

Who is online

Users browsing this forum: No registered users and 128 guests