Go Down

Topic: Big Fonts for 20 x 4 LCD (Read 486 times) previous topic - next topic

WaitSome

I am looking for a font for a digital clock. I have spent about two hours searching and trying stuff, and very little compiles and works with my 20 x 4 LCD with added-on i2c Serial board attached.

I'd like to try numbers 2-lines high and also 4-lines high, but I think if I can find a good enough font, I'll go with two lines of 2-lines.

Any suggestions before I set about reinventing the wheel?

david_prentice

Think about it.    Digital clocks often use 7-segment displays.
You have 8 user defined characters that could represent each segment.

If you can design some attractive blobs to imitate each segment,    give it a go.

I suggest that you would be better off with a ST7920 style of display.    They cost about the same as a 20x4 but can produce a full graphic display.     They also use the same pinout.    So you could use as nice a big font as you like.    (or just use it to print text like a posh 20x4)

David.

floresta

Using the term LCD "big font" in the search box at the upper right I came up with this --> http://forum.arduino.cc/index.php?topic=44427.0

Don

WaitSome

Using the term LCD "big font" in the search box at the upper right I came up with this -
Thanks Don, but that's one I have already tried before posting. It does not work with my i2c serial lcd.

WaitSome

suggest that you would be better off with a ST7920 style of display.
Thanks David, but I have the thing fitted in a case with a bunch of other stuff. Also very low on memory after checking a couple of libraries, I'd have to use a Mega. So a rebuild would be the only option and I don't want to do that at this stage. The big font is just a "nice to have" option.

MAS3

It does not work with my i2c serial lcd.
How doesn't it work ?

Do you get any error messages, and if so show those.
The linked solution is quite old.
See if you can make it work using an IDE older than version 1.0.
Newer versions might be troublesome using older libraries.
Newer Arduino files are *.ino, older are *.pde.
If you run into *.pde files, expect to get that kind of trouble (not meaning *.ino files will not do that).
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

WaitSome

#6
Sep 11, 2015, 06:12 pm Last Edit: Sep 11, 2015, 06:21 pm by WaitSome
Hi MAS3, thanks for the thoughts. I got too many errors as that sketch apparently uses LCD4Bit and the one further down uses the standard LiquidCrystal. I need to use the LiquidCrystal_12c library.

I am not skilled enough in C/C++ to adapt either of them. I can post the error message if you like. The Arduino is on another PC so will edit this post from it in a few minutes.

Using Post #7, #8 and #9
Quote
#include <LiquidCrystal_I2C.h>
Arduino: 1.6.5 (Windows 7), Board: "Arduino/Genuino Uno"

LCD_Big_Font_01.ino: In function 'void printOneNumber2(uint8_t, byte, int)':
LCD_Big_Font_01:53: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:59: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01.ino: In function 'void bigNum(long unsigned int, int, byte, int)':
LCD_Big_Font_01:98: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:99: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:100: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:101: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:102: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:103: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:105: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:106: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:108: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:110: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01.ino: In function 'char* format(long unsigned int)':
LCD_Big_Font_01:136: error: incompatible types in assignment of 'char' to 'char [7]'
LCD_Big_Font_01:139: error: incompatible types in assignment of 'long unsigned int' to 'char [7]'
LCD_Big_Font_01.ino: In function 'void LcdUploadUdef5x8(int, int*)':
LCD_Big_Font_01:155: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01.ino: In function 'void printOneNumber4(uint8_t, byte)':
LCD_Big_Font_01:194: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:200: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:206: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:212: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01.ino: In function 'void bigNum4(long unsigned int, byte, int)':
LCD_Big_Font_01:250: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:251: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:252: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:253: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:254: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:255: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:257: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:258: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:259: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:260: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:261: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:262: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:264: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:265: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:266: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:267: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:268: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:269: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:271: error: 'class LiquidCrystal_I2C' has no member named 'commandWrite'
LCD_Big_Font_01:272: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:274: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
LCD_Big_Font_01:276: error: 'class LiquidCrystal_I2C' has no member named 'printIn'
'class LiquidCrystal_I2C' has no member named 'commandWrite'
***********************************************************************
Using post #11

Quote
#include <LiquidCrystal_I2C.h>
Arduino: 1.6.5 (Windows 7), Board: "Arduino/Genuino Uno"

In file included from D:\ArduinoLib\libraries\LiquidCrystal/LiquidCrystal_I2C.h:35:0,
                 from LCD_Big_Font_02.ino:1:
D:\ArduinoLib\libraries\LiquidCrystal/LCD.h: In function 'void loadchars()':
D:\ArduinoLib\libraries\LiquidCrystal/LCD.h:513:9: error: 'void LCD::command(uint8_t)' is private
    void command(uint8_t value);
         ^
LCD_Big_Font_02:115: error: within this context
LCD_Big_Font_02:118: error: call of overloaded 'write(byte [8])' is ambiguous
LCD_Big_Font_02.ino:118:27: note: candidates are:
In file included from D:\ArduinoLib\libraries\LiquidCrystal/LiquidCrystal_I2C.h:35:0,
                 from LCD_Big_Font_02.ino:1:
D:\ArduinoLib\libraries\LiquidCrystal/LCD.h:479:19: note: virtual size_t LCD::write(uint8_t) <near match>
    virtual size_t write(uint8_t value);
                   ^
D:\ArduinoLib\libraries\LiquidCrystal/LCD.h:479:19: note:   no known conversion for argument 1 from 'byte [8] {aka unsigned char [8]}' to 'uint8_t {aka unsigned char}'
In file included from D:\ArduinoLib\libraries\LiquidCrystal/LiquidCrystal_I2C.h:32:0,
                 from LCD_Big_Font_02.ino:1:
D:\Programs\Arduino\IDE\hardware\arduino\avr\cores\arduino/Print.h:49:12: note: size_t Print::write(const char*) <near match>
     size_t write(const char *str) {
            ^
D:\Programs\Arduino\IDE\hardware\arduino\avr\cores\arduino/Print.h:49:12: note:   no known conversion for argument 1 from 'byte [8] {aka unsigned char [8]}' to 'const char*'
LCD_Big_Font_02.ino: In function 'void printbigchar(byte, byte, byte, byte)':
LCD_Big_Font_02:127: error: call of overloaded 'write(byte [3])' is ambiguous
LCD_Big_Font_02.ino:127:33: note: candidates are:
In file included from D:\ArduinoLib\libraries\LiquidCrystal/LiquidCrystal_I2C.h:35:0,
                 from LCD_Big_Font_02.ino:1:
D:\ArduinoLib\libraries\LiquidCrystal/LCD.h:479:19: note: virtual size_t LCD::write(uint8_t) <near match>
    virtual size_t write(uint8_t value);
                   ^
D:\ArduinoLib\libraries\LiquidCrystal/LCD.h:479:19: note:   no known conversion for argument 1 from 'byte [3] {aka unsigned char [3]}' to 'uint8_t {aka unsigned char}'
In file included from D:\ArduinoLib\libraries\LiquidCrystal/LiquidCrystal_I2C.h:32:0,
                 from LCD_Big_Font_02.ino:1:
D:\Programs\Arduino\IDE\hardware\arduino\avr\cores\arduino/Print.h:49:12: note: size_t Print::write(const char*) <near match>
     size_t write(const char *str) {
            ^
D:\Programs\Arduino\IDE\hardware\arduino\avr\cores\arduino/Print.h:49:12: note:   no known conversion for argument 1 from 'byte [3] {aka unsigned char [3]}' to 'const char*'
within this context

david_prentice

Using the code from message #11,   I ran it on my 20x4 I2C display.
Code: [Select]

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2,  1,  0,  4,  5,  6,  7,  3, POSITIVE);  // .kbv constructor for I2C

byte custchar[8][8] = {
    {
        B11111,
        B11111,
        B11111,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000
    }, {
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B11111,
        B11111,
        B11111
    }, {
        B11111,
        B11111,
        B11111,
        B00000,
        B00000,
        B11111,
        B11111,
        B11111
    }, {
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B01110,
        B01110,
        B01110
    }, {
        B00000,
        B00000,
        B00000,
        B01110,
        B01110,
        B01110,
        B00000,
        B00000
    }, {
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000
    }, {
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000
    }, {
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000
    }
};

byte bignums[10][2][3] = {
    {
        {255, 0, 255},
        {255, 1, 255}
    }, {
        {0, 255, 254},
        {1, 255, 1}
    }, {
        {2, 2, 255},
        {255, 1, 1}
    }, {
        {0, 2, 255},
        {1, 1, 255}
    }, {
        {255, 1, 255},
        {254, 254, 255}
    }, {
        {255, 2, 2},
        {1, 1, 255}
    }, {
        {255, 2, 2},
        {255, 1, 255}
    }, {
        {0, 0, 255},
        {254, 255, 254}
    }, {
        {255, 2, 255},
        {255, 1, 255}
    }, {
        {255, 2, 255},
        {254, 254, 255}
    }
};

void loadchars() {
    for (int i = 0; i < 8; i++)
        lcd.createChar(i, custchar[i]);
    
/*    
    lcd.command(64);
    for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++)
            lcd.write(custchar[j]);
*/
    lcd.home();
}

void printbigchar(byte digit, byte col, byte row, byte symbol = 0) {
    if (digit > 9) return;
    for (int i = 0; i < 2; i++) {
        lcd.setCursor(col, row + i);
        for (int j = 0; j < 3; j++) {
            lcd.write(bignums[digit][i][j]);     //.kbv add the [i]
        }
        lcd.write(254);
    }
    if (symbol == 1) {
        lcd.setCursor(col + 3, row + 1);
        lcd.write(3);
    } else if (symbol == 2) {
        lcd.setCursor(col + 3, row);
        lcd.write(4);
        lcd.setCursor(col + 3, row + 1);
        lcd.write(4);
    }

    lcd.setCursor(col + 4, row);
}

void setup() {
    lcd.begin(20, 4);           //.kbv add the begin()
    pinMode(13, OUTPUT);
    loadchars();
    digitalWrite(13, 1);

    printbigchar(0, 0, 0);
    printbigchar(1, 4, 0);
    printbigchar(2, 8, 0);
    printbigchar(3, 12, 0);
    printbigchar(4, 16, 0, 1);
    printbigchar(5, 0, 2);
    printbigchar(6, 4, 2);
    printbigchar(7, 8, 2);
    printbigchar(8, 12, 2);
    printbigchar(9, 16, 2, 2);
}

void loop() {}


Note that I used the Fmalpartide library and had to amend the code in three places (marked with .kbv)

It does not look very attractive.

The code from message #7, 8, 9 requires a lot of mangling to work with regular libraries,   but the pictures in #7 look quite pleasant.     I cannot access http://code.google.com/p/multidisplay/source/browse/trunk/work_designer2k2_03/bigfont.pde

If I could access that site,   it should be be fairly straightforward to get the sketch running on your display.

David.

marco_c

In case you are interested, I have a 'big font' (double height really) for numbers in a sketch on my arduino libraries codeplex site (see links below).
Arduino Libraries http://arduinocode.codeplex.com
Parola for Arduino http://parola.codeplex.com
Arduino++ blog https://arduinoplusplus.wordpress.com

Vaclav

It does not look very attractive.

I second that, also "as is" you would have max 4 digits clock - each digit takes 2 lines by 4 blocks.
Six digit clock just does not fit into 20 x 4 LCD.
But I would suggest this as a "school project"  - bouncing clock AKA  the old and original "ping pong game".
I think it would be more of a challenge than the common "push button and blink LED" stuff.
"Thunder is good, thunder is impressive; but it is lightning that does all the work"
Mark Twain

I do not read nor respond to thunderous posts.

Woody130

I have build an NMEA display with an Arduino Nano. I used the code to print big fonts from whosawhatsis in this topic: http://forum.arduino.cc/index.php?topic=44427.0#11. I changed some code, to print dashes and commas. I used it with a 16x4 lcd. Here is my code.
Code: [Select]
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte custchar[8][8] =
{
 {
   B00000,
   B00000,
   B00000,
   B00000,
   B00011,
   B01111,
   B01111,
   B11111
 }, {
   B00000,
   B00000,
   B00000,
   B00000,
   B11000,
   B11110,
   B11110,
   B11111
 }, {
   B00000,
   B00000,
   B00000,
   B00000,
   B11111,
   B11111,
   B11111,
   B11111
 }, {
   B11111,
   B01111,
   B01111,
   B00011,
   B00000,
   B00000,
   B00000,
   B00000
 }, {
   B11111,
   B11110,
   B11110,
   B11000,
   B00000,
   B00000,
   B00000,
   B00000
 }, {
   B11111,
   B11111,
   B11111,
   B11111,
   B00000,
   B00000,
   B00000,
   B00000
 }, {
   B11111,
   B11111,
   B11111,
   B11111,
   B11100,
   B11000,
   B10000,
   B00000
 }, {
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000
 }
};

byte bignums[13][4][3] =
{
 {
   {0,   2,   1},
   {255, 254, 255},
   {255, 254, 255},
   {3,   5,   4}
 },{
   {2,   1,   254},
   {254, 255, 254},
   {254, 255, 254},
   {5,   5,   5}
 },{
   {0,   2,   1},
   {0,   2,   255},
   {255, 254, 254},
   {5,   5,   5}
 },{
   {0,   2,   1},
   {254, 2,   255},
   {254, 254, 255},
   {3,   5,   4}
 },{
   {2,   254, 254},
   {255, 2,   2},
   {254, 255, 254},
   {254, 5,   254}
 },{
   {2,   2,   2},
   {255, 2,   2},
   {254, 254, 255},
   {5,   5,   4}
 },{
   {0,   2,   1},
   {255, 2,   1},
   {255, 254, 255},
   {3,   5,   4}
 },{
   {2,   2,   2},
   {254, 2,   255},
   {254, 255, 254},
   {254, 5,   254}
 },{
   {0,   2,   1},
   {255, 2,   255},
   {255, 254, 255},
   {3,   5,   4}
 },{
   {0,   2,   1},
   {255, 254, 255},
   {3,   5,   255},
   {254, 254, 5}
 },{
   {254, 254, 254},
   {254, 254, 254},
   {254, 254, 254},
   {6,   254, 254}
 },{
   {254, 254, 254},
   {2,   2,   2},
   {254, 254, 254},
   {254, 254, 254}
 },{
   {254, 254, 254},
   {254, 254, 254},
   {254, 254, 254},
   {254, 254, 254}
 }
};

void loadchars()
{
 for (int i = 0; i < 8; i++)
 {
     lcd.createChar(i, custchar[i]);
 }
}

void printbigchar(char digit, byte col)
{
  char chars [] = "0123456789.- ";
  int offset = -1;
  for (int i=0; i<strlen(chars); i++)
  {
    if (chars[i] == digit)
    {
      offset = i;
      break;
    }
  }
  if (offset < 0)
  {
    return;
  }
  for (int i = 0; i < 4; i++)
  {
    lcd.setCursor(col, i);
    for (int j = 0; j < 3; j++)
    {
      if (digit == '.' && j == 1) break;
      lcd.write((byte)(bignums[offset][i][j]));
    }
  }
}

void printbigbuffer(char *buffer)
{
  for (int i=strlen(buffer)-1; i>=0; i--)
  {
    printbigchar(buffer[i], (i + 1) * 4 + 1);
  }
}

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy