DISPLAY EMI RADIATION ON AN LCD

QUICK PROJECT DESCRIPTION
  • PROJECT OBJECTIVE: Detection of EMI radiation.
  • HARDWARE REQUIREMENTS: Arduino-compatible board, I2C LCD, 6 male to female jumper cables.
  • SOFTWARE REQUIREMENTS: Arduino environment (or online editor) and the Arduino library for the LCD,which can be found here. Unzip and paste the folder in the Arduino libraries folder. It’s in the same location as your default sketches. To find the sketchbook location, go to File /Preferences.
  • KNOW-HOW REQUIREMENTS: Basic Arduino environment knowledge (learn more here).
INSTRUCTIONS
  1. Connect everything as shown in the diagram.
  2. Open the Arduino environment and open this sketch (or copy the code to a blank sketch, File / New,  erase all the content and paste the code). Upload the sketch to your board by clicking on the triangle on the upper left.
  3. The antenna connected to pin 5 is made of two connected male to female jumper cables. Move the antenna with the Arduino-compatible board around and search for EMI radiation hotspots. Higher numbers mean more radiation.

Have fun!

PIN OUT DIAGRAM
1
2
3
4
5
1

5 VOLTS

2

GROUND

3

SDA to A4

4

SCL to A5

5

EMI antenna

CODE
 /*by Dr. Mangus of Mango Labs
   emi detector copyright 2010 Adam N. Outler     */
   
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>

//A note on HZ, if you notice meter oscillations on a known steady 
//  signal increase or decrease hertz by 1.  The oscillations are
//  caused when the signals are in near-perfect resonance. 
float FrequencyToMonitor=59; //hertz

LiquidCrystal_PCF8574 lcd(0x27);  // set the LCD address to 0x27 or 
                                  //3f for the A model IC


//setup pins
#define ANTENNA 5 //antenna pin

//setup initial global values
int EMICount=100;   
int EMICounter=0;               
int HalfPeriodMicroseconds=0;// initial value of halfwavelength

void setup()  { 
   double HalfPeriod=((1/FrequencyToMonitor)*.5);   //Half-period in seconds from frequency
   HalfPeriodMicroseconds=int(1000000*HalfPeriod);  //Convert period seconds to microseconds integer

   pinMode(ANTENNA, INPUT);                     //set antenna pin
   
   lcd.begin(16, 2);                           // initialize the lcd
   lcd.setBacklight(255);
   lcd.clear();
} 


/*
   LOOP checks for value of antenna to go high and then low
   if change is seen number is inceased oterwise decreased.  
   This allows for a magentic effect when
   near the field.
*/
void loop(){
   int ANTENNAValue=0;    //sets and resets ANTENNAValue
   int OldANTENNAValue=0; // as well as OldANTENNAValue


   for ( int Pass=0; Pass < 4; Pass++ )  {//take 4 readings
    ANTENNAValue=digitalRead(ANTENNA);    //   from the antenna
    if ( ( ANTENNAValue == HIGH ) && ( OldANTENNAValue == LOW ) ) {
        incrementEMI(); //If a change is detected increase twice
        incrementEMI(); //   4 passes means 3 changes total
    } else if ( ( ANTENNAValue ==  LOW ) && ( OldANTENNAValue == HIGH ) ) {
        incrementEMI(); //   This makes the meter rise by
        incrementEMI(); //   a total factor of  2 and
    } else {
        decrementEMI(); //   if there is no change it falls by 1
    }
        OldANTENNAValue=ANTENNAValue; //Log old value for next pass
        delayMicroseconds(HalfPeriodMicroseconds);  // half-wave pause before next reading
   }
   delayMicroseconds(HalfPeriodMicroseconds); //visual delay between reading passes
   delayMicroseconds(HalfPeriodMicroseconds); //twice to avoid extremely long numbers   
// Show on LCD
   lcd.home(); 
 //            1234567891234567    
    lcd.print("  Relative EMI");
    lcd.setCursor(0, 1);
    lcd.print(" intensity: ");
    lcd.print(EMICounter);
}

/* 
FUNCTION iincreases the number

*/
void incrementEMI(){
    if ( EMICounter <  EMICount  - 1  ){ EMICounter++;} //if not max increase
}

/*
FUNCTION decreases the number

*/
void decrementEMI(){
   if ( EMICounter >= 0 ){ EMICounter-- ;} // if not zero, decrease}
}