Making the Arduino EMF detector

Arduino Energy & Sustainability Technology
Making the Arduino EMF detector

Aaron ALAI’s EMF detector project looked so simple and fun I had to give it a try. After putting it together, I liked it so much that I went and built a more ‘meter-like’ version using an LED bargraph –

EMF

Arduino code is available here.

As I mention in the vid, I was a bit concerned the wire probe might be affected by the LEDs I mounted nearby — but from what I can tell, it still seems (relatively) accurate. A short walk around my workspace even revealed a few items I’d forgotten were plugged in – helpful! I’m sure there are many ways in which this project could be used/repurposed/modded – I plan on converting the readings to sound when I get the chance. If you make one be sure to submit a pic to the Flickr pool and/or send us a link.

55 thoughts on “Making the Arduino EMF detector

  1. dude says:

    In the code that comes with this project I see:

    total -= readings[index]; // subtract the last reading
    readings[index] = val; //read from the sensor
    total += readings[index]; //add the reading to the total
    index = (index + 1); // advance to the next index

    It should be noted that the smoothing doesn’t happen without removing the first line of those shown here. And then you get a problem when you start over from index = 0; so this should be changed to:

    readings[index] = val;
    total = 0;
    for(int i = 0; i < NUMREADINGS; i++){
    total += readings[i];
    }
    index += 1;

  2. CS says:

    This could be useful for activating something else; like an inductive relay, but in a non-contact fashion. (Like triggering a low-voltage circuit when a motor starts)

    1. Boffincentral says:

      Excellent suggestion. I have a need for something like that to trigger the big dust collector when I use the saw or planer. I could even trigger it at higher levels as the power board is on all the time. I just sniff for the higher amperage and even have a delay cut off. Awesome project!

      1. Boffincentral says:

        Excellent suggestion. I have a need for something like that to trigger the big dust collector when I use the saw or planer. I could even trigger it at higher levels as the power board is on all the time. I just sniff for the higher amperage and even have a delay cut off. Awesome project!

  3. Nitin Kushwaha says:

    Hello, It is really gr8!

    can you please tell me, how to get this done without using a microcontroller.
    I am working on a similar model as well.
    nknitinkushwaha[at]gmail[dot]com

    Thanks.

  4. Nitin Kushwaha says:

    Hello,

    I am a bit confused, how do i power this up,

    I bought ATMega328 Microcontroller,
    uploaded the sketch, now on the wiring part, i see in the ckt diagram,

    I am not able to see where the Orange wire goes to,
    Pins 2 thro 11 are on the Digital signal side.
    Common cathode gets to analog5–3.3M–gets to GND.

    still i am getting it to work,

    Am i missing something?

    I have a doubt on where the Orange wire and Probe wire goes to?

    where do i connect the VCC +5v?

    Please reply ASAP.

    Thanks

    1. dragonmaster198577 says:

      It loks like the orange wire is going to 5v.. I think it is for something else because the resistor goes between ground and A5, and then the probe comes off of A5 also.. All of the other outputs are + anodes and then you run one ground for all of them.. I left off the other resistors because my LEDs require more power to light, plus they are brighter that way.. I don’t really care if they burn out either I have thousands of them.. Good show!!

  5. joshua perriman says:

    could i have the code

    1. dragonmaster198577 says:

      There is a link right under the Wiring chart for the circuit.. Click the word “HERE” and it will take you to a website where you can download a file with the code in it!! This is a really cool project and it works really well..

  6. joshua perriman says:

    could i have the code

  7. dragon tirex says:

    thanks for simple schematic, and the code can be found on the video description or click on the Flickr pool , i will definitely try it :D

  8. Caesar R. H. Yount says:

    i watched the vid on the arduino emf detector, and i thought i would build one of my own. im a bit confused right now, so i figured i would ask the experts. how would i go about making one out of a hand-held am fm sports radio?

  9. quentin bell says:

    what arduino board do you use?

    1. Nathan Towell says:

      Arduino uno

  10. Dietrick Kooyman says:

    is the code for the arduino the same as the old one

  11. Fr0sty says:

    Can you put on a piezo buzzer?

    1. dragonmaster198577 says:

      I am actually in the process of Trying to build an Oscillator for this Project, But I wonder if there is a way to use one of the Unused Pins as an output for a buzzer.. You have to be careful though with that because any time you have power going into a coil you are generating EMF.. And this is a very sensitive circuit.. we don’t want to read our own EMF now do we? :-)

  12. David says:

    ¿Donde puedo encontrar la placa con las perforaciones?Soy spañol

  13. David says:

    La e encontrado,pero la resistencia dorada,verde,naranja,naranja no la encuentro

  14. sayous says:

    Are mobile phones detected?

    1. dragonmaster198577 says:

      I built it and tried to detect my cellphone.. It barely had any EMF.. Maybe the phone is not powerful enough, or maybe the project just is not sensitive enough.. I tried making it as sensitive as possible for Paranormal investigation.. And it now detects when I get close to it.. But not on the cellphone at all..

  15. HANKENSTIEN says:

    Just an idea, but if you think that the wire connector is effecting the readings, im sure you could build an RF cage around it with some thin metal…

    Then again that may make it worse and pick up more interference, well food for thought.
    PEACE

    1. dragonmaster198577 says:

      Actually some metal Shielding that was hooked into the ground might eliminate board interference all together, then the only EMF reading would be at the Antenna, Where it belongs.. Good thinking!! :-)

  16. dragonmaster198577 says:

    For those of you needing the code, I will put it here just copy and paste it into your program editor and I hope this will help.. I changed a few sensitivity settings on mine, but it works.. Follow instructions in the Comments of the code to change them.

    // EMF Detector for LED Bargraph v1.0
    // 5.12.2009
    // original code/project by Aaron ALAI – aaronalai1@gmail.com
    // modified for use w/ LED bargraph by Collin Cunningham – collin@makezine.com

    #define NUMREADINGS 1 // raise this number to increase data smoothing

    int senseLimit = 550; // raise this number to decrease sensitivity (up to 1023 max)
    int probePin = 5; // analog 5
    int val = 0; // reading from probePin

    int LED1 = 11; // connections
    int LED2 = 10; // to
    int LED3 = 9; // LED
    int LED4 = 8; // bargraph
    int LED5 = 7; // anodes
    int LED6 = 6; // with
    int LED7 = 5; // resistors
    int LED8 = 4; // in
    int LED9 = 3; // series
    int LED10 = 2; //

    // variables for smoothing

    int readings[NUMREADINGS]; // the readings from the analog input
    int index = 0; // the index of the current reading
    int total = 0; // the running total
    int average = 0; // final average of the probe reading

    void setup() {

    pinMode(2, OUTPUT); // specify LED bargraph outputs
    pinMode(3, OUTPUT);
    pinMode(4, OUTPUT);
    pinMode(5, OUTPUT);
    pinMode(6, OUTPUT);
    pinMode(7, OUTPUT);
    pinMode(8, OUTPUT);
    pinMode(9, OUTPUT);
    pinMode(10, OUTPUT);
    pinMode(11, OUTPUT);

    Serial.begin(9600); // initiate serial connection for debugging/etc

    for (int i = 0; i = 1){ // if the reading isn’t zero, proceed

    val = constrain(val, 1, senseLimit); // turn any reading higher than the senseLimit value into the senseLimit value
    val = map(val, 1, senseLimit, 1, 1023); // remap the constrained value within a 1 to 1023 range

    total -= readings[index]; // subtract the last reading
    readings[index] = val; // read from the sensor
    total += readings[index]; // add the reading to the total
    index = (index + 1); // advance to the next index

    if (index >= NUMREADINGS) // if we’re at the end of the array…
    index = 0; // …wrap around to the beginning

    average = total / NUMREADINGS; // calculate the average

    if (average > 50){ // if the average is over 50 …
    digitalWrite(LED1, HIGH); // light the first LED
    }
    else{ // and if it’s not …
    digitalWrite(LED1, LOW); // turn that LED off
    }

    if (average > 150){ // and so on …
    digitalWrite(LED2, HIGH);
    }
    else{
    digitalWrite(LED2, LOW);
    }

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

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

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

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

    if (average > 650){
    digitalWrite(LED7, HIGH);
    }
    else{
    digitalWrite(LED7, LOW);
    }

    if (average > 750){
    digitalWrite(LED8, HIGH);
    }
    else{
    digitalWrite(LED8, LOW);
    }

    if (average > 850){
    digitalWrite(LED9, HIGH);
    }
    else{
    digitalWrite(LED9, LOW);
    }

    if (average > 950){
    digitalWrite(LED10, HIGH);
    }
    else{
    digitalWrite(LED10, LOW);
    }

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

    1. jake says:

      Please someone program it like the richter scale where every bar is 10x the previous one, that would be GREAT, it would let us detect small and large fields with accuracy relative to the size, also please add a SLOWER averaged serial right function if its not already included!!!

      1. dragonmaster198577 says:

        I will help you since no one seems to want to hep so far.. :-P

        Look at the Code and Where you see this:

        if (average > 150){ // and so on …
        digitalWrite(LED2, HIGH);
        }
        else{
        digitalWrite(LED2, LOW);
        }

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

        if (average > 350){
        digitalWrite(LED4, HIGH);
        }

        Etc.. change the number to where you want it, That is the number, Basically telling the Uno that “If the Average of the reading is Greater than that presented number, Send that Output High, Otherwise Make it low.. High=on low=off.. I hope this helps you some..

        1. Zarif Hassan says:

          sorry to interrupt..what is the unit of the reading? is it Hz?

    2. MananWeb says:

      I am very confused. How do you add voltage to it to power it up and what would the piece be called? I have all of my resistors, LED bar graph, and wire (in A5) on the board and I’m not sure where to go from there. It would be super helpful if there were a list of materials required for this project..

  17. naveen raja says:

    Any idea to display the digital value of output as shown in LCD bar graph???? ……..Will be very useful………..

  18. Andrew says:

    Hmmm, interesting….maybe attach one of these to the main power cable on the washer, program some limits, and detect when the washer cycle is complete, as there should be a significant drop in current. Use button to put the A in ‘monitor’ mode when it cycle starts…maybe have a dial to set the limit instead of coding it. And then it sends a response to my home network server when finished. Although I don’t have any CAT5 in the basement and a real pain to run it down there, so I might have to look into a wireless version.

  19. jake says:

    Please someone program it like the richter scale where every bar is 10x the previous one, that would be GREAT, it would let us detect small and large fields with accuracy relative to the size, also please add a SLOWER averaged serial right function if its not already included!!!!

  20. dragonmaster198577 says:

    I want to figure out a way that I can either use one of the unused outputs as an Oscillator for a buzzer, or analog wire it with resistors to control an RC oscillator.. Maybe hook it up ths way.. One resistor of a different value onto each Anode, And the Diodes to prevent current Backup, and then put it in the RC Oscillators Capacitor instead of being one resistor that will keep the oscillator at a fixed pitch use multiple Resistors hooked up instead, That way with each LED that lights the Oscillator Pitch will become higher and higher.. I don’t think a Blocking Oscillator would Suffice for this though as it Emits EMF, Which would cause interference in the readings.. It might feed right back into the circuit.. That would be bad.. :-(

    But an Astable Multivibrator type Circuit might not put off so much EMF.. or even a NAND Oscillator.. or a 555 Timer.. Idk.. :-)

    1. Sam says:

      When I try to upload the program to my arduino i get this error

      EMF_detector_LED_bargraph_smooth.cpp:30:5: error: ‘int index’ redeclared as different kind of symbol
      c:userssamdownloadsmpide-0023-windows-20120903mpide-0023-windows-20120903hardwarepic32compilerpic32-toolsbin../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/include/string.h:56:8: error: previous declaration of ‘char* index(const char*, int)’
      EMF_detector_LED_bargraph_smooth.cpp: In function ‘void loop()’:
      EMF_detector_LED_bargraph_smooth.cpp:63:28: error: invalid types ‘int [15][char*(const char*, int)]’ for array subscript
      EMF_detector_LED_bargraph_smooth.cpp:64:19: error: invalid types ‘int [15][char*(const char*, int)]’ for array subscript
      EMF_detector_LED_bargraph_smooth.cpp:65:28: error: invalid types ‘int [15][char*(const char*, int)]’ for array subscript
      EMF_detector_LED_bargraph_smooth.cpp:66:23: error: assignment of function ‘char* index(const char*, int)’
      EMF_detector_LED_bargraph_smooth.cpp:66:23: error: cannot convert ‘char* (*)(const char*, int)’ to ‘char*(const char*, int)’ in assignment
      EMF_detector_LED_bargraph_smooth.cpp:68:18: error: ISO C++ forbids comparison between pointer and integer
      EMF_detector_LED_bargraph_smooth.cpp:69:15: error: assignment of function ‘char* index(const char*, int)’
      EMF_detector_LED_bargraph_smooth.cpp:69:15: error: cannot convert ‘int’ to ‘char*(const char*, int)’ in assignment

      Any Ideas??

  21. Georgia says:

    Hi,

    Is there a Fritzing file available for this project?

    Thanks!

  22. » Blog Archive » Make Your Own EMF Reader says:

    […] Here at LP, we’ve been looking at a few projects where we can learn to make our own equipment, specialised to our own needs. Here’s one that has certainly captured the imagination and is a great starting point. http://blog.makezine.com/2009/05/15/making-the-arduino-emf-detector/ […]

  23. Geoff says:

    Hi,

    Inspired by how great this looked with the LED bargraph I created one of these based on ATTiny85, using charlieplexing to drive the 10 segment LED. Code here if you’re interested https://github.com/strykeroz/ATTiny85-EMF-detector

    Also have included a photo there too.

    Thanks Geoff

  24. radPaul says:

    Hi Im trying to build this project but seem to be getting it wrong if anyone would mentor me for this one project I would be grateful really @dragonmaster198577 if you could help me I would love it

  25. Jon Nunn says:

    You need to juice that baby up! Make is so sensitive it detects people!

  26. Mark Anthony Ferrari says:

    Right peeps, can anyone advice on this one?
    If we were to remove the chip of the board and we wanted to power this up using a 9v battery for example, what would we need between the battery and the Atmega for this to work? Any ideas all?

    Thanks

  27. ATMEGA 328 ARDUINO External power? says:

    […] https://makezine.com/2009/05/15/makin…-emf-detector/ This is what im trying to make, I just want the power cranking a little so its alot more sensitive, too the point it can pick up the EMF of a person if possible LOL This is the code I will be using for the ATMEGA 328 http://makezine.googlecode.com/files…r_bargraph.zip This is for the Arduino, I could do for anyone who know the programming just take a quick skim through the code too see if all is well, and if the power needs in creasing via software or more components on the board? Thanks again and thankyou steve […]

  28. Peter Walker says:

    Is it possible to add an analog meter to this project?

  29. Cell Phone Radiation Lawsuit News: Bernstein Liebhard LLP Applauds Groups … – Consumer Electronics Net | EMF Protect says:

    […] MAKE | Making the Arduino EMF detector […]

  30. TinyEMF Detector « Prototalk says:

    […] The Make magazine article is here https://makezine.com/2009/05/15/making-the-arduino-emf-detector/ […]

  31. 5 Great Sensor Projects for your Urban Hacks | MAKE says:

    […] Do you have a haunting problem, or just want to make sure that secret government facility nearby isn’t flooding your town with energetic waves? This easy EMF detector could show Sam & Dean (the monster hunters, not the band) a thing or two about sensing. Check out the project here. […]

  32. 5 Grandes proyectos de sensores para tus hacks urbanos – says:

    […] Con este detector de campos electromagnéticos (EMF, Electromagnetic Field), podrás saber si hay fantasmas o fenómenos paranormales en tu casa. Constrúyelo. […]

  33. 5 Great Sensor Projects for your Urban Hacks - IT Clips says:

    […] Do you have a haunting problem, or just want to make sure that secret government facility nearby isn’t flooding your town with energetic waves? This easy EMF detector could show Sam Dean (the monster hunters, not the band) a thing or two about sensing. Check out the project here. […]

  34. Cell phones and cancer risk: What do we really know? – NorthJersey.com | EMF Protect says:

    […] Making the Arduino EMF detector | MAKE […]

  35. Moheb says:

    can i use ardunio UNO with the same code ?

    1. Hellmark says:

      Yeah, you should be able to. Codewise, there hasn’t really been much that would effect compatibility between models.

  36. Le projet de détecteur EMF | Bospicat-lab says:

    […] surfant sur le site de Makezine, je suis tombé sur le projet de détecteur EMF d’Aaron ALAI ; en français détecteur de champs magnétique… […]

  37. DETECTOR DE CAMPO ELECTROMAGNÉTICO CON ARDUINO [1] – PeyTheCrafter says:

    […] La conexión es simple: la resistencia desde el pin Analógico 5 hasta tierra (GND). Luego, el cable o antena, en el pin Analógico 5. Por último, solo tendréis que cargar el código en el Arduino y ¡a medir!. Es opcional añadir los LEDs. En un principio lo hice con los LEDs, luego le puse un zumbador (o speaker) y, finalmente, le tengo puesta una pantalla LCD 16×2. Ir a la página del proyecto […]

  38. Daryl Rasmusen says:

    I tried this code, but, getting a lot of errors. Is this supposed to be running in Processing or Arduino IDE?

  39. gilberetzu says:

    How does it work?, I want to know the physics behind it.

  40. Arduino EMF detector | Make: says:

    […] Making the Arduino EMF detector […]

Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Tagged

ADVERTISEMENT

Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).

FEEDBACK