SSD1283A 1.6" display shows a white screen

Hi Pros! 8)

I would like to ask for your help.

I created a monitoring system for my boiler.
One ESP8266, 5 sensors (DS18B20) and one display (SSD1283A).

Only display values if the PRI sensor detects movement so that the characters do not burn into it.
There’s something wrong here, because there are times when it works well for a day, but there are times when, even an hour later, when it turns on, I only see a blank white image. :o
I tried the mylcd.Init_LCD() function every time it detects a movement, but it didn't help either.
Could there be some buffer that overflows?
Or is it necessary to delete and redisplay the data differently?
Does anyone have an idea?

The source code is a bit long (1500 lines) so I just copy the display part here (without WiFi, MQTT, Thingspeak).

Thanks for your help.

/*      ESP8266 - DS18B20 - MQTT - ThingSpeak

  SSD1283A display
                   CS  A0  RST  SDA   MISO  SCK  LED
                       CD       MOSI        CLK
   ESP8266 NodeMCU  D8  D2  D6   D7    NONE  D5   GPIO3 (RX, from A0)

  PIR
          ESP8266  5V pow.suppl.
  GND	    GND      GND
  OUT     A0
  VCC              +5V

  DS18B20
          ESP8266  5V pow.suppl.
  GND              GND
  VCC              +5V
  DATA    D4 (+3.3V 4.7 kOhm)

*/

#include "ThingSpeak.h"
#include <DallasTemperature.h>
#include <ESP8266WiFi.h>
#include <LCDWIKI_GUI.h> //Core graphics library
#include <LCDWIKI_SPI.h> //Hardware-specific library
#include <MQTTClient.h>
#include <NTPClient.h> // Include NTPClient library
#include <OneWire.h>
#include <SPI.h>
#include <TimeLib.h> // Include Arduino time library
#include <WiFiClient.h>
#include <WiFiUdp.h>
#include <Wire.h>


#define MODEL SSD1283A
#define CS  D8
#define CD  D2
#define RST D6
#define LED  3

// hardware SPI
LCDWIKI_SPI mylcd(MODEL, CS, CD, RST, LED); // hardware spi,cs,cd,reset,LED

// colors
#define BLACK 0x0000
#define WHITE 0xFFFF
#define RED 0xF800

// Data wire is plugged into port D4 on the Arduino ESP8266
#define ONE_WIRE_BUS D4

unsigned long lastMillis = 0;
unsigned long nextMillis = 10000; // check sensor time

byte OLED_BackLight = 3; // RX pin for backlight

byte PIR = A0;
unsigned int A0_value = 0;
bool movement = false;

int temp_hotwater = 0;

// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

DeviceAddress Sensor_hotwater  = {0x28, 0x4E, 0xCB, 0x83, 0x33, 0x20, 0x01, 0xDE};

byte screen_rotate = 0; // Display orientation


void checkSensor() {
  sensors.requestTemperatures(); // Send the command to get temperatures
  temp_hotwater = sensors.getTempC(Sensor_hotwater);

  A0_value = analogRead(PIR); // movement?

  if (A0_value > 300) {

    if (!movement) {
      mylcd.Init_LCD();
      digitalWrite(OLED_BackLight, HIGH); // backlight ON
    }

    mylcd.Set_Text_Size(1);
    mylcd.Set_Text_colour(WHITE);
    mylcd.Print_String("Hot water", 5, 25);

    mylcd.Set_Text_Size(3);
    mylcd.Set_Text_colour(RED);
    mylcd.Print_Number_Int(temp_hotwater, 30, 35, 0, ' ', 10);

    movement = true;

  } else {

    movement = false;
    mylcd.Fill_Screen(BLACK);
    digitalWrite(OLED_BackLight, LOW); // backlight OFF

  }

  Serial.print("Hot water °C: ");
  Serial.println(temp_hotwater);
}

void setup() {
  Serial.begin(115200);
  while (!Serial) {
  }

  // Start up the sensor DS18B20library
  sensors.begin();

  pinMode(PIR, INPUT);                // A0 - PIR
  pinMode(OLED_BackLight, OUTPUT);    // OLED backlight pin RX
  digitalWrite(OLED_BackLight, HIGH); // backlight ON

  mylcd.Init_LCD();
}


void loop() {
  if (millis() - lastMillis > nextMillis) {
    lastMillis = millis();
    checkSensor();
  }
}

I don't know what an ESS8266 is.

Please post a link to the actual ?? ESP8266 ?? board that you have bought. e.g. Ebay sale page.

D4 is GPIO4 (probably) which is (probably) I2C SDA pin.

You appear to be using DS1307 which is an I2C device.

I suggest that you post the relevant link(s)
Move OneWire pin to an unused GPIO pin.

David.

Hi,
unfortuantely I don't have the 'Modify' button for my post...

The board is ESP8266 from AliExpress.
The sensors are DS18B20 from Hestore.
The display is SSD1283A from AliExpress.

D4 is GPIO2.

Seriously. Your link shows about 7 different "ESP8266" items.
Each has a name. Please either quote the name or say which number picture you have.

The DS18B20 can work on any pin (except the ESP8266 Analog pin)
The SSD1283A is using the Hardware SPI pins.

My apologies. I misread your "Wire.h" statement in #0 as "DS1307.h".
You don't seem to be using I2C. So my SDA pin comment was not applicable.

ESP8266 boards and modules do tend to have D# macros that define different GPIO# pins.
ESP32 boards tend to refer to GPIO# directly.
Which "board" do you select in the IDE?

David.

Edit. From C:\Users\David Prentice\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\variants\nodemcu\pins_arduino.h

// I have added the pin function
static const uint8_t D0   = 16; //LED_BUILTIN
static const uint8_t D1   = 5;   //(SCL)
static const uint8_t D2   = 4;  //(SDA) DC
static const uint8_t D3   = 0;  
static const uint8_t D4   = 2;  //ONEWIRE
static const uint8_t D5   = 14; //SCK
static const uint8_t D6   = 12; //MISO RST
static const uint8_t D7   = 13; //MOSI
static const uint8_t D8   = 15; //CS
static const uint8_t D9   = 3;   //LED
static const uint8_t D10  = 1;

I strongly recommend that you stick to D# pins. i.e. LED is D9 (GPIO3)
I would avoid using D6 (GPIO12) for RST pin because SPI expects MISO function.

If you move RST to say D0 (GPIO16) you will see the RST value in the built-in LED.

Hi David,

I have bought the NodeMCU V3 CH340 version.
In IDE I set the NodeMCU 1.0 (ESP-12E).
I have changed: #define LED D9
and: #define RST D0.

In an example I've read that MISO is not used.
SSD1283A - ESP8266
CS - D8
A0 - D2
RST - D6
SDA MOSI - D7
MISO - NONE
SCK CLK - D5
LED - D9

Thank you for your help, tomorrow I will give a try with this settings.

This topic was automatically closed after 65 days. New replies are no longer allowed.