A few days ago I saw a post on Adafruits blog about an online tool by Bruno Maia to help create custom characters for use with character based LCD like the ones used in the last article.
The tool makes it really easy to to design characters, icons and signs, you just click on each pixel to toggle it between dark and light, and when your “character” looks right, you simply copy the code to the right and paste it into your Arduino code, and there you have your new character.
I tried to make a few different characters, as seen in the image above. If space is a little tight and you need a lot of information on screen, making special characters that combine two elements like the “degree centigrade” and “degree fahrenheit” in the image could help you out. Also signs like Ohm and micro are often useful in electronics.
Below is the code I use to draw the screen above:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // degree centigrade byte newChar1[8] = { B01000, B10100, B01000, B00011, B00100, B00100, B00011, B00000 }; // degree fahrenheit byte newChar2[8] = { B01000, B10100, B01000, B00011, B00100, B00111, B00100, B00000 }; // arrow right byte newChar3[8] = { B00000, B00100, B00010, B11111, B00010, B00100, B00000, B00000 }; // arrow left byte newChar4[8] = { B00000, B00100, B01000, B11111, B01000, B00100, B00000, B00000 }; // diameter sign (ΓΈ) byte newChar5[8] = { B00000, B01101, B10010, B10101, B01001, B10110, B00000, B00000 }; // boldface "h" byte newChar6[8] = { B11000, B11000, B11110, B11111, B11011, B11011, B11011, B00000 }; // ohm sign byte newChar7[8] = { B00000, B01110, B10001, B10001, B10001, B01010, B11011, B00000 }; // micro sign byte newChar8[8] = { B00000, B00000, B00000, B10010, B10010, B10010, B11100, B10000 }; int i = 0; void setup() { lcd.createChar(0, newChar1); lcd.createChar(1, newChar2); lcd.createChar(2, newChar3); lcd.createChar(3, newChar4); lcd.createChar(4, newChar5); lcd.createChar(5, newChar6); lcd.createChar(6, newChar7); lcd.createChar(7, newChar8); lcd.begin(16, 2); for(int n = 0; n < 8; n++) { lcd.setCursor(n*2,0); lcd.write(n); } lcd.setCursor(0, 1); lcd.print("hackmeister.dk"); } void loop() { } |
Related posts:
- 4 LCD displays on 1 Arduino I’m planning an Arduino based project where I would like...
- Programming the LCD I/O Backpack with an Arduino Since the workshop in the beginning of October, there has...
- Introducing the LCD I/O Backpack I admit, it has been a little slow for the...
Thank you for the time and effort put on making those custom characters.
I was actually looking forward on making some of those myself.
I tried the site. However it seems to be down. Any hint about if it’s been like this for some time? Wonder if you have contact with the author?
The site also seems down to me, which is too bad. I don’t have any contact with the author, I just found it really neat. I’ll try to write him an e-mail and see if he will put the site up again or maybe open source it so that others can put up the same service.
But I’m glad you like the characters that I made!
/Thomas
Umm, I’m sure the tool is handy but if it’s not available you can still figure out the arrays for yourself. One easy way is to just open notepad and create a 5×8 grid of periods and then replace periods with an X wherever you want a “filled in” dot on the display. When you’ve got the character like you want it, just change all the periods to zeroes and the Xs to ones. Those are the numbers for the arrays. Once you get the hang of it then you can skip the period/X version and just use the 0/1 version, but the ./x version can help you visualize it.
byte newChar[8] = { ..... 00000 B00000, .XXX. 01110 B01110, X...X 10001 B10001, X...X --\ 10001 --\ B10001, .X.X. --/ 01010 --/ B01010, .X.X. 01010 B01010, XX.XX 11011 B11011, ..... 00000 B00000 };