Arduino Jack O’Lantern with animated eyes

Arduino Jack O'Lantern with animated eyes

I’m a big Halloween fan and I like to celebrate the ghost party. In this project you will learn how to build an Arduino Jack O’Lantern with animated eyes.

You will need two matrix displays with Max7219 driver, an Arduino board and a pumpkin. As a matrix display I recommend thoes*:

Arduino with MAX7219 IC

Arduino Matrix Circuit with Max7219

The circuit is relatively straightforward. Simply attach the pins as shown in the picture.

Program text for the Arduino Jack O’Lantern

In order to run the code you have to install the LedControl library. In the Arduino software click on Sketch>Libraries>Manage libraries and search for LedControl. Install the latest version.

//We always have to include the library
#include "LedControl.h"

 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn 
 pin 11 is connected to the CLK 
 pin 10 is connected to LOAD 
 We have only a single MAX72XX.

LedControl lc = LedControl(12, 11, 10, 1);
int eyePosition = 4;

void setup() {
  lc.shutdown(0, false);
  lc.shutdown(1, false);
  lc.setIntensity(0, 8);
  lc.setIntensity(1, 8);

void loop() {
  if (random(20)==1){
    evilEyes(random(20, 45), random(5));

void evilEyes(int wait, int newEyePosition) {

  while (newEyePosition != eyePosition) {
    if (newEyePosition < eyePosition) eyePosition--;
    if (newEyePosition > eyePosition) eyePosition++;
    for (int i = 0; i < 5; i++) { // For each pixel in strip...
      if (i == eyePosition) {
        lc.setLed(0, 2, i+1, 1);
        lc.setLed(0, 2, i+2, 1);

        lc.setLed(0, 3, i, 1);
        lc.setLed(0, 3, i+1, 1);
        lc.setLed(0, 3, i+2, 1);
        lc.setLed(0, 3, i+3, 1);

        lc.setLed(0, 4, i, 1);
        lc.setLed(0, 4, i+1, 1);
        lc.setLed(0, 4, i+2, 1);
        lc.setLed(0, 4, i+3, 1);

        lc.setLed(0, 5, i+1, 1);
        lc.setLed(0, 5, i+2, 1);   
        lc.setLed(0, 5, i+2, 1);        

This program presents two animated eyes displayed on the matrix.

Now hollow out a pumpkin and pack in the electronics. I always use a garbage bag to keep the hardware from getting wet. To fix the hardware I use needles.

Find more information on the Max7219 Matrix on this tutorial page:

I hope you enjoy the project. Send me your project photos and I put the in the gallery on this page 🙂

1 thought on “Arduino Jack O’Lantern with animated eyes”

  1. Pingback: Arduino Matrix Display 8 × 8 pixels and lots of fun - StartHardware - Tutorials for Arduino

Leave a Reply

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