Functional Mad Eye Moody's Eye Using Nodemcu

All Harry Potter fans might remember the Mad Eye Moody's Eye like the one above

Today we are going to build one like this using the nodemcu.

Supplies:

  • nodemcu 1.0 esp 12e module x1
  • servo motor x1
  • ir sensor x1
  • buzzer module (preferably low trigger activated,but not to worry if high trigger activated)

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: Get an Info

All knowledgeable potterheads like me can simply ignore this step. I recommend watching this video for a quick overview.

I give the youtuber Harry Potter credits for the video.

Harry Potter is the property of J.K. Rowling and Warner Bros. No copyright infringement is intended.

Step 2: Connections

well make the connections as below and this step is over.

all vcc to nodemcu 3v through a breadoard.

all gnd to nodemcu gnd through a breadoard.

buzzer i/o to d6

ir sensor output to d7

servo sig to d4

Step 3: Coding

well upload the code using arduino ide below. if you don't know how to check out this awesome instructable by

osoyooproduct

https://www.instructables.com/id/How-to-Program-NodeMCU-on-Arduino-IDE/

the code is given below. if you are using a high trigger buzzer then the code is in the next step.

int ledPin = 12; // choose pin for the LED
#include #include "ESP8266WiFi.h" int ypos; int inputPin = 13; // choose input pin (for Infrared sensor) int val = 0; // variable for reading the pin status Servo servo; void setup() { // put your setup code here, to run once: Serial.begin(115200); WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100); pinMode(inputPin, INPUT); // declare Infrared sensor as input pinMode(ledPin, OUTPUT); // declare LED as output

servo.attach(2); //D4

servo.write(0); Serial.println("Setup done");

delay(2000);

}

void loop() { // put your main code here, to run repeatedly: Serial.println("scan start");

// WiFi.scanNetworks will return the number of networks found int n = WiFi.scanNetworks(); Serial.println("scan done"); if (n == 0) { Serial.println("no networks found"); } else { Serial.print(n); Serial.println(" networks found"); servo.write(ypos); //y-servo moves to new position

int delayAmount = random(800, 2800); //generate number between 500 and 2000 delay(delayAmount); // delay by the random amount for (int i = 0; i < n; ++i) { // Print SSID and RSSI for each network found Serial.print(i + 1); Serial.print(": "); Serial.print(WiFi.SSID(i));

Serial.print(" ("); Serial.print(WiFi.RSSI(i)); Serial.print(")"); Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE) ? " " : "*"); delay(10); val = digitalRead(inputPin); // read input value if (val == HIGH) { // check if the input is HIGH digitalWrite(ledPin, HIGH); // turn LED OFF } else { digitalWrite(ledPin, LOW); // turn LED ON } } } Serial.println("");

// Wait a bit before scanning again delay(5000); }

Step 4: High Trigger Buzzer Module

well this the code for high trigger buzzer module . if you are not using it simply ignore this step.

int ledPin = 12; // choose pin for the LED
#include #include "ESP8266WiFi.h" int ypos; int inputPin = 13; // choose input pin (for Infrared sensor) int val = 0; // variable for reading the pin status Servo servo; void setup() { // put your setup code here, to run once: Serial.begin(115200); WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100); pinMode(inputPin, INPUT); // declare Infrared sensor as input pinMode(ledPin, OUTPUT); // declare LED as output

servo.attach(2); //D4

servo.write(0); Serial.println("Setup done");

delay(2000);

}

void loop() { // put your main code here, to run repeatedly: Serial.println("scan start");

// WiFi.scanNetworks will return the number of networks found int n = WiFi.scanNetworks(); Serial.println("scan done"); if (n == 0) { Serial.println("no networks found"); } else { Serial.print(n); Serial.println(" networks found"); servo.write(ypos); //y-servo moves to new position

int delayAmount = random(800, 2800); //generate number between 500 and 2000 delay(delayAmount); // delay by the random amount for (int i = 0; i < n; ++i) { // Print SSID and RSSI for each network found Serial.print(i + 1); Serial.print(": "); Serial.print(WiFi.SSID(i));

Serial.print(" ("); Serial.print(WiFi.RSSI(i)); Serial.print(")"); Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE) ? " " : "*"); delay(10); val = digitalRead(inputPin); // read input value if (val == HIGH) { // check if the input is HIGH digitalWrite(ledPin, LOW); // turn LED OFF } else { digitalWrite(ledPin, HIGH); // turn LED ON } } } Serial.println("");

// Wait a bit before scanning again delay(5000); }

Step 5: Your Crafts

well as I'm not too good in crafts i took help of the following instructable by daronjay.

https://www.instructables.com/id/Mad-Eye-Moody-Mov...

*just remember not code or wire; in fact you don't need an adafruit trinket! *

Step 6: And Done...

now be the perfect potterhead and walk like an ex-auror. !!!

First Time Author Contest

This is an entry in the
First Time Author Contest

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions

    None
    Penolopy Bulnick

    10 days ago

    Nice job :) Do you have a picture of your finished Mad Eye Moody eye?