Message not printing to LCD screen

Hi All,

I am trying to create a message board using a 128x64 LCD screen. The one I have is this one from Jaycar: https://www.jaycar.com.au/arduino-compatible-128x64-dot-matrix-lcd-display-module/p/XC4617

I am using an Arduino Uno R3

The datasheet is here: https://www.jaycar.com.au/medias/sys_master/images/images/10222065909790/XC4617-dataSheetMain.pdf

The setup I have so far is here:


Yes, I realised after taking the photo that the yellow wire was broken off. That was from turning the screen over to get a photo of the pin details.

Please don't shoot me for soldering these in. The store I visited for the screen did not have header strips in stock. I'll grab one elsewhere tomorrow.

So, what am I trying to do? Well, at this point I am trying to do a "Hello World" test to make sure things are wired up correctly and that I am using the correct comment line and the correct settings for the pins to match the U8GLIB settings. I currently have the below comment running, but so far no luck. Once I have it running, I want to have a message board that rotates through the preset messages each day.

U8GLIB_ST7920_128X64_1X u8g(10, 11, 13)

The default in the library was set as U8GLIB_ST7920_128X64_1X u8g(18, 16, 17)

The whole code is below which I got here: GitHub - olikraus/u8glib: Arduino Monochrom Graphics Library for LCDs and OLEDs I have removed all of the comments that do not relate to the LCD screen to wade through the mess.

Based on the above images attached and the code below, can you see any reason why this is not working? Any assistance would be very much appreciated.

Thanks, Dave

/*

  HelloWorld.pde
  
  "Hello World!" example code.
  
  >>> Before compiling: Please remove comment from the constructor of the 
  >>> connected graphics display (see below).
  
  Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
  
  Copyright (c) 2012, olikraus@gmail.com
  All rights reserved.

  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this list 
    of conditions and the following disclaimer.
    
  * Redistributions in binary form must reproduce the above copyright notice, this 
    list of conditions and the following disclaimer in the documentation and/or other 
    materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
  
*/


#include "U8glib.h"

// setup u8g object, please remove comment from one of the following constructor calls
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
**U8GLIB_ST7920_128X64_1X u8g(10, 11, 13);**	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17


void draw(void) {
  // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 0, 22, "Hello World!");
}

void setup(void) {
  // flip screen, if required
  // u8g.setRot180();
  
  // set SPI backup if required
  //u8g.setHardwareBackup(u8g_backup_avr_spi);

  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
  
  pinMode(8, OUTPUT);
}

void loop(void) {
  // picture loop
  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );
  
  // rebuild the picture after some delay
  //delay(50);
}


V0 is the contrast adjust , a 1K to GND will also work in most cases.

1 Like

Would you post a photo when all wires are soldered and "hello" is running?

Hi @dave0708 ,

I found a similar display from Joy-It and this documentation:

https://cdn-reichelt.de/documents/datenblatt/A300/SBC-LCD128X64_MANUAL_2021-07-29.pdf

it's a little bit strange ...

Although it is titled "SPI" it does not use the UNO default SPI pins (10,11,12,13) but those which you have pointed out as the original data in the ug8 example (16 = A2, 17 = A3, 18 = A4, looks as if MISO = Master In Slave Out is not connected, not here and not in the Raspberry Pi application).

You might give it a try ...

Good luck!
ec2021

Here you go

Have you tried adjusting the contrast?

The reference (and others) was to the ethernet shield...
This page:
https://docs.arduino.cc/learn/programming/sd-guide/

Says this about default SPI pins:

pin 4 is default Chip Select (CS) pin for most boards

Awesome, this worked!! Thanks ec2021

Now I just need to work out how to program the messages and then have them change every 12-24 hours.

I suspect I just scrap the codes for what I don't want and add what I want in and it should be okay. correct?

Okay, new question.

I have managed to get the Hello World example running. But, I want to add extra comments as it looks like it might be easier than the Graphics Test. Any ideas on how to do this, please?

As the ug8lib will not bei supported in future the developer suggests to use the newer version

There are reference documents with examples

how to use the library.

To print different strings you might learn how to handle c strings (arrays of character). That's the better choice than String objects for controllers with limited memory.

Just google for c strings Arduino and you'll find lots of tutorials!

If you get stuck feel free to come back with your questions... :slight_smile:

ec2021

Thanks, mate.

I managed to fudge the Hello World example at this point in time. Was on a deadline of tonight to get it done before my wife flies out tomorrow morning for 4 months working o/seas.

I have installed the program onto her laptop so I can amend things as I need to. But for now, it is working and packed in her luggage. Just hope it doesn't get pinged as a suspicious item, lol.

Here is the end result.


Appreciate everyone's replies and support on this. It is actually my first working/completed Arduino project.

Cheers, Dave

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.