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.