DP HD44780 LCD Backpack

A coupld of weeks ago, SeeedStudio was giving away $10 coupons with every PCB order. This was to promote their revamped service! But, because I didn’t have any design ready yet, I started looking at some interesting boards made by others. Dangerous Prototypes is quite a nice place to get such designs, and so I did!

One of their projects is an LCD backpack for the quite standard HD44780 character LCDs you can find everywhere! I saw that they were using SMD crystals, which I didn’t have. So I modified the footprint into a through hole (on a sidenote: the through hole ones are actually smaller in surface size, if you have the room at the other side of the board).

I sent the board to Seeed, and received them a week or two later! Immediatly, I noticed that my change was a mistake! I didn’t check the footprint beforehand, so the footprint was bad! My Cristals have small circular cutouts at the bottom (as to not let the case connect with these pads), and the footprint were giant oval pads. Easy fix: put some paper tape in between them and it’s functional!

After some soldering, I finished it up. I still had to figure out how the bootloader/programming stuff was done by DP. You can program the entire shebang at once with a PicKit programmer, or you could program the bootloader first, and then program it via their fancy HID program. Surely, I picked the first option.

Now that that’s all done, the device is working!! My first attempt was to use LCD Smartie on Windows. Which was up and running in no time. But at work I am working on a linux machine, so that was just a nice to have. On Linux, I was already using Popper as a mail notifier for all of my mailboxes. This is a python script that nicely integrates with Ubunutu’s notification center.

There are some pieces of software that do the LCD interfacing. But I’d have to use their API in some way, and didn’t feel like doing that. So I started scripting some python code together.

First, get PySerial installed on your system. Then you can really easily connect to your device (which will show up as a TTYACM device).
ser = serial.Serial(SERIAL_PORT, 115200, timeout=1)

Now you can start sending the commands! But that TTYACM0 device sucks somewhat, because it’s only accessible by root, and it’s possible that it could change names if you have more devices. So, we’ll have to start looking at UDEV. This deamon is running on your linux machine, and processes events related to devices. Especially the add event.

Make this new file:
/etc/udev/rules.d/60-ttyACM.rules

And add these contents:
ACTION!="add", GOTO="persistent_serial_end"
SUBSYSTEM!="tty", GOTO="persistent_serial_end"
KERNEL!="ttyACM[0−9]*", GOTO="persistent_serial_end"

IMPORT{builtin}="usb_id"
ATTRS{manufacturer}=="DangerousPrototypes.com", SYMLINK="infodisplay-001", OWNER="toon", MODE:="0600"

LABEL="persistent_serial_end"

What does this do? It checks whether a device is a TTYACM device, and has the manufacturer DangerousPrototypes.com. If this is the case, it creates a symlink to this device (a persistent name!), changes the owner to me! and changes ther permissions at the same time.

From now on, we can simply connect to /dev/infodisplay-001!

To finalize the story: Popper allows for scripts to be executed, but Popper only passes them the amount of emails that are unread. Because that’s kind of boring, I just started editing the python code. If you installed popper via apt-get (you would have to add their repository), you will find the popper python files in

/usr/share/popper/
And the log files in:
/home/_user_/.popper/

Simply overwrite the the contents of popper.py, with the ones from this PasteBin post.

You should be able to see some email stuff on your LCD now!

PS: I had to add some delay, because the ‘fading functionality’ when you turn on the LCD takes 60ms. I want to remove that feature from the source for the PIC microcontroller, but didn’t have time yet!

Share this post
Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe now
Name
Email *