Close
0%
0%

pi2hd44780

Make a compact USB attached character display using a Pi Zero and any HD44780 based display module.

Similar projects worth following
I've accumulated quite a pile of displays from discarded laser printers. (If you don't have one of these displays you can easily find them for under three dollars new, with free shipping to the US!) While pondering this I realised that the Zero and the displays are almost the same size: they should make a tidy little package when combined!

It turned out to be easy to build. You can even make it into a universal USB connected display, writing to it as if it was a flash drive.

I picked the GPIO's used to make wiring simple and also have a nice look. Here's the wiring diagram: crossed lines are NOT connected together:

Solder the wires (I used 24 gauge solid wire salvaged from a telecom closet at work), the resistor, and the capacitor onto the display (per the diagram) and bend them to look like this:

Here's a detail on how I mounted the capacitor. It was a tight fit:

Slip some insulating tubing on the 5V, RS and R/W wires like this:

Then put the Zero on top and solder it on. It should look like this when you're done:

Finally use some hot glue or silicone caulk under the connectors to support the other edge. Don't get any on the processor chip:

Here's what it looks like from the back. Quite a tidy little package indeed!:

And here's what it looks from the front. Bonus points if you recognize the movie reference:

THE SOFTWARE

There's plenty of code for driving the display from Python, but I decided to write a proper kernel module. Mostly because I enjoy writing modules, but also because I don't want to learn Python. It really wasn't hard, just a variation on one of my existing modules. The only problem I had was this particular display is configured kind of funny: It's a single line display, but must be initialized as two line. Then, to write to the right half of the display you must jump ahead 40 character positions. (I remember reading about this in the past, but when I went looking I couldn't find the reference, so I can't credit it.) This wasn't hard to handle in the module once I realized what was needed. It just took a little trial and error to figure it out.

THE KERNEL MODULE

Don't be afraid of compiling modules: my modules page has easy instructions. Module source is in this project's files sub-page. Module compile and usage is straightforward. Once the module is loaded there will be a /dev/hd44780 device which you can write to. All character values are passed directly to the display to make special character display possible. The display is cleared and the write address is set to the first character each time the device is opened.

The kernel module can be easily altered to drive other HD44780 displays with different numbers of lines and/or different line lengths. There are comments in the source that should point the way. If you've modified the kernel module and are using a two line display, you'll have to pad the first line with spaces to write to the second line.

Adjustable contrast is obtained by using the PWM0 output (use the gpio utility to set a value), although my particular display ignores the contrast setting.

MAKING A USB DISPLAY

I used Linux's gadget mode to make the Zero emulate a flash drive, backed by an image file. Basic instructions are here. I then wrote a small shell script that periodically read-only mounts the image file and copies the contents of the display.txt file to the display device. To use it you plug the assembly into a computer using a micro USB cable and edit the display.txt file on the emulated flash drive to change what shows up on the display. The assembly is back-powered via the USB cable, so no power supply is necessary. That's it - one display unit, one cable, any computer!

REFERENCES

A HD44780 kernel module which I studied while writing my module.

HD44780 wikipedia entry

HD44780 Datasheet

pi2hd44780.ko

Compiled module for Raspbian 2016-11-25

ko - 8.00 kB - 12/29/2016 at 19:58

Download

pi2hd44780.c

kernel module source

x-csrc - 5.80 kB - 12/29/2016 at 19:58

Download

View all 5 project logs

Enjoy this project?

Share

Discussions

tanooki2002 wrote 05/22/2016 at 03:21 point

Lol HAHAHA  "PC Load Letter??  WTF is a PC Load Letter??"  Love the Office Space reference. LOL

  Are you sure? yes | no

Eric Hertz wrote 03/17/2016 at 18:14 point

Man, I'm almost certain I wrote this before, but maybe not... I dig the idea of how this "peripheral" is basically completely driver-less, any OS could handle updating a file called "display.txt" with basically nothing more than a Shell/Batch script. Awesome.

  Are you sure? yes | no

mincepi wrote 03/18/2016 at 18:55 point

I came up with this idea in the middle of the build. I was quite pleased with myself. Then a couple of weeks later I read this: https://hackaday.com/2016/03/11/microchips-publishes-usb-mass-storage-loader/. Oh well.

  Are you sure? yes | no

Eric Hertz wrote 03/19/2016 at 22:28 point

Yeah, I saw that article right after I (thought I) commented here... same order-of-events. 

Seems to me like you've every right to be proud of your idea. The technique's definitely worthy of being used for countless other things!  I know it doesn't help pay the bills, but you'll always remain *the* inventor of the idea, to me! (Also, I really dig your bent-pin/resistor mounting-methods...)

Maybe consider yourself a bit like Tesla, and Microchip a bit like Edison? :)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates