Motion Sensing Eye
Intro: 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
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
Optional:
- 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
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
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
*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
- GRAPHICS_INVERSE
- GRAPHICS_OR
- GRAPHICS_NOR
- GRAPHICS_TOGGLE
STEP 5: The Shield
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
Stay tuned!
10 Comments
ehmedat 10 years ago
If allowed possible code transmitter via Bluetooth
Kenshow6873 10 years ago
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"
aidanq 10 years ago
Kenshow6873 10 years ago
Hey i am really interested in recreating this project, question though, what kind of ribbon cable and connector did you use for this project?
aidanq 10 years ago
bobiebob 10 years ago
aidanq 10 years ago
shellalbert 10 years ago
fbyhmkfff 10 years ago
audreyobscura 10 years ago