I have an LCD shield from nuelectronics. This is a reasonably priced shield with basic capabilities. I made some LCD mods to give some additional possibilities.

I have modded the library and made a small hardware change to allow writing to the LCD so that custom characters could be used.
I have since migrated to serial LCD which is rather more convenient because of the fewer pin usage.
LCDmods

The pins that are used by default is PB0 which is Digital8 and PB1 which is digital9 for RS and E respectively.
I desoldered the R7 zero resistance resistor and wired it up to PD3 wich is digital3 to have control over the read/write function.

[spoiler]

//example use of LCD4Bit_Seguino library
//and tone library
//by krulkip v1.0.0 23 august 2010 LCD mods
#include <avr/pgmspace.h>
#include <LCD4Bit.h> 

LCD4Bit lcd = LCD4Bit(2); // give numRows for LCD mods
int readwrite    =   3;

void setup() {
  Serial.begin(9600);
  pinMode(readwrite, OUTPUT);
  digitalWrite(readwrite,LOW); //set backlight on LCD mods
  lcd.init(8,9,4,5,6,7);// give pins for rs, enable, d4, d5, d6, d7
//creating the custom fonts:
  lcd.commandWrite(B01001000);  // set cgram on LCD mods
  static byte chars[] PROGMEM =
  { B11111,B00000,B11111,B00000,B10000,B11000,B11100,B11110,
    B11111,B00000,B11111,B00000,B10000,B11000,B11100,B11110,
    B11111,B00000,B11111,B00000,B10000,B11000,B11100,B11110,
    B00000,B00000,B00000,B00000,B10000,B11000,B11100,B11110,
    B00000,B00000,B00000,B00000,B10000,B11000,B11100,B11110,
    B00000,B11111,B11111,B01110,B10000,B11000,B11100,B11110,
    B00000,B11111,B11111,B01110,B10000,B11000,B11100,B11110,
    B00000,B11111,B11111,B01110,B10000,B11000,B11100,B11110};

    for(byte x=0;x<8;x++){
      byte a=(x<<3)|0x40;
      for(byte y=0;y<8;y++)
	  {lcd.commandWrite(a++); //write the character data to the character generator ram
	  lcd.print(pgm_read_byte(&chars[y*8+x]));}
}  

lcd.clear();
lcd.commandWrite(B10000000);  // set dram to zero

}
// now we define which characters to use to display a block of 4 characters (including space)
// by 2 height so 4,1,4,0 is the top half of zero and 4,2,4,0 the lower half
// A 32 means its a space
char bignumchars1[]={255,0,255, 0,255,32,    2,2,255,  0,2,255,  255, 1,255,  255,2,  2,  255,2,  2,  0, 0,255,  255,2,255, 255,2,255};
char bignumchars2[]={255,1,255, 1,255, 1,  255,1,  1,  1,1,255,   32,32,255,    1,1,255,  255,1,255, 32,32,255,  255,1,255,   1,1,255};
void loop() {
    lcd.clear();
    lcd.cursorTo(1, 0);  //line=1, x=0
    lcd.printIn("Hallo world :1");
    lcd.cursorTo(2, 0);  //line=2, x=0
    lcd.printIn("Hallo world :2");
    delay(2000);
    // start countdown using big letters
    lcd.clear();
    for(int x = 9;x>-1;x--){
    lcd.cursorTo(1,0);
    for (int i=0;i<3;i++){
    int text=bignumchars1[x*3+i];
    lcd.print(text);
    }
    lcd.cursorTo(2,0);
    for (int i=0;i<3;i++){
    int text=bignumchars2[x*3+i];
    lcd.print(text);
    }  
    delay(800);
    }
    int bar;
    lcd.cursorTo (1, 5);
    // Display analog value in decimal
    lcd.printIn ("=");
    for (int i=0;i<8;i++){lcd.print(i);}
    //
    delay(2000);
    for(int i=0;i<96;i++){  // Bar is 120 pixels long;
    // Display two rows of "analog" bar-graph
    // For a two-row LCD, change these next two lines to: drawbar (0, ana);
    bar = random(96);
    drawbar (1, bar);
    bar=i;
    drawbar (2, bar);
    }
    // Update rate is 50Hz (approx)
    delay(1000);
}

/* drawbar -- draw a bar on one row of the LCD */
void drawbar (int row, int bar)
{
  int count;
  lcd.cursorTo ((row), 0);
  int check=(bar%6);
  for (int count = 0; count < (bar/6); count++){
  lcd.print(255);}
  if (count<20) {
  if (((check)<5) & ((check)>0)) {lcd.print(check+3);}
  if ((check)==5) {lcd.print(255);}
  }
  for (int i=bar/6+2; i <= 20; i++){lcd.print (32);}  // Clear remainder of row
}

[/spoiler]

LCD mods software

Here is the whole library with example program.
The video shows the possibilities. A simple text display, large numbers, custom chracters and a bargraph.
The original nuelectronics library has been modde to include:
Added passing pins and no rows through constructor
Now can be any pins not required sequential
Added support for 4 row LCD’s

LCDmodsshield

Leave a Comment