One of the first things I bought to use with my arduino was a 2×16 character display, specifically this one from Adafruit. Playing with it was fine, but after looking at the interface to the LiquidCrystal library I decided to see if I could abuse it by making it into a cheap-o Etch-a-Sketch.
Stage 1 of this project worked fine, and was actually a bit of fun (although it was kind of cheating – I’m supposed to be challenging myself with hardware, and this was really all just programming). I knocked up a couple of trimmers to use as the knobs, whipped up some modulo arithmetic, and I turned my 16×2 character display into a 80×16 pixel display.
Here’s a not-great video of the result:
Next I wanted to make drawing persistent, to be able to actually draw. Seemed simple enough – I had been building custom characters on every update, with the current x,y bit turned on, then writing that char to the correct x,y character position. All I should have to do it maintain an array of characters. Then on each iteration when I set the x,y position, it’s an update, not an entirely new character. Then when I write the character out, I’ll get the entire state for the board.
Unfortunately, this exposed a pretty fundamental misunderstanding I had of the character displays. I assumed that since I was only updating a single “character” at each loop, all the characters I wasn’t touching would just stay put. However, when I re-create the custom character at each loop, that also updates every place on the display that was showing that “character”. It actually looks fairly interesting as, over time, multiple characters on the screen start to come to life and start changing in sympathy with each other. Cool, but not at all what I wanted.
This failure completely makes sense as I think about it. Since the LiquidCrystal library only supports 8 unique custom characters I can’t make use of the whole screen just through the standard library. It’s possible that the 8 character limitation is arbitrary and that I could raise it by mucking around in the library, but that doesn’t sound like that much fun.
There are a couple of possible next steps I could take here:
- Just to show the core of what I wanted to do, use the 8 custom characters I get from the LiquidCrystal library to make a 2×4 character (16×20 pixel) display. I will probably do this and take a video of it just to have done it. One of the original goals in this project was to just make anything that I wasn’t copying from someone else. Ideas include a write/erase function, “status” lights, an “invert” button, a non-state-changing cursor, basically anything to take up a pin on the Arduino. Now that I write this down and remember what my goal was, I’ll probably do this no matter what
- I could track down the LiquidCrystal library and understand what the root of the 8-custom-character limit is. If it’s an arbitrary software limit, maybe raise it and recompile. If it’s not arbitrary but due to memory, maybe make a custom version of the library in which some standard characters are missing, allowing me to use their memory space for more custom chars. I doubt I do this anytime soon, but if I decide to play around more with Arduino libraries, this might be a fun platform to learn more about them.
- If the limit on the number of custom characters turned out (somehow) to be hardware based, then I could skip the LiquidCrystal library altogether and see if I could somehow force the hardware to do what I want if I give up on the need for standard characters. I think the only way I would do this is if I actively needed to learn about the LCD chipset’s low level use for some other reason.
- There’s a strong possibility that I may bag everything above because I had an idea for a new project that I want to get working using my Arduino. Since this is the most interesting thing I’ve made that I haven’t copied form someone else, I should take this opportunity to think about how I will store project information. I’m not fond of the Arduino dev environment’s file system layout requirements and concessions I have to make to it to use SVN, but I do have this sketch in SVN. Need to lean more about creating and storing schematics. Can I store them with the Arduino sketch without the Arduino software complaining? What’s the best software to use? Right now I just want to sketch something out that I can use to recreate the circuit later, and that I can put in version control. ASCII art would work right now, but I wonder if there’s an advantage to finding more specific software this early in my learning cycle…
Right. Disappointed that my original idea didn’t work, but still plenty to learn in that list above. I wonder if I can get 1 and 4 done while waiting for parts for NewProjectIdea?