Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
Patel Darshil
Published © GPL3+

Arduino EMF Detector A.K.A Ghost Detector

Halloween is near, so grab your Arduino, make an EMF detector and play with it.

BeginnerShowcase (no instructions)1 hour30,031
Arduino EMF Detector A.K.A Ghost Detector

Things used in this project

Hardware components

LED (generic)
LED (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Arduino Leonardo
Arduino Leonardo
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

captureemf_XgN1bVNQQW.JPG

Code

Untitled file

C/C++
int inPin = 5;             // analog 5 
int val = 0;                 // where to store info from analog 5
int pin11 = 11;         // output of red led

void setup() {
 
  Serial.begin(9600);
  
}

void loop() {
  
  val = analogRead(inPin);                    // reads in the values from analog 5 and
                                                                   //assigns them to val
  if(val >= 1){
    
    val = constrain(val, 1, 100);               // mess with these values                                       
    val = map(val, 1, 100, 1, 255);        // to change the response distance of the device
    analogWrite(pin11, val);                    // *note also messing with the resistor should change  
                                                                   // the sensitivity
   }else{                                                     // analogWrite(pin11, val); just tuns on the led with 
                                                                  // the intensity of the variable val
    analogWrite(pin11, 0);                     // the else statement is just telling the microcontroller
                                                                 // to turn off the light if there is no EMF detected
  }
  
 Serial.println(val);                                // use output to aid in calibrating
 
}

Credits

Patel Darshil
29 projects • 165 followers
I am an Electronics Hobbyist pursuing my BE in Electronics and communication

Comments