Phi_super_font
Introduction:
The Phi_super_font library utilizes 5 X 7 dot matrix technique I developed to display characters 40 times the size of ordinary characters seen on HD44780-compatible character LCDs. You will need all four rows and 5 columns to display one character (with one column blank to separate characters). A 20*4 display can display 4 characters packed together. You can display the characters anywhere you want. Make an animation if you want. The most recent release is compatible with Arduino IDE 1.6.0
Background:
After some requests and inquiries on arduino forum, I decided to make big fonts for character LCDs, not just numbers, as seen in some examples, but numbers, and characters, so you can display a few large characters and see them from say 10 feet away. With the request from my blog reply, I pushed the envelop a bit more and developed super font to further increase the size of the characters to fully use 20X4 display areas.
I initially made phi_big_font. Read this page with videos. I was successful so I pushed for super font.
After some more work, now I present you phi_super_font library.
What it does:
- Display super-sized characters including all A-Z, a-z, 0-9, and symbols
- Display them anywhere within your display (no trimming at display edges)
- Display regular or inverted fonts with inverted lcd_clear() to fill up the screen with black boxes (invert is hard to read)
- Display one character, short strings, numbers (you can format numbers into strings if you prefer)
- Display one row of dots for each character if you want (for animations)
Pictures and videos:
Here is some pictures of the font:
Here is a video:
Functions:
void init_super_font(LiquidCrystal *l);
This initializes the library. You MUST do this in your setup();
Eg.1
// in main program
LiquidCrystal lcd(7,8,9,10,11,12);
setup()
{
init_super_font(&lcd);
}
//Notice the & symbol
void invert_super_font(boolean inv);
If inv is true, all subsequent output is inverted with black background.
void lcd_clear();
Clears the LCD, except if it is inverted, fills it with black boxes.
void render_super_msg(char msg[], byte loc_x, byte loc_y);
Displays string message at screen location loc_x and loc_y (top left corner of the message). You need to supply the string AKA character array’s name to the function.
Eg.1
super_msg_lcd(“Haha”,0,0);
Eg.2
char msg=”LOL”;
super_msg_lcd(msg,0,0);
void render_super_number(int number, byte loc_x, byte loc_y);
Display a number at location supplied.
Eg.1
render_super_number(4567,0,0);
Eg.2
int x=1234;
render_super_number(x*2,0,0);
void super_msg_lcd(char* msg_line, byte loc_x, byte loc_y);
This is the same as the render_super_msg except you supply a string stored in PROGMEM.
void render_super_char(char ch, byte loc_x, byte loc_y);
This displays a character ch at the supplied location.
void render_super_char_0(char ch);
This displays the top row of a character ch at the current location.
void render_big_char_1(char ch);
This displays the second row of a character ch at the current location.
void render_super_char_2(char ch);
This displays the third row of a character ch at the current location.
void render_big_char_3(char ch);
This displays the bottom row of a character ch at the current location.
void display_img(byte [] img);
This displays a raw image of 20 wide by 8 tall on a 20 X 4 display. Each byte in the array represents a column of 2 pixels. The row order is 0, 2, 1, 3.
Eg.1
byte img1[]={
0,0,0,1,2,2,2,1,0,0,0,1,2,2,2,1,0,0,0,0,
0,0,2,1,0,2,0,1,2,0,2,1,0,0,0,1,2,0,0,0,
0,0,3,0,1,3,1,0,3,1,3,0,1,1,1,0,3,0,0,0,
0,0,0,0,2,2,2,0,0,0,0,0,2,2,2,0,0,0,0,0
};// line 0, 2, 1, 3 order.
display_img(img1); // This is the Arduino symbol, flipped left and right to avoid copyright stuff.
Downloads:
The code and examples are hosted on my library and code download page:
Installation:
First download the package, then extract the files under your Arduino Sketchbook/Libraries folder, so that the three files will be under c:/Arduino22/Sketchbooks/Libraries/phi_super_font/ (Just example, your directory may be different). Make sure you don’t have c:/Arduino22/Sketchbooks/Libraries/phi_super_font/phi_super_font/
Then close all Arduino IDE windows.
Reopen Arduino IDE, open a sketchbook you want to use the phi_buttons. Then choose under the Arduino IDE meny Sketch->Import library->phi_super_font
The Arduino IDE automatically creates a line in the beginning of your sketchbook: #include <phi_super_font.h>
OK you’re done!
Future directions:
Add symbols to the font to map HD44780 symbols such as left and right arrows, also add more symbols for physics use.
Store the font in PROGMEM
Add function to clip the display if you display outside of your screen
Pingback: Phi_super_font available « Liudr's Blog
Is possible do that in Raspberry PI with I2C ?
Well,
If you can write a program to receive command from Raspberry PI via IIC and then call the phi_super_font library, then it’s easy to do. I am not familiar with IIC program with RPI.
Great code! Thnx
i use it with 1.5.1 and it was fine! it cant work with 1.6.1! do you have a soloution? it makes several compile errors
I believe in 1.0 version IDE they have included a newer version of avr gcc. The language has some updates on PROGMEM keyword usage. Here is the new convention:
const char phi_prompt_lcd_ch0[] PROGMEM ={ 4,14,31,64,31,31,31,31,0}; ///< Custom LCD character: Up triangle with block
The old convention:
PROGMEM prog_char phi_prompt_lcd_ch0[] ={ 4,14,31,64,31,31,31,31,0}; ///< Custom LCD character: Up triangle with block
I'll get my updates this summer. Google code site that hosts my code is shutting down for good. I'm moving to github.
Hi. Is possible do that in 20×4 LCD with I2C?
Of course but you need to replace the initialization code with the I2C lcd class object instead of LiquidCrystal object. A few functions need to have their parameters changed from pointing to LiquidCrystal object to I2C LCD object and also the code should #include the I2C library header .h file. Someone has done it a while ago with some I2C lcds. It’s not too hard once you get a hang of hacking some code. Free and open source but a little donation after satisfaction is always appreciated 🙂
Arduino: 1.6.6 (Windows 8.1), Board: “Arduino/Genuino Uno”
this errors are show when i upload the Phi_super_font ——
open C:\Program Files\Arduino\libraries: The system cannot find the file specified.
Error compiling.
Invalid library found in C:\Users\User\Documents\Arduino\libraries\sketch_dec05a: C:\Users\User\Documents\Arduino\libraries\sketch_dec05a
Invalid library found in C:\Users\User\Documents\Arduino\libraries\sketch_dec05a: C:\Users\User\Documents\Arduino\libraries\sketch_dec05a
This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
Not sure what your error message means. Did you restart arduino after installing the library? Libraries should be in arduino’s sketchbook folder under libraries, not in some sketch_dec05a. Did you read the instruction on how to install?
i got this error when i try the example
Arduino: 1.6.6 (Windows 7), Board: “Arduino Nano, ATmega328”
defs.h:13: error: ‘prog_char’ does not name a type
defs.h:25: error: ‘dow_00’ was not declared in this scope
defs.h:39: error: variable ‘month_item’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
exit status 1
‘prog_char’ does not name a type
This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
I updated the library and sample code. Since google code is no longer hosting any updates, I am hosting the files now:
https://liudr.wordpress.com/libraries/download/