Graphic Display S7920 128x64 horizontal pixel shifts

Hello Guys, I’am new in the Arduino programming and have a problem.
Sorry my English is not so good :frowning:

I am use an Graphic Display ST7920 128x64 (from Amazon) the basicly programming is not the problem but i think I have a hardware timing problem.

Sporadically / often are some pixel are horizontal shift. see the Pictures in the attachement.

My Hardware Setup

  • Arduino Mega 2560 (Clone)
  • Grafik Display ST7920 128x64 on SPI
  • MAX31865 for PT100
  • Build on Breadborad
  • Library = U8G2

How or where can I change the delay for the write timing ?
I have search in the Library but I haven’t found die section :frowning:

What are meaningful Value ?

Thanks a lot for your support.

Here are the Code:

#include <Adafruit_MAX31865.h>
#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>

//Pins for MAX31865
const int MAX_CS = 53;
const int MAX_CLK = 52;
const int MAX_SDI = 51;
const int MAX_SDO = 50;

//Referenz Widerstand (gemessen) auf der MAX31865 
#define RREF 424.0

//Pins for LCD
const int LCD_CLK =13;
const int LCD_DATA = 11;
const int LCD_CS = 10;
const int LCD_RESET = 8;

char StrTemp [5];

// Use software SPI for MAX31865
Adafruit_MAX31865 max = Adafruit_MAX31865(MAX_CS, MAX_SDI, MAX_SDO, MAX_CLK);

// Use software SPI for ST7920

void setup() {
  // put your setup code here, to run once:

void u8g2_prepare(void){


void printValue(void){
//Read Temeratur
float Temp = max.temperature(100, RREF);

//Convert float to String
//Display bereinigen

//Print static text

//Print Values


void loop() {
  }while (u8g2.nextPage());

  delay(1); //For test 1-1000 tried

char StrTemp [5];    //good for ##.#  safer to cope with 100.1 and -10.1 i.e. [###.#]

and unnecessary redraws

  delay(1); //For test 1-1000 tried

As a general rule, you would only redraw when something changes.
All the same, the ST7920 should draw happily from infinity to beyond.


Hello David, thanks for your answer but I think that's not the problem.
Yes, that's not the smallest Code ever but this can't used many resources.

I have made a video from the origanal example code and there can you see the pixel problems.
Any filled area have stripes. That's not correct. Other videos of this example doesn't show these problems.

Thanks a lot!

Yes, your video has some glitches.

I have a similar ST7920 display and it works fine.

I suggest that you post a photo of your wiring.
I suspect that you have an intermittent connection in one of the wires.

It also looks rather a lot of wires for a SPI connection.


So I have a little bit experimented.

I have used the hardware SPI from the Arduino Mega 2560 with the orginal wireing ;-).

Ihe Display works fine and without Problems look at the video.

This confirms my assumption that the wiring is not the problem
but the timing for the software SPI emulator.

Why ever at my project

Maybe someone still has an idea where I can manipulate the timing.

Thx a lot