Robot Eye Expressions using LED Matrix Display

RobotEyes_IconI was exploring ways to make a future robot project more appealing and came across a number of articles about animated robotic eyes created to convey expression or mood. This looked like a bit of fun and quite achievable using the LED matrix modules that I have been playing with for a while. Here’s the result.


This project works well with all the standard LED matrix modules supported by the MD_MAX72xx library, so no special hardware is needed to run the software.

However, I decided to build a dedicated 2-module unit for the displays, as I am planning to integrate this into a mobile robot in future. The design is based on the Parola modules I designed some time ago, but this time using a surface mount version of the MAX7219 IC to make the PCB smaller. Using Eagle CAD it was a simple process to copy and duplicate the existing design to create the required circuit, shown below.


RobotEyes_BoardThe PCB footprint was designed to be the same size as the 2 LED matrix modules (at right, click to enlarge) and was manufactured at SeeedStudio’s Fusion PCB service. It took about 2 weeks from design through receiving the 10 neatly packed PCB prototypes in the mail.

The PCB was quickly populated and worked first time, as expected for this repeat design. The only issue was that the distance between the two sides of the LED matrix pins was too close and the outside pins need to be angled into the socket. Not a big deal and it does ensure that the matrices butt tightly against each other in the middle. An updated version of the Eagle CAD schematic and PCB layout files for this project can be downloaded here.

The images below show the PCB front and back, and the populated PCB with one matrix removed to show the components underneath.




An animation is a basic sequence of images that, when played one after the other as ‘frames’, convey a sense of movement. In this instance the target is to animate the images for two eyes so as to convey mood.

To simplify the software, the eye animations start from a neutral expression (ie, eyes open looking forward) and progress through a series of intermediate frames to the main frame that conveys the desired ‘look’. After some time, the sequence can then be reversed back to the neutral expression. In this way, only half of the sequence needs to be defined, as the second half is just the same sequence in reverse.

It is also worth noting that some expressions are identical for both eyes (eg, a blink), others are completely independent of each other (eg, a wink) and still others have a reflected symmetry around where the nose would be (ie, they have a left and a right side). This means that the eyes will need to be independently animated, possibly unsynchronized.

Also, to make the neutral expression more life-like, the software should occasionally just blink the eyes rather than keep a spooky fixed stare.

Using the MD_MAX72xx library, each eye is just an 8×8 bitmap that can be defined using the font editor, described in this previous blog article. A simple sequence for a blink, starting from the eye wide open, is shown left to right in the figure below. The eye opening again is the reverse of this sequence.


This architecture allows the software to define animations sequences as tables of pairs of bitmaps and display duration. The tables are all managed using straightforward code leveraging the font handling features of the MD_MAX72xx library. In fact, all the data for the application can be set up in tables, making it easy to adapt and change the available expressions.

All this is implemented in a class that hides most of the detail from the calling program. As a bonus the class also allows text messages to be scrolled in the LED matrices.

This implementation is available as an example of the MD_MAX72xx library. The video below shows the example program running.


All-in-all a fun project that was easier than I expected, mostly due to being able to leverage existing infrastructure provided by the MD_MAX72xx library.




10 thoughts on “Robot Eye Expressions using LED Matrix Display

  1. mrshark

    Hi, can you share a link to the suitable matrix displays? All the ones i could find seem bigger, the like ones you use in your usual parola displays, or preassempled in modules… thanks


    1. That’s because they are the same matrix displays used with the Parola library, etc. Not sure where you get the idea these are smaller.
      For the ‘eyes’ I did create a 2 matrix display PCB, but using 2 standard 1 matrix displays you get the same result.


      1. mrshark

        i’ll unplug 2 displays from a module and try to fit them on the board you kindly sent me a while ago, i forgot about that until now and i eventually remembered wrongly they’re smaller, like the little matrices of the wemos modules (those ARE smaller), like these ones 🙂×8-Led-Reticolo-Luminoso-Rosso-Modulo-A-Matrice-di-punti-8×8-8-8/32931278476.html

        so, is this one correct?×8-8-8/32823415893.html



  2. Moisés

    I am a beginner in the Arduino world and I was enthusiastic about your projects directed to the LED displays, they are the best I have ever seen! I am so grateful for the fantastic ideas you share.

    Please if possible could you advise me on the following:

    I would like to implement a PIR sensor in the “MD_MAX72xx_Eyes” sketch (MD_MAX72xx library example). Where the displays with the animated eyes would be erased and only lit with motion detection. I want to make a toy for my son, could you show me a starting point to implement this?

    In advance, very grateful!

    (Sorry for the translation “Portuguese-English” via google!)


    1. One way to do this is to edit the idle animation to be just a blank display (ie, effectively all LEDs off). When you get the PIR sensor, you start one of the other animations with the eyes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s