A few years ago when I was developing the SkeinMinder, I was trying to figure out how to make a normal 2x16 character LCD display larger numbers. Number size is kind of important - I was building a device that would sit on a table-top, and I wanted someone standing above it to easily be able to see the rotation count at a glance, maybe even from a few feet away, without squinting. It was a small conundrum. I didn't want to delve into getting a graphic LCD up and running, I had plenty of other dev work and that seemed like a can of worms I didn't have time for. I've since developed a graphic LCD library (more on that in a future blog post), but at the time, I just wanted to keep it simple. Besides, 2x16 LCDs are plentiful and cheap, they don't require many processor pins, and the LiquidCrystal Arduino library made them easy to get up and running. But oh that fixed font!
I googled around, and found that of course I wasn't the only one who wanted to bend a 2x16 LCD to their will. I think I ran across this instructable by mpilchfamily and this post by digimike, where I learned you can load 8 custom characters into most LCDs, and then write them anytime. They used those characters to create their own big numbers, which look like this:
I liked the bold clarity of the big numbers featured in that code, but they just took up too much space for me. They're 3 columns wide x 2 rows tall, and I really wanted ones that were 2 columns wide x 2 rows tall, so I could fit some normal LCD text plus 4 digits of big numbers on the 2x16 display. Sounds like a good excuse to bust out some graph paper and develop a font, am I right?
One thing I figured out is that 8 custom characters are nice, but man, 9 would have been perfect. JUST ONE MORE would have made 4 L's to make a full zero, 1 vertical bar left, 1 vertical bar right, 1 horizontal bar top, 1 horizontal bar bottom, 2 C's to make 8's and 5's and 2's. OK, so that's actually 10, but I figured out I could live without one of the vertical bars. So that's 9. Maybe I was being too strict with my font style, or maybe I had a mental block, but I couldn't quite make a bold style without coming up one short. Time to get creative. I looked at the built-in symbols, and figured I could make a stylistic zero, using one fully lit character.
I developed 4 fonts overall, the original above I called TREK because of the square clean lines (though it's more original motion picture or DS9 than TNG). TRON incorporates one fully lit character into each number, and made me think of 80s sci-fi movie poster fonts. NASA is reminiscent of the beloved (be-hated?) worm. And then I modified NASA to be a little fancier and gave it some serifs, and that's where my sci-fi inspiration ended because I just called it SERIF. Overall, I think TREK is the cleanest, and easiest to read at a distance, but I kind of love the styling of TRON.
Cool! So I made a sweet font, implemented it for my particular purpose, and promptly forgot about it for a few years. Then I was visiting my friends at Questionable Origin, and we needed to display an estimated battery % for an electric spinning wheel that fits in a Pelican case (if the last few words just blew your mind, do click on that previous link). I busted out my old code, copied it into its own library, and came up with a new % character. At this point, I figured that Big Numbers could probably be useful to a ton of other people, so I worked on tidying it up, put it in more of a standard Arduino library format, and added the ability to handle negative numbers, as well as easily specify the position of the big number on the LCD. And added some example sketches.
It was of course a bigger project than I anticipated, mostly because I wanted it to handle some situations intelligently. I feel that the "-" sign should appear and disappear without the number itself shifting left and right (too distracting). I also feel that there should be inherent leading zero blanking (though if leading zeros are useful in your application, it's easy to comment out the few lines of zero-blanking code). I also thought you should be able to send it just a number and have that number appear in the same place every time without having to specify position, but also be able to override the defaults and place a number in a specific position. A few overloaded functions later, I give you BigNums2x2. It should also be picked up by the Arduino library bot shortly.
I hope you find it useful and easy to use! I'd love to see what you make using the library, please give me a shout-out on instagram @alpenglowyarn and #bignums2x2. And of course, let me know if you encounter any bugs.
Read the Comments or Leave one