Simple EMF Detector/Meter

I recently built a simple electromagnetic field (EMF) detector based on a code by Christian Figge that I found on the web. My design includes a 10-LED bar graph (from eBay), which I used to display measurement results. My prototype works well and detects the electromagnetic field generated by electrical appliances, computers, radios, and more from a short distance.

The Hardware

The front end of my design is composed of a little bit of hardware (see the schematic shown below), the output of which is connected directly to one analog input (A0) of an Arduino UNO microcontroller. A total of 10 I/O pins (D2–D11) of the Arduino UNO is used to drive a 10-LED bar graph display (LDA-B10ZX). Here, the bar graph is wired to digital pins of the Arduino through 470R current-limiting resistors (R1–R10) Lowering the resistor value is not recommended because the bar graph draws more current (which may be beyond the limit of the Arduino) when all of the LEDs light up.

Useful Links


The Code/Sketch
The code of my design is a borrowed slice from another project, as mentioned before. I just baked it up a snatch (haha)!

#define MEASURES 15
int senseLimit = 15;
int probe = A0;
int ranges[] = {50, 150, 250, 350, 450, 550, 650, 750, 850, 950};
int ledcount = sizeof(ranges)/sizeof(int); 
int ledPinOffset = 2; 
int bucket[MEASURES]; 
int total = 0;
int pos = 0;
int avg = 0;
int val = 0;
void setup() {
   pinMode(probe, INPUT);
   for (int i=ledPinOffset; i<ledcount+ledPinOffset; i++) {
      pinMode(i, OUTPUT);
   for (int i=0; i<MEASURES; i++) {
      bucket[i] = 0;
void loop() {
   val = analogRead(probe);
   if (val >= 1){
      val = constrain(val, 1, senseLimit);
      val = map(val, 1, senseLimit, 1, 1023);
      total -= bucket[pos];
      bucket[pos] = val;
      total += bucket[pos];
      pos = (pos + 1);
      if (pos >= MEASURES) {
         pos = 0;
      avg = total / MEASURES;
      for (int i=0; i<ledcount; i++) {
         if (avg > ranges[i]) {
            digitalWrite(i+ledPinOffset, HIGH);
         } else {
            digitalWrite(i+ledPinOffset, LOW);

No Comments

Join the conversation!

Error! Please fill all fields.
Looking for the latest from TI?