Motion Sensing Eye




I have always wanted to make something with my LED dot matrix display, and so when I found a old alarm motion sensor I knew just what to make, a Motion Sensing Eye!

This instructable will hopefully finish with you having a working dmd, that will display an eye that opens if something in a room moves (above in the pictures are some gifs of it in action). This instructable will also be updated with bluetooth and android support in the near future (when I get it working).

Anyway, Let's Go!

Update (05/02/14):
- added optional shield

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials

Things you will need:

- An Arduino or similar
- A Freetronics Dot Matrix Display
- Arduino link cable for dmd
- An alarm sensor
- Mini breadboard and jumper cables
- A 10k resistor
- Power supply for the alarm sensor
- Usb cable for arduino

- Arduino Prototype shield
- Stackable headers
- Wire
- Tactile push buttons
- Terminal Blocks

Coming Soon Eventually:
- Arduino compatible bluetooth module
- bluetooth dongle for PC
- An android phone

Step 2: The Freetronics DMD

The dot matrix display I have used for this project can be found here
It features a 32x16 LED display, giving you a total of 512 high brightness LEDs to play with.
Two extra libraries are needed for the Arduino IDE, and these can be found here and here

You can check that your dmd is functioning properly by running the dmd_demo sketch found in the DMD library you will have just downloaded. Once uploaded to your arduino, connect it and the dmd with the link cable as depicted by the pictures.

Congratulations, your dmd is working correctly

Step 3: The Alarm Motion Sensor

Firstly the sensor is going to need a 12v DC power supply. Connect this to the positive and negative terminals that can be found inside the sensor, and switch on the power supply. The sensor will take up to 2 minutes before it is operational, as it performs a self check each time it is powered up. We will then need 2 wires to connect to NC (normally closed) and C (common).

Next set up the mini breadboard as shown in the diagram. Now, take the wire connected to the NC port of the sensor and connect it in line with the green wire on the breadboard. The wire coming from C is then connected in line with the red wire.

Finally, leaving the dmd connected as it was in the previous step, connect the wires from the breadboard as follows, Green to Pin 4, Yellow to Gnd, and Red to 5V.

And there we have it, all the hardware is in place and now we just need the sketch for the arduino.

Step 4: The Code

Now in the code for this project we need to translate the input from the motion sensor, and output a signal to the dmd, telling it what to display.

*Note: when programming the dmd this code must always be present, otherwise the Arduino IDE won't recognise your command

The sketch I have written for this project works by displaying a "startup" animation to the dmd, and then proceeds by reading the input from the sensor, displaying an open eye if the motion sensor is triggered, and a closed eye when not.

The sketch can be downloaded as an .ino file from here, or as text from pastebin from here

Usefully commands for the dmd include:
  • dmd.writePixel(x,y, GRAPHICS_NORMAL, z) - turns on a signal pixel at coordinates x,y. The z value is either 1 or 0, for on or off
  • dmd.drawLine(x1,y1,x2,y2, GRAPHICS_NORMAL) - draws a line from x1,y1 to x2,y2
  • dmd.drawBox(x1,y1,x2,y2, GRAPHICS_NORMAL) - draws a box shape with a corner at x1,y1 and the opposite corner at x2,y2
  • dmd.drawFilledBox(x1,y1,x2,y2, GRAPHICS_NORMAL) - same as above but the box is filled, not just the outline
These keywords can also replace the GRAPHICS_NORMAL to achieve different combinations of pixels

Step 5: The Shield

Having got sick of unplugging and re-plugging masses of wires into my arduino each time I used it I decided to make a simple shield for it. Now all that needs to be done for this is to recreate the circuit from the breadboard, on the prototype shield. Simple stuff really. Just follow the (very poorly edited) diagram, using black wires for ground connections, red for positive connections, and yellow for data connections (if it is unclear in anyway feel free to ask).

Now, I have also included headers on the shield for a 7 pin bluetooth module. Whether or not I ever get around to adding bluetooth support for this project still remains to be seen, but for now it is there. (the pinout of your bluetooth module may well be different, so read the labels before connecting any old wires)

Step 6: Conclusion

Congrats! You now (hopefully) have you're own functioning motion sensing eye, all you have to do now is find somewhere to put it. I will be constantly updating this instructable with new animations and displays for the dmd as well as bluetooth and android support very soon! Suggestions are more than welcome.

Stay tuned!

Supercharged Contest

Participated in the
Supercharged Contest

Hardware Hacking

Participated in the
Hardware Hacking

Make It Glow Contest

Participated in the
Make It Glow Contest

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    11 Discussions


    5 years ago on Step 4

    I was looking through your code and i was wondering where did you find your libaries for the code?

    #include "SPI.h"

    #include "DMD.h"

    #include "TimerOne.h"

    1 reply

    Reply 5 years ago

    These libraries can be downloaded from the links in step 2. Put them in your library folder and you should be good to go


    5 years ago on Introduction

    Hey i am really interested in recreating this project, question though, what kind of ribbon cable and connector did you use for this project?

    1 reply

    Reply 5 years ago

    the ribbon cable and connector came with the dmd that i used. ( feel free to ask about anything else


    5 years ago on Introduction

    a nice, while way more complex iteration on this would be an motion-tracking eye. With the use of a webcam, probably a raspberry pi, and with that the arduino shield for the Pi, it could possibly make the eye follow you around the room. Which would be creepy as hell, but so awesome.

    1 reply

    Reply 5 years ago on Introduction

    That'd be amazing! I may look into making something similar using a pcDuino that I have. Currently working on bluetooth support to manually change the eyes position


    5 years ago on Introduction

    wow! it's a very interesting DIY production. Arduino is so popular now,we can do something with it due to simple & easy.I guess,you must use the technical of dynamic scanning for dot matrix display.


    5 years ago on Introduction

    Thank you so much for sharing your idea on instructables

    Awesome! Can't wait to see more iterations of this project. Thank you so much for sharing your idea on Instructables.