Connecting Nano with GLCD

I have a GLCD ks0108 module. I used to connect my ATMega2560 to it and it used to work flawlessly.

I have recently acquired an Arduino Nano (Mega328) and I'm trying to assemble the circuitry and running the ks0108 example found in with the openGLCD ( https://bitbucket.org/bperrybap/openglcd/wiki/Home ) library.

The wiring is as below, based on Pinout B from https://playground.arduino.cc/Code/GLCDks0108 :

LCD | Arduino

01 GND 02 5V 03 Middle Pin of Potentiometer 04 A3 05 A2 06 A4 07 RX 08 TX 09 D2 10 D3 11 D4 12 D5 13 D6 14 D7 15 A0 16 A1 17 5V (Also tried attaching to RST pin, same results) 18 Left pin of potentiometer 19 5V 20 GND

Potentiometer right-pin is also attached to common GND

The sketch uploads successfully and starts running..however I only get a partial line at the bottom, and SOMETIMES 2 lines refreshing as they should, the rest just blank white (see photo: [ https://imgur.com/QIHiOk0 ]). I have tried debugging it, checking the code, checking the wiring, but no luck so far.

Any help is appreciated.

Forget anything that has to do with panel pinout "types". There are more than 10 different pinouts for ks0108 modules.

What is necessary is to use the datasheet for your particular ks0108 module. The display must be wired up to the appropriate arduino pins based on the datasheet. Some of the pinouts are so different that damage to the Arduino or the GLCD can occur if using the incorrect pinout. There is additional information about about how to wire up the pins in the included opgnGLCD html documentation that comes with the library. The openGLCD wiki explains where/how to find the documentation in the openGLCD library. See the section Wiring->KS1010Family in the documentation.

Once the display is wired up, the next step is to run the diag sketch. The diag sketch is designed to help with soldering & wiring issues or lcd h/w issues, assuming the pin wiring is correct. But first and foremost is to get the wiring correct based on the datasheet.

Do you have a link to the datasheet for your specific LCD module?

--- bill

One thing I just noticed is it appears that your are using the TX and RX pins. I would not recommend doing this. In fact, I would highly discourage it. But if you really really want to do that, you will definitely have to go in and modify the config file to specify those pins being used for whatever glcd pin function you hooked them up to. And then things like the diag sketch will no longer work and uploads may have issues depending on which glcd functions are used for those pins.

The key with wiring is you must connect each individual Arduino pin specified in the config file to the glcd pin function specified in the config file for that individual Arduino pin. The data sheet is used to locate which pin is used for each glcd function.

openGLCD is not like most other libraries. The Arduino pins uses are not specified in the sketch but rather a config file. See the included documentation for more information on config files.

--- bill

I have the email with the specific KS0108 module datasheet which had been sent to me by the seller, this specifies that the KS0108 uses Pinout B, but the mapping is applied for the Mega Arduino.

I have found the KS0108 documentation in the OpenGLCD library (didn't know about it thanks!). Though it's interesting, there's no direct mapping to the Nano board. Can I use any of the other board configurations for my Nano?

As for the Tx and the Rx, they weren't my choice to be exact, and I can understand why it is not recommended to use them, but aren't those pins D0 and D1, as specified in the mapping?

-Mark

darnegar: I have the email with the specific KS0108 module datasheet which had been sent to me by the seller, this specifies that the KS0108 uses Pinout B, but the mapping is applied for the Mega Arduino.

Again, you should be using a real datasheet - not ks0108 pinout table references. While pinout tables can be convenient, they are error prone and errors in wiring can potentially damage the glcd or the Arduino. A real ks0108 datasheet will show the glcd function for each module pin. That is what you need.

There are 3 different "ks0108" libraries that all share the same heritage from a library written by Fabian Maximilian Thiele. - ks0108 - a port of Thiele's library to Arduino by Michael Michael Margolis - glcd or glcd v3 - a partial re-write of ks0108 that I contributed heavily (it is faster and supports other glcds) - openGLCD - a fork of glcdv3 that has more features and is licensed GPL v3 vs LGPL 2.1+ I am the sole author & maintainer of openGLCD.

While openGLCD is currently compatible with ks0108 & glcdv3 in many ways, it is a different library and I would recommend using the openGLCD documentation vs ks018 or glcdv3 documentation.

During the glcd library development Michael and I had many disagreements. One area of those areas was panel / pinout types. He "invented" them to try to make things easier for the Arduino crowd. While it generally works and does make things a bit easier, especially for certain people, it isn't foolproof and users often need hand holding. Also, if they pick or use the incorrect panel/pinout type, they can fry their glcd or the Arduino. Another issue panel pinout types, and this was the last straw for me, was that there are multiple versions of this pinout type table that were different since these tables were being maintained on the ks0108 wiki that was open for public editing. This meant that there was no guarantee that a given pinout type was correct or that it would not change over time. I saw cases were people would go in and modify the pinout type table on the ks0108 wiki instead of creating a new one. Even worse, I also saw cases where people would insert a new on in the middle of the list and bump the others down. i.e they would create a new panel C and bump the existing C to D. There were and probably still are external references to these pinout tables. The problem is that the external reference might specify a particular pinout type, but over time the table for that type might be modified or renamed. This is a BIG issue as using the incorrect table can fry things.

This is why I highly discourage their use. You simply can't trust tables that can be modified by anyone at any point in time.

In openGLCD I immediately abandoned them or any reference to them in favor of simply using the glcd datasheet as that method will always work and is nearly as easy as using the pinout tables.

I have found the KS0108 documentation in the OpenGLCD library (didn't know about it thanks!).

There is information about it on the bitbucket wiki for openGLCD.

Though it's interesting, there's no direct mapping to the Nano board. Can I use any of the other board configurations for my Nano?

You can't just pick any config file. openGLCD assigns its pins using a config file. You must wire up pins according to what is in the config file that is being used. While you can override this, openGLCD picks a config file based on the board type selected in the IDE. Do to the way the IDE works, there isn't always a 1 to 1 mapping between an IDE board type and a openGLCD config file. If you run the diagnostic sketch it will tell you which pin config file is being used. For the Nano, openGLCD should pick the uno pin config file, but run the diagnostic sketch as it will tell you. The diagnostic sketch will also print out how all the glcd pins need to be wired to the Arduino. You must wire the pins between the Arduino and the glcd the way the diagnostic reports them. You can change the pins used to anything you want by modifying the config file; just make sure that they are wired up the way the diagnostic sketch reports. You can read more about pin configuration and config files in the documentation.

Running the diag sketch and looking at the serial output is very useful when initially getting things working.

As for the Tx and the Rx, they weren't my choice to be exact, and I can understand why it is not recommended to use them, but aren't those pins D0 and D1, as specified in the mapping?

Not sure what mapping your are referring to (Arduino board pin mapping or openGLCD pin mappings) But use of those pins must be your choice since openGLCD does not ship with any pin configuration that uses those pins. Being able to use the serial interface is necessary for the diag sketch.

--- bill