I’ve built a few Arduino based projects over the last twelve months, including an MQTT based test throughput counter and a ‘Buildosaurus’ glowing RGB model dinosaur to indicate product build health. The most complex so far is an IR remote control platform to solve an accessibility problem. I’ve used 16×2 LCD displays in several of my projects, but for the remote control power is constrained as I want to run it from a 9v cell.
Driving the display itself is not a big problem; quiescent current is the enemy. In my prototype I used an NPN transistor to manage power for the display circuit and this worked perfectly well. For the final build I went with a white on blue HD4470 compatible display – same interface therefore a straight swap. However, I wired it all up and I just see random characters displayed, nice!
I found that if I ground the R/W pin then all is fine, which is weird because the pin is already grounded via my transistor. Anyhow, not a viable solution since a connection to ground will bypass the power management. OK, this display shares the same interface, but behaves slightly differently. A while later – having changed obvious components just in case they were faulty – I stop looking at the circuit and take a look at my code:
//Power up LCD and initialize. digitalWrite(lcdPin,HIGH); lcd.begin(16,2); lcd.clear();
Seems fine to me: turn on the display (via a transistor), initialize it and start using it. I started to wonder, what if the display is not quite powered up when I call lcd.begin() ? I add a 100ms delay before the begin() call and all works fine. I’ve convinced myself why the fix works, but is the defect a hardware or software one ?
Here’s a photo of the remote, in case you were wondering what it looks like…