Introduction: Animated Halloween Evil Eyes
This Instructable details how to create animated Halloween blinking 'Evil Eyes' using an Arduino Uno and two 8by8 Red LED matrices with MAXIM MAX7219 driver chips.
The design is such that an animation can be quickly and simply created using Microsoft Excel to graphically develop each animated frame, auto generate 'C' code, 'drop' this into a framework sketch (EvilEyes2.ino) and download to the target platform to view the live animation results in seconds. Once satisfied the animation is just right, many animations can be combined to execute asynchronously in a separate framework sketch (EvilEyesN.ino). At the time of writing, the software was tested using three pairs of 'Evil Eyes' as in the image above.
It requires no tools, minimal knowledge of electronics and the following parts/libraries;
1. 5 off prototyping wires with male/female connectors (in the picture above, Red, Black, Blue, Green and Yellow)
2. 2*n off (for each pair of eyes) MAX7219 Red Dot Matrix LED Display Module Boards with cables
3. 1 off Arduino Uno
4. The Arduino LedControl library in Git Hub. https://github.com/wayoda/LedControl/releases
Step 1: MAX7219 Red Dot Matrix LED Display Module Boards With Cables
The image above shows the LED Matrix displays which were purchased from Amazon in the UK for an unbelievable £1.99 and shipped from China FOC.
Step 2: Interconnections
The parts are connected as shown above, 'daisy chained' from left to right in groups of two. In the software position 1 is on the left, moving right incrementally. for more 'Evil Eyes', all you need to do is repeat the pattern with the Blue, Violet, Grey, White and Black wires. Given each LED Matrix comes with a 5 way female/female cable this is simple to achieve.
Note 1 : Remember the Arduino feeds the bottom of the LED matrix and top of the LED matrix feeds the bottom of the next LED matrix and so on etc. This is because 'Din' is on the bottom and 'Dout' on the top. 'Dout' feeds 'Din'. Follow this pattern and you can't go wrong.
Note 2 : The visually astute of you will notice in the diagram the 8x8 display shows a six way connector. The ones used in this Instructable are indeed 5 way. Why you may ask? This is all I could find in Fritzing. I know I am going to take some flack from Fritzing fans, but I really lost the will to live trying to wrestle with the software to create my own part and gave up in the end. Rant over. :-)
Step 3: Creating the Animation
The video above gives a 'very' brief overview of how to create the animation.
The steps are as follows;
1. Using the Spread sheet in the attached EvilEyes.zip file below 'Eyes5.xlsm'. (Yes, revision 5. It took 5 goes of using it 'in anger' to get the spread sheet and code generation working optimally. The secret is the connection between frame title and corresponding #define. It makes putting together a series of frames easier and quicker).
2. Click on the 'Source' Worksheet. For every pair of 'Eyes' colour the given pixcel RED if you desire the corresponding LED in the 8x8 LED matrix to be illuminated for this animation frame. (In the video you can see me putting the pupil into the right eye of the first frame. Apologies there is no mouse visible it was my first go at using Microsoft Expression Encoder 4)
3. Once complete, move to the 'Details' work sheet and fill out how many animations you would like to encode. Then press the 'Generate Code' button.
4. After generation is complete the spread sheet flicks to the 'Code' worksheet. Just press Ctrl-A to select all, then Ctrl-C to copy all code to the clipboard.
5. Activate the Arduino IDE. I am assuming you have already opened EvilEyes2.ino. Then paste over the top of the existing code. Ctrl-V. As in the video.
6. Create your animation by stringing together many frames into a 'movie' (you only need to use the left eye as reference, the framework automatically picks the next entry in the array for the right eye), choosing how long you want to display the frame for and how bright you want it to be displayed on the 8x8 Matrix.
7. Compile, download and run.
8. Repeat steps 6 and 7 until you are happy with your 'movie'.
Full instructions are in the spread sheet on the worksheet marked 'Details'.
Note : For the auto code generation to work, the spread sheet will need macros turned on. If you are worried about the VBA, keep macros off, open the spread sheet and press Alt-F11. The VBA editor will open and you can satisfy yourself there is nothing untoward in the code.
Attachments
Step 4: Viewing Your Handywork
The video above shows a typical animation of the Halloween 'Evil Eyes'
Step 5: Putting Together the Movie
A movie is just a sequence of animated frames;
The sequence of frames is held in an array of 'frames' ('frameType' in the sketch) or 'movie' ('frameType movie[]' in the sketch).
Each 'frameType' has three parameters;
int frameCount; // A pointer to the array holding the animations you've just designed.
int frameDelay; // A delay value in MilliSeconds indicating how long to display this given frame.
int frameLuminance; // a value 0...15 indicating how bright to display this frame.
So a movie is a collection of frames;
frameType movie[] =
{
// Blink
{LeftEye2,6000,1}, {LeftEye2,5,1}, {LeftEye3,10,1}, {LeftEye4,10,1}, {LeftEye3,10,1}, {LeftEye2,5,1}
};
Step 6: Your Very Own Multiplex Cinema!
Once you have created your animations you can string them together and use one Arduino to drive many pairs of 'Evil Eyes'
Using the sketch below 'EvilEyesN.ino' you can enter more than one movie, connect up your daisy chained 8x8 matrices and see them run.
I have included an example video of just this above (sorry it also contains the editing process).
Attachments
Step 7: Why Stop There!
You don't have to stop at animations of eyes.
The video above shows animations of three waveforms.
It only takes a few minutes to create the animations and see them run.
Have fun.
Further update. 04/10/15
Please note if you are using Arduino IDE > 1.0.6, you will need to make a change to the following type def.
Change 'prog_uchar' for 'const unsigned char'.
In file EvilEyes2.ino, this is at line 69 and file EvilEyesN.ino this is at line 103.
Thanks to Sacchetta for bringing this compilation problem to light.
29 Comments
5 years ago
It doesn't work
EvilEyes2:36: error: expected unqualified-id before '\x6172'
EvilEyes2:83: error: too many initializers for 'binaryArrayType'
EvilEyes2:83: error: too many initializers for 'binaryArrayType'
EvilEyes2:83: error: too many initializers for 'binaryArrayType'
EvilEyes2:83: error: too many initializers for 'binaryArrayType'
EvilEyes2:97: error: 'LeftEye2' was not declared in this scope
EvilEyes2:97: error: 'LeftEye3' was not declared in this scope
EvilEyes2:97: error: 'LeftEye4' was not declared in this scope
EvilEyes2:97: error: 'LeftEye4' was not declared in this scope
EvilEyes2:97: error: 'LeftEye3' was not declared in this scope
EvilEyes2:97: error: 'LeftEye2' was not declared in this scope
EvilEyes2:101: error: 'LeftEye5' was not declared in this scope
EvilEyes2:101: error: 'LeftEye6' was not declared in this scope
EvilEyes2:101: error: 'LeftEye7' was not declared in this scope
EvilEyes2:101: error: 'LeftEye8' was not declared in this scope
EvilEyes2:101: error: 'LeftEye7' was not declared in this scope
EvilEyes2:101: error: 'LeftEye6' was not declared in this scope
EvilEyes2:101: error: 'LeftEye5' was not declared in this scope
EvilEyes2.ino: In function 'void loop()':
EvilEyes2:128: error: 'struct binaryArrayType' has no member named 'array1'
EvilEyes2:129: error: 'struct binaryArrayType' has no member named 'array1'
Reply 5 years ago
Looks like you have edited the code and made a mistake.
You're not posting the full error message
Question 5 years ago
where is the libraries for this project avr/pgmspace.h not found.
error massage on uploading
Arduino: 1.8.3 (Windows 7), Board: "Arduino Nano, ATmega328"
EvilEyes2:69: error: 'prog_uchar' does not name a type
prog_uchar array1[8];
^
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
};
^
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
EvilEyes2:474: error: too many initializers for 'binaryArrayType'
C:\Users\Dr. WASANTHA\AppData\Local\Temp\Temp1_FF40O21I52CHDXF (2).zip\EvilEyes2\EvilEyes2.ino: In function 'void loop()':
EvilEyes2:519: error: 'struct binaryArrayType' has no member named 'array1'
lc.setRow(0,i, binaryArray[movie[a].frameCount].array1[i]);
^
EvilEyes2:520: error: 'struct binaryArrayType' has no member named 'array1'
lc.setRow(1,i, binaryArray[movie[a].frameCount+1].array1[i]);
^
exit status 1
'prog_uchar' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Answer 5 years ago
Read the Further update. 04/10/15 above.
7 years ago
Great instructable! My Arduino was gathering some dust, I'm going to use this instructable to make it useful again by integrating this into my Daft Punk helmet!
Reply 7 years ago
Hi Chillout,
Glad it will be of some use.
Don't forget to send a picture.
Regards
SteveQuinn
Reply 7 years ago
I will for sure! :-)
I'm not a good coder, but I'm going to try to add user input over serial interface to it, like in this instructable. I think it should work if I create multiple movie arrays, and depending of the command in the serial console, a different for loop kicks off with the movie that goes with it. That would make the helmet a bit more dynamic.
Reply 7 years ago
I liked Igor's Instructable.
There are a couple of points you should bear in mind if you want to add some form of serial control;
1. Put any serial port testing code in the while(true) loop at the bottom of the sketch.
2. Use the highest baud rate you can
3. Try keep the number of serial port char testing to a minimum. The code was designed to free run, testing for received serial port input may make the animation become jerky.
4. The code I wrote was optimised for a display pair. ie. two displays, primarily to simulate eyes.
7 years ago
I made this. Can't wait for Halloween.
Reply 7 years ago
Well done, that'll frighten 'em. ;-)
7 years ago
nice. i made it!
Reply 7 years ago
Well done. Do you have a pic?
8 years ago on Introduction
When I upload the code I get "LedControl' does not name a type" error... deleted code and it didn't fix. reuploaded still nothing...
Reply 8 years ago on Introduction
Sounds like you have an issue with your install.
I am using the following;
Arduino Dev Env 1.5.5
Ledcontrol-1.0.1, Copyright (c) 2007 Eberhard Fahle
The manual for which is here;
https://media.readthedocs.org/pdf/ledcontrol/latest/ledcontrol.pdf
I am using a Windows 7 PC
See here for how to install an Arduino Library (just in case).
http://arduino.cc/en/Guide/Libraries
Reply 8 years ago
Hi i have had the same problem but with a bit of research iv found "Replace prog_char with const char..." fixed it for me thanks Steve great project
(ref : http://forum.arduino.cc/index.php?topic=272313.0))
8 years ago
It worked!! Thanks Steve, you are the man!
8 years ago
Evil eyes ?
More like arguing logos
8 years ago on Introduction
Your project is fascinating. It can be a concept for more idea's. Like this collapsing segments digital clock ? I think if we have some sharp code writer, he/she can create a code for it, using your matrix...see below
https://www.youtube.com/watch?v=3pUFzwmYR-g
8 years ago on Introduction
Wow! This is really very interesting.
Reply 8 years ago on Introduction
Thanks