After my successes with scanning knobs and building a Knob class, I realized that my choice of a 2×16 character LCD was going to be insufficient for my device. With such a small display, I can only display the names and values of 4 items. Furthermore, those 4 items are shown edge-to-edge on the display, meaning that there is no blank space between the control names. For example, if I mapped the 4 knobs to Distortion, Filter Width, LFO Depth, and Delay Time, the screen would read something like this:
DistFltWLFODTime
As you can see, having some visual space between these names would be very helpful, especially since I have to resort to short 4-character names for everything.
Since the 2×16 display was so easy to connect and use, I decided to purchase a larger 4×20 character display. With 4 lines, I can display 8 items on screen: 4 knobs across the bottom of the screen and 4 buttons across the top! Furthermore, because the screen is 20 characters wide, I can now put a space between each item on the screen.
The display arrived yesterday and I plugged it into the Arduino and fired up my Knob class program to see if this was just a drop-in replacement. Nope–the display wouldn’t respond to anything. This wasn’t entirely unexpected–displays from different manufacturers will likely have different interface and communication requirements. This is typically solved by finding the appropriate library to attach to the code.
And this is where things started to suck. I could not find any library that seemed to be made for my display or, conversely, any indication of the libraries with which my display is compatible. I found about 5 different LCD libraries all with different quirks. Yet NONE of them worked. I was getting pissed.
After messing with it the rest of the night and having no success, I left it and went to bed. I was smoldering over it all day in the back of my mind at work so I immediately dove back in when I got home. On a hunch, I decided to hook up some pull-up resistors to the data pins and–Voila!–the display started responding to my program! Frickin’ pull-up resistors…why didn’t they just build them into the module to start with?
Anyway, as an experiment (and to prove that the pull-up resistors were the solution), I decided to pull the resistors out and just connect the display directly to the Arduino. Much to my surprise, it still worked! Now I’m thinking that it wasn’t the resistors, but maybe a slight difference in the code compared to the previous night.
Well, since I was having to use a new LCD library, I decided to hook up the old 2×16 display to see if it was compatible with this other LCD library (attaching only one library instead of two would save program memory). Much to my disappointment, the original display did not work with this new library. I guess I’ll need both installed.
Having all questions answered, I hooked the 4×20 display back up again to start experimenting…and it didn’t work. WTF!!! This was just working! I double-checked that I was running the same code as before. I double-checked my connections. Everything seemed fine, yet no display.
After trying to swap pins a few times, I noticed that the LCD backlight would sort of flicker as I touched certain jumper wires. This indicated to me a faulty connection. I then broke out my soldering iron and proceeded to solder wires between the new LCD and a set of headers–these headers plug into the Arduino nice and tightly for a good connection. Much to my relief, the display now works!
So, this means I was bashing my head all night last night simply because I had a poor connection between the Arduino and the LCD. And when it was working earlier, it seems I’d merely gotten lucky in that all the jumpers were making good contact at the time (thank God for that happy accident, otherwise I probably would have never thought to try wiring up directly). As I was taught, that’s usually one of the first problems in troubleshooting: Is it plugged in? While it looked like it was, electrically it was not.
Anyway, it’s all good now. I’ve got two LCDs, one big and one small, that are both blue with white writing. I can use them both in the same project since they connect to the I2C bus and have different addresses.
So I’m back up and running again! Next task: reading endless analog pots! I should also try the DIN Sync out soon…
Leave Your Response