Serial LCD Display for Imp+Hannah

Hi all, I’m working to turn my Hannah/Imp into a weather device that reads the temperature using the temp sensor, and displays that, along with the day’s high/low on a small LCD screen (and hopefully sunrise, if we can get the light sensor working), and tweet this info once a day.

I’m pretty sure I can handle the code–connecting the LCD screen is the tough part for me.

I’m planning to grab this screen:

It’s 3.3v, and has a Serial Backpack so I should be able to easily connect it to the Hannah, right? I already have this same screen without the Serial Backpack, but I’d need a lot more code and a lot more wires to connect it, correct?

In short, I’d like to know if this screen could be easily connected to the Hannah, as well as some suggestions for wires/connectors.

Once I get the LCD, I’ll post my agent/device code, as well as my Xively feed, so you guys can know what the weather is like here :slight_smile:


I like to use serial backpacks, you only need to use one pin on the Imp to program it. I have used both Adafruit serial backpack, and Sparkfun backpacks. The Adafruit versions are intended for 5V, so I have added a boost circuit to my projects with them to get really good contrast. Some of the 5V LCDs will run on 3.3V, and can be viewed if you adjust the contrast.

Here is the code that I use for the Sparkfun backpack: (Might be on the e.imp page too.)

I’ve also been using that as an example to create code for the Adafruit backpack, and I need to tidy it up and post it… If you follow the Arduino example on the Adafruit tutorial, it isn’t hard to see what to do.

Just connect the data line on the backpack to pin 5 and configure uart as shown in the code… it’s pretty straightforward.

Also, the Adafruit Arduino enclosures have an LCD knockout, and are easily modified to work with other boards. I like them for projects with LCDs. Wish there were more options for nice project enclosures.

I also recommend the Adafruit Serial Backpack RGB LCDs - got them working via a Sparkfun level converter for 5v that the display needs.

I asked Adafruit about making a converter themselves…the response I got was just to tweak the contrast, but I didn’t find that to be sufficient, so I’ll keep using a boost for 5V. I will say that the Adafruit backpacks are a little bit larger, so if space is a big concern, the Sparkfun board might be better, but the Adafruit board does a bit more…

Would the LCD I posted not work well because it’s at 3.3V?

Anything that runs at 3.3V should work great with the Electric Imp, and I believe that Sparkfun’s serial LCDs actually run at 3.3V even though they are marked 5V on the board. If you want to run the Adafruit 5V boards with the Imps 3.3V, it seems to communicate just fine, but you need 5V to properly power it and get good contrast. (In my opinion).

I have the Sparkfun LCD you posted, and it works just fine. You should be able to use the code from the GitHub link I posted with no issues.

Awesome, thanks @jwehr, appreciate the help. It’ll arrive in a few days, and I’ll incorporate your code along with my own.

Looking at a display that looks like this–it’s gonna be cool:
Temp: 70.1F. Time: 8:00AM
Hi: 90F/Low 50F. (Rain/Clear)

Unfortunately, those 16 characters get used up very quickly. I use 16x2’s in my thermocouple temperature monitor projects. Ive been looking at 128x128 character version, but they are expensive.

Also, the code is from GitHub user asm, I’ve forked it, but I can’t take the credit. I will be posting code for the Adafruit LCDs.

20x4s are nice affordable step ups from 16x2s

ie. Sparkfun serial 20x4:


@jwehr where would I connect the pin on Hannah?

I haven’t used the Hannah, but I assume you can still assign all six pins the way you normally would, even with the expansion chips. If you look at the pin mux…

…you can see that you are able to configure uart12, or uart57. If you configure uart12, then pin 1 is your transmit pin, and with uart57, pin 5 is your transmit pin. Either will work just fine, you just need to assign one that works for your circuit. Also, like I said, I’ve found that the Sparkfun LCDs with backpacks can be powered and read with 3.3V, but the Adafruit LCDs like 5V for really good contrast. Your results may differ. I use a 5V boost circuit to get there.

… and I still need to polish up that code for the Adafruit backpack, unless someone else already has.

Here is the code I have so far, most of the core functionality works, but it needs to be completed. You can set brightness, contrast, and write to the screen. The original code is from GitHub user ASM, who wrote code for the Sparkfun LCD backpack. I am modifying it with information from the Adafruit tutorial. Use at your own risk.

So using Hannah, I’ve configured uart57, so that means pin5 is my transmit pin. So does that mean GPIO5 (spare 15) is the correct place to connect the wire from RX on the LCD to Hannah? I’m using this code exactly:

Are you using the Adafruit serial backpack or the Sparkfun version? The code you referenced is for the Sparkfun version, and though they are very close, I don’t think you will have much success with it using the Adafruit board. I’m going to have to get someone else to verify the Hannah pin question, because I don’t know for sure, but it seems right. I’m going to try to tidy up my code for the Adafruit serial backpack soon. If you are in a hurry, reference the code that you posted with the Adafruit tutorial on the serial backpack. All of the hex codes that need to be changed are listed there for Arduino code… it is very similar.

I’m using the Sparkfun LCD–this one:

I’ve tried connecting it to several pins, but no success =/

In that case, the code on ASM’s GitHub page should work nicely. Does the LCD power up? You should see “Sparkfun” and some version stuff appear before anything else.

If you want, post the code you are using, in case we could spot an issue.