loading

This is a project I made for the HKU (University of the Arts, Utrecht).
I got the idea of making a ghost detector from the TV series Supernatural, in which they use an EMF detector.

Step 1: Step 1: Things You'll Need

1. Arduino

2. Antenna or Probe

3. 3.3M Ohm Resistor (I used a 4.7M Ohm one, which worked just fine)

4. 330 Ohm Resistors

5. 100 Ohm Resistor

6. LEDs

7. Small Piezo Buzzer

8. Wire

9. Soldering iron and PCB ór a bread board.

Step 2: Step 2: the Setup

This is the way I set up my bread board before I soldered it to a print plate. I attached the probe (which was a solid core wire) to analog pin 5, together with the 4.7M Ohm resistor.

In the code, which I will put in the next step, I made it so that if the blue LED lights up, the Piezo Buzzer makes some noise.

Step 3: Step 3: the Code

I used this code by Collin Cunningham:

http://makezine.com/2009/05/15/making-the-arduino-...

I modified it, so it would work with my LEDs and the Piezo Buzzer.

___________________________________

#define NUMREADINGS 15

int senseLimit = 15; int probePin = int val = 0;

int LED1 = 2;
int LED2 = 3;
int LED3 = 4;
int LED4 = 5;
int LED5 = 6;
int LED6 = 7;
int LED7 = 8;

int buzzer = 13;

int buzzerTone = 0;

unsigned long previousMillis = 0; const long interval = 1000;

int readings[NUMREADINGS];
int index = 0;
int total = 0;
int average = 0;

void setup() {

pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(13, OUTPUT);

Serial.begin(9600);

for (int i = 0; i < NUMREADINGS; i++) readings[i] = 0;

}

void loop() {

val = analogRead(probePin);

if(val >= 1){

val = constrain(val, 1, senseLimit); val = map(val, 1, senseLimit, 1, 1023);

total -= readings[index]; readings[index] = val; total += readings[index]; index = (index + 1);

if (index >= NUMREADINGS) index = 0;

average = total / NUMREADINGS;

if (average > 100) {digitalWrite(LED1, HIGH);} else {digitalWrite(LED1, LOW);}

if (average > 200) {digitalWrite(LED2, HIGH);} else {digitalWrite(LED2, LOW);}

if (average > 300) {digitalWrite(LED3, HIGH);} else {digitalWrite(LED3, LOW);}

if (average > 400) {digitalWrite(LED4, HIGH);} else {digitalWrite(LED4, LOW);}

if (average > 500) {digitalWrite(LED5, HIGH);} else {digitalWrite(LED5, LOW);}

if (average > 600) {digitalWrite(LED6, HIGH);} else {digitalWrite(LED6, LOW);}

if (average > 700) {digitalWrite(LED7, HIGH); tone(buzzer, 1000);} else {digitalWrite(LED7, LOW); noTone(buzzer);}

Serial.println(val); // use output to aid in calibrating }

}

<p>Cool :-)</p><p>I'll try it.</p>
<p>This would be really fun to play around with at Halloween.</p>

About This Instructable

396views

10favorites

License:

More by CelineW3:Arduino Ghost (EMF) Detector 
Add instructable to: