While digging through a box of parts, I came across an old CrystalFontz 632 (16×2) intelligent serial LCD display. With all the recent work I’ve been doing with Arduinos and Raspberry Pis, I thought it would come in handy. Most LCD displays designed to work with Arduino require quite a few I/O pins (more than I’d care to sacrifice for most projects), so I thought a nice serial LCD would be a lot better since I could just use 1 or 2 pins and the SoftwareSerial library to control the display.
Like I said, this thing is pretty old. I think I bought it sometime back in 2000 maybe. I used to use it with some software package that had “driver” that talked to the display. The software would monitor things like fan speeds, CPU speed, temperatures, utilization, etc and spit them on the LCD. The software was unreliable and had to be constantly re-launched. Eventually I got frustrated with it and gave up. But I kept the display. I found it with some light corrosion on the bracket it was mounted to and a serial cable still attached to it that had the end cut off.
I noticed the pin header on the back that is used to provide power indicated that it just needed 5V DC. Hmmmm…. should be easy to test then. So I took an old power supply hooked it up and…. voila! The screen lit up and displayed its firmware bootscreen then cleared and displayed a blinking cursor. Awesome. I’m in business.
So I dug out an Arduino Uno and started writing a test sketch. I honestly had no idea how to interact with this thing, but I just figured I could probably just start out by sending some text to it and see what happens. No luck. I sent “Hello, World!” using the print() method of the SoftwareSerial library and it just produced garbage. At least it received the data I guess.
I tried using different BAUD rates to no avail. Eventually, I realized that maybe I needed to send the data byte-encoded or I probably needed to send some kind of command to it before I could use it properly. I noticed there are solder pads on it for an SPI connection and wondered if I’d have better luck using SPI instead. I decided not to get ahead of myself, so I went to the CrystalFontz website, which as of this writing was still up. Joy! I was happy to see they were still in business. And to my amazement, they still had specs and datasheets for this display. So I downloaded the manual for the 632/634 series. The only difference between the 634 and the 632 is that the 632 is 2 row, 16 column and the 634 is 4 row, 20 column. Other than that, the command set is the same for both. As I started reading the manual, I discovered that when using logic level serial (such as with the Arduino), there are some jumpers (well… solder pads) that need to be connected. Specifically, I needed to close jumpers JPB (RS-232 data inverted) and JPE (DATA_IN is 0v to 5v swing).
So I soldered those 2 connections and tried again. BAM! No we’re getting somewhere! Then I realized that every time I restarted the Aduino, it appended the text to the previously printed text and ran off the display. Yeah…. I gotta keep reading. So I got to the section describing the command set. As I assumed, they were all just byte values representing ASCII commands. For example \0001 (or Control A) sends the cursor to it’s home position (upper left-hand corner or row 0, column 0). So I tried some commands out and eventually got to where I could print text on both lines of the display, clear the screen, print some more stuff, turn the backlight on and off, etc. I had a lot of fun experimenting with it, and then decided I could just write a library to do all the heavy lifting for me.
I googled around and searched github first, just to make sure I wasn’t trying to re-invent the wheel and didn’t find much on using the CrystalFontz displays with Arduino and more importantly, did not find any libraries written to do the work (although I did find a couple guys had worked with them and wrote some demo sketches). So I wrote my library and some test sketches and tried them out. It all worked beautifully! So I decided to publish my library to github, but first I should probably test it in a live installation in a production environment. That’s when I ran into problems.
It all worked fine until I installed the library into the actual Arduino libraries folder and tried to run a test sketch. I got a bunch of weird compiler and linker errors. So I googled around and came across this post and this article and came to the conclusion that because of the “Arduino Magic” and the way the linker works, you have to include BOTH my library and the SoftwareSerial library in order to get your sketch to compile EVEN THOUGH the SoftwareSerial library is already included in mine. Lame.
Aside from that caveat, it is a pretty robust library and provides almost the entire functionality of the 632/634 command set including drawing bar graphs, controlling brightness and contrast, scrolling, wrapping, etc. And the best part is, you can control MULTIPLE displays from a single Arduino. You only need a single I/O pin for each display (2 if you also want to control the backlight). You can get it here.
It has low memory usage (estimated 128 bytes), but is a whopping ~5K in size, so keep that in mind if you are working with a large sketch and are pressed for space. Of course, you can always just fork the library and strip out the parts you don’t need if you need to reduce its footprint.
Leave a Reply
You must be logged in to post a comment.