Controlling a HD44780 LCD on a BeagleBone (Part 1)

Hitachi HD44780 compatible LCD screens are those common displays we see all over the place. Getting them to display some information is fairly easy, as all you have to do is send the appropriate bits to each of the LCD screen inputs.

Basic 16x2 Character LCD - HD44780 compatible

In this post I will describe the steps I took to integrate a Hitachi HD44780 LCD with the BeagleBone board. First of all you need a LCD display. From my Arduino days, I had a couple of them laying around my lab. In this tutorial, I used a fairly inexpensive Microtivity LCD Module 1602. Because this LCD module requires a 5V source, and the BeagleBone GPIO pins only provide 3.3V, you need to get power from other sources: either connect a 5V DC adaptor to the BeagleBone and use P9_5 which provides +5V, or use any adapter that you have in your house to deliver the appropriate voltage with a voltage regulator. If you opt for the voltage regulator route, I recommend you get a 9V adaptor and use this neat sparkfun kit, just make sure the ground of this external voltage supply is connected to the ground pin of the BeagleBone. Of course you can bypass all these problems, by getting a +3.3V LCD display, but they will be more expensive.

BeagleBone and a HD44780 compatible LCD

Once you have acquired the LCD and connected to an appropriate power source, use the following connections.

LCD Pin # LCD Pin Description LCD Pin Connects to
1 VSS Ground
2 VDD +5V
3 VO Attach a potentiometer here to adjust contrast
4 Register Select (RS) BeagleBone pin P8_4
5 Read/Write (R/W) Ground
6 Clock Enable (E) BeagleBone pin P8_3
7 Data Bit 0 Unconnected
8 Data Bit 1 Unconnected
9 Data Bit 2 Unconnected
10 Data Bit 3 Unconnected
11 Data Bit 4 BeagleBone pin P8_5
12 Data Bit 5 BeagleBone pin P8_11
13 Data Bit 6 BeagleBone pin P8_12
14 Data Bit 7 BeagleBone pin P8_14
15 Backlight Anode (+) +5V (or lower)
16 Backlight Cathode (-) Ground

The code below will prompt you to enter a bitstream into the LCD screen. Keep in mind that you need the library beagle_gpio.h, or else the program will not compile. You can find all the necessary files to run the program in the following github site ( You can compile, and run, this code by typing the following commands in the BeagleBone terminal:

gcc -c beagle_gpio.c
gcc beagle_gpio.o example_01.c
rm -f a.out

Once the code is compiled you will be asked to type the appropriate bitstream. If you type the following bits, you will type the word “hi” on the LCD.

Type the following bitstream to display "hi" in the LCD

If you would like to manually type different characters look at the following table:

HD44780 LCD character table

… And here is a screen shot of the program output.

Screenshot of the program manually sending a bitstream to the HD44780.

Finally, if you would like to know more about controlling these LCD devices I suggest this website, and the article “How to use intelligent L.C.D.s – Part One” by Julyan llett, which can be found here.

In a future post, I will release another library that will allow us to automatically display text without manually typing the entire bitstream.


  1. i have used your GPIO-lib, and it works vevy good, now i am working at temprature sensor DS18B20. have you tryed? i have a prob and wanna ask you. that wen i init the sensor i couldnt recive the signal 0. i think it might be the function usleep(),that it can not be so high level in is my Code.

    unsigned int init_ds18b20(void)
    unsigned int dat = 5;

    set_GPIO_OUT(DQ); // set DQ as OUTPUT
    write_GPIO_value(DQ,1); //Pull up
    uslee(10); //10us delay

    write_GPIO_value(DQ,0); //PUll down
    usleep(600); //at least 480us ,here 600us

    write_GPIO_value(DQ,1); //pull up
    usleep(65); //wait 15-60us,here 65us
    set_GPIO_IN(DQ); //set as INPUT
    dat = DQ_Read(47); //read IO

    set_GPIO_OUT(DQ); //reset as OUT
    GPIO_value(DQ,1); //reset pull up
    usleep(250); // delay 250us

    return dat;

    wenn recive a 0,means success, but i just always got 1(because 4.7K pull up),is that a problem of usleep? do you have a function which in usecond works?

    • Ha. Yes, I remember having some trouble with the usleep() not being very reliable. I circumvented that by using timer interrupts. You can always check to see if the timings are correct by hooking up an oscilloscope to the GPIO pins. I should write a tutorial about that. I will add it to my future list of posts.

      • HI
        i am looking forward your tutorial, i have written some code about DS18B20, do u need it?

        • Sure… feel free to mail me the code. I’ve sent you an email with my email (not posting it here or I will get 1 million emails with SPAM with tricks on “how to increase my brains IQ by 10 points”). Right now I am working on another project… the tutorial will be a bit delayed until I am done with it.

  2. Thank u very much! i have tryed with OSC,and the time works sometimes not exact.i am looking forward to see your tutuorial.and wanna send a mail to u ,which contains of my .C and Head Files for DS18B20. would u pls leave a mailbox for me?

    greeting from Germany

  3. Hey! Thanks for your work! I wonder if you have doxgen documentation (or sth. else). (I couldn’t compile doxygen binary in an appropriate wa so it’s not working now and I am not able to generate it :) ).


  1. MAKE | How-To: LCD Controlled by BeagleBone - [...] Western New England University, has been experimenting with the BeagleBone and posted an excellent how-to guide on getting the …
  2. Controlling a HD44780 LCD on a Beagle Bone « adafruit industries blog - [...] Controlling a HD44780 LCD on a Beagle Bone via MAKE. Hitachi HD44780 compatible LCD screens are those common …