Watchful Eye – Final


For my final I designed a Watchful Eye. Taking inspiration from Evil Eyes that protect you from harm, this device is designed with the intent of helping friends and loved ones look-out for on another. It uses the Adafruit io and IFTTT platforms to active the device from your phone so that it can be looking for your safe return. Once you get home it will send a text to your friend that you have made it safely.

Please see my instructable below for more information:

IMG_0976IMG_0941IMG_0906Acrylic layout

#define LED_PIN 13
#define MOTION_PIN 23

//Including NeoPixel Library

#define PIXELS_PIN 13
#define NUM_LEDS 16
#define BRIGHTNESS 50
#define PIXEL_TYPE NEO_GRB + NEO_KHZ800 // Type of the NeoPixels
Adafruit_NeoPixel strip = Adafruit_NeoPixel (NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);

//Including WIFI configuration
#define WIFI_SSID “Wifi name”
#define WIFI_PASS “Wifi_password”
#define IO_USERNAME “IO_username”
#define IO_KEY “IO_key”

#include “AdafruitIO_WiFi.h”


// Variables for sensor, arming, feed
int current = 0;
int last = 0;
int armedSensor = 0;
int message = 0;

//Color variables
uint32_t low = strip.Color(0, 0, 0);
uint32_t high = strip.Color(41,196,204);
uint32_t armed = strip.Color(20,20,20);

// set up the ‘Watchful’ feed
AdafruitIO_Feed *Watchful = io.feed(“Watchful”);

//Wifi and IO set up code
void setup() {
//set up LEDs
for( int i = 0; i<NUM_LEDS; i++){
strip.setPixelColor(i, low);
strip.begin();; //Initialize all the pixels to “off”

//Set up sensor for reading

// start the serial connection

//connect to Wifi
while (WiFi.status() != WL_CONNECTED){
Serial.println(“Connecting to WiFi..”);

Serial.println(“Connected to the Wifi network”);
// connect to
Serial.print(“Connecting to Adafruit IO”);

// wait for a connection
while(io.status() < AIO_CONNECTED) { Serial.print(“.”); delay(500); } // we are connected Serial.println(); Serial.println(io.statusText()); } //Main functions void loop() { //; is required for all sketches. // it should always be present at the top of your loop // function. it keeps the client connected to //, and processes any incoming data.; // set up a message handler for the feed. // the handleMessage function (defined below) // will be called whenever a message is // received from adafruit io. Watchful->onMessage(handleMessage);

//Tells you device is on standby and pixels off
if(message == 0 && armedSensor == 0){
Serial.println(“Unarmed – Standby”);
for( int i = 0; i<NUM_LEDS; i++){
strip.setPixelColor(i, low);

//Arms sensor when widget button is pressed
if(message == 1 && armedSensor == 0){
Serial.println(“Arming sensor”);
for( int i = 0; i<NUM_LEDS; i++){
strip.setPixelColor(i, armed);
armedSensor = 1;

//If armed and senses motion, turn on LEDs
if(message == 1 && armedSensor == 1){
// grab the current state of the button.
if(digitalRead(MOTION_PIN) == HIGH){
current = 1;
Serial.println(“Motion detected!”);
for( int i = 0; i<NUM_LEDS; i++){
strip.setPixelColor(i, high);
Serial.println(“Disarming sensor”);
armedSensor = 0; //disarms
message = 0; //resets IO feed
for( int i = 0; i<NUM_LEDS; i++){ strip.setPixelColor(i, low); //; }; } delay(1000); armedSensor == 0; //Serial.println(“Unarmed”); } } // this function is called whenever a ‘Watchful’ message // is received from Adafruit IO. it was attached to // the Watchful feed in the setup() function above. void handleMessage(AdafruitIO_Data *data) { message = data->toInt();

//if (Watchful == 0){ //light up the LED
Serial.print(“received <- “);


Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s