Create Custom Animations on 16x2 LCD Displays

Introduction: Create Custom Animations on 16x2 LCD Displays

The LiquidCrystal library makes it easy to use LCDs with Arduino. A particularly interesting function from that library is the createChar() function: you can create custom glyphs (characters), each described by an array of eight bytes, one for each row. The five least significant bits of each byte determine the pixels in that row. Writing bytes by hand to create art is not exactly an artist's ideal process, so I have made a web tool in which you can draw the glyphs, and the code is generated for you.

In this article I will show how to create custom animations having only just any Arduino board and an LCD - which you can use to create a whole lot of projects: you can make a game, or a short story, or a music video, or decorate a status panel.

Supplies

  • any Arduino board
  • any LCD display in size 16x2 that is compatible with the Hitachi HD44780

Step 1: Connecting the LCD to the Arduino

Connect the LCD to the Arduino as shown in the schematic.

Step 2: Creating Art

Go to the tool at https://tusindfryd.github.io/screenduino/ and create your art. Up to 8 sections can be used at once, so if you cannot select a new square, make sure you're not using 8 sections already.

Step 3: Generating the Code

When you're done with your first image, uncheck the box "just the function". Copy the code to clipboard and upload it onto your Arduino. At this point you should see your image on the LCD - pretty neat, right?

Step 4: Making More Frames

Make sure your code is saved. You can now create the second frame. Just draw another image. When you're done, check the box "just the function". Copy the function and paste it at the end of your code. Rename the new function to something else - like image01(), so that you can keep track. Now you will need to move the call to image() from the setup() function to the loop() function, add a delay, call image01(), and add a delay again. Consider renaming image() to image00() for consistence. Your loop() function should look something like this:

void loop()
{
image00();
delay(250);
image01();
delay(250);
}

Upload the sketch onto your Arduino. Try adding more frames or changing the delay time.

Step 5: Here's an Example Animation: a Butterfly Metamorphosis

First Time Author Contest

Participated in the
First Time Author Contest

Be the First to Share

    Recommendations

    • Make it Real Student Design Challenge #3

      Make it Real Student Design Challenge #3
    • Arduino Contest

      Arduino Contest
    • Box Challenge

      Box Challenge

    6 Comments

    0
    Moses_94_110
    Moses_94_110

    4 months ago on Step 1

    good work. with this we can make scrolling sentneces.

    0
    tusindfryd
    tusindfryd

    Reply 4 months ago

    Thanks! Scrolling is actually implemented in the LiquidCrystal library (the scrollDisplayLeft() and scrollDisplayRight() functions). But I hope you'll find it useful anyway :)

    0
    Penolopy Bulnick
    Penolopy Bulnick

    4 months ago

    This is neat! Thanks for sharing :)

    0
    tusindfryd
    tusindfryd

    Reply 4 months ago

    Thank you!

    0
    Doug Paradis
    Doug Paradis

    4 months ago

    Great character generation tool, very cool!

    0
    tusindfryd
    tusindfryd

    Reply 4 months ago

    Thank you!