lcd display with NodeMCU board

Hello,

i have lcd display 12864 i bought it here and iic interface. Also i download library from here https://github.com/prenticedavid/Adafruit_ST7920_kbv . It works on my arduino nano, but i can’t compile my code to my NodeMCU board. When i compile my code on my nodemcu, i got error. What i can do with this and how i can fixed it?

CODE:

#define USE_LCD 0x7920   //select header and constructor

#define LCD_BACKLIGHT  9
#define LCD_CS         10

#include <SPI.h>
#include <Wire.h>

#if USE_LCD == 0x0108
#include <Adafruit_KS0108_kbv.h>
Adafruit_KS0108_kbv display;
#define LCD_BEGIN()    display.begin()
#elif USE_LCD == 0x1306
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128, 64, &Wire);
#define LCD_BEGIN()    display.begin(SSD1306_SWITCHCAPVCC, 0x3C)
#define KS0108_WHITE   WHITE
#define KS0108_BLACK   BLACK
#define KS0108_INVERSE INVERSE
#elif USE_LCD == 0x7920
#include "Adafruit_ST7920_kbv.h" //local
Adafruit_ST7920_kbv display(10);
#define LCD_BEGIN()    display.begin()
#define KS0108_WHITE   WHITE
#define KS0108_BLACK   BLACK
#define KS0108_INVERSE INVERSE
#elif USE_LCD == 0xE7920
#include <ST7920_GFX_Library.h>
ST7920 display(10);
#define LCD_BEGIN()    display.begin()
#define KS0108_WHITE   WHITE
#define KS0108_BLACK   BLACK
#define KS0108_INVERSE 2
#endif


// from PropFonts library
//#include "c64enh_font.h"

char buf[20];

void setup()
{
    Serial.begin(115200);
    pinMode(LCD_BACKLIGHT, OUTPUT);
    //analogWrite(LCD_BACKLIGHT,30);
    digitalWrite(LCD_BACKLIGHT, HIGH);
    SPI.begin();
    //display.begin();
    LCD_BEGIN();
    display.invertDisplay(0);
    display.setTextColor(WHITE);
}




int t = 0;


void loop(){
  
  display.setCursor(2,2);
  display.print(t);
  display.display();
  display.fillRect(0, 0, display.width(), display.height(), BLACK);
  t++;
  delay(1000);
}

ERROR:

In file included from /home/stasdell/snap/arduino/current/Arduino/libraries/Adafruit_ST7920_kbv-master/Adafruit_ST7920_kbv.cpp:252:0:
/home/stasdell/snap/arduino/50/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/Wire/Wire.h: In function 'void twi_master_trans(uint8_t, uint8_t, int, uint8_t, int)':
/home/stasdell/snap/arduino/50/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/Wire/Wire.h:70:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
     uint8_t requestFrom(int, int);
             ^
/home/stasdell/snap/arduino/50/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/Wire/Wire.h:68:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
     uint8_t requestFrom(uint8_t, uint8_t);
             ^
/home/stasdell/snap/arduino/current/Arduino/libraries/Adafruit_ST7920_kbv-master/Adafruit_ST7920_kbv.cpp: In member function 'void Adafruit_ST7920_kbv::st7920BlitRect(const uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)':
/home/stasdell/snap/arduino/current/Arduino/libraries/Adafruit_ST7920_kbv-master/Adafruit_ST7920_kbv.cpp:389:35: error: invalid conversion from 'const uint8_t {aka const unsigned char}' to 'uint8_t {aka unsigned char*}' [-fpermissive]
         p = buf + (row & 31) * 32 + 2 * x0; //rows: 0,1,2,3,... or 32, 33, ...
                                   ^
exit status 1

Oops. I will have a look later on.

The ST7920 experiment with I2C interface was not very serious.
Native SPI performance is MUCH faster than the I2C backpack.

There is not much point in wasting time over ESP8266 I2C if VR1 does not achieve visible contrast with VCC=3.3V

Please report back. i.e. can you adjust VR1 to see any white pixels ?

David.

Yes i can, i connect lcd display to VU and here is 5v.

david_prentice:
Oops. I will have a look later on.

The ST7920 experiment with I2C interface was not very serious.
Native SPI performance is MUCH faster than the I2C backpack.

There is not much point in wasting time over ESP8266 I2C if VR1 does not achieve visible contrast with VCC=3.3V

Please report back. i.e. can you adjust VR1 to see any white pixels ?

David.

Of course the contrast works at 5V.
I asked you to try 3.3V

With 3.3v it is not working

david_prentice:
Of course the contrast works at 5V.
I asked you to try 3.3V

There is not much point in wasting time over ESP8266 I2C if VR1 does not achieve visible contrast with VCC=3.3V

You could connect VCC=5V if you remove the I2C pullup resistors. Contrast should be ok.
Connect I2C pullup resistors to 3.3V

If you are attacking the backpack with a soldering iron, you might just as well use a Dremel saw and remove completely.
Then you can control the ST7920 with regular 3.3V logic via the SPI interface.

David.

Okay, but how i can fix error with Wire?

david_prentice:
You could connect VCC=5V if you remove the I2C pullup resistors. Contrast should be ok.
Connect I2C pullup resistors to 3.3V

If you are attacking the backpack with a soldering iron, you might just as well use a Dremel saw and remove completely.
Then you can control the ST7920 with regular 3.3V logic via the SPI interface.

David.

Be patient. If you answer questions then I will fix the software.

There is no point in me wasting my time on a pointless exercise.

Do you own a Dremel saw ?
Do you own a soldering iron ?

Do you own any resistors (for I2C pullup to 3.3V) ?

David.

I don't have resistors(

david_prentice:
Be patient. If you answer questions then I will fix the software.

There is no point in me wasting my time on a pointless exercise.

Do you own a Dremel saw ?
Do you own a soldering iron ?

Do you own any resistors (for I2C pullup to 3.3V) ?

David.

Hi stats,

I have connected a ST7920 128*64 LCD with a Wemos D1 mini, which is an ESP8266 similar to the NodeMCU


The library used here is u8g2 by Olikraus.
The description and sketches can be found at http://www.zonnepanelen.wouterlood.com/18-connecting-a-wemos-d1-mini-and-a-12864-lcd/
Success, photoncatcher

david_prentice:
You could connect VCC=5V ... Contrast should be ok.
...
Then you can control the ST7920 with regular 3.3V logic via the SPI interface.

SPI ST7920 is the wise way to go for the ESP8266. You just need a Dremel saw.
Several libraries should work.

If you really want to use the I2C backpack - say when you will receive some resistors. I will fix the software.
If you want to use SPI - say when you will acquire a Dremel saw.

David.

Hello, can you send photo of resistor which I need? And why I need connect display to 3.3v? I can connect to VU (on nodemcu) where is 5v.

david_prentice:
SPI ST7920 is the wise way to go for the ESP8266. You just need a Dremel saw.
Several libraries should work.

If you really want to use the I2C backpack - say when you will receive some resistors. I will fix the software.
If you want to use SPI - say when you will acquire a Dremel saw.

David.

I have given clear advice.

i.e. run I2C backpack on 5V Uno, Mega2560
i.e. remove backpack and use SPI for a 3.3V NodeMcu.

I have asked questions about your tools, resistors, soldering, …
If you answer them, we can advise you how to remove the backpack without damage.

If you don’t want to answer that is fine. You are on your own.

If you don’t know what a resistor looks like you should find a new hobby.

David.

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