I've found a cool EMF Code by Aaron Alai he came up with this Code to use a single LED to "Detect" EMF by using the A5 Analog Pin and when I've hooked up the Volt Meter I've got from Sparkfun I had it sometimes max out which is supposed to be starting at 0 volts then reads out the EMF as a voltage.
Here's the Original LED code he done
// Aaron ALAI EMF Detector April 22nd 2009 VERSION 1.0
// aaronalai1@gmail.com
// *future note, put in averaging function to average val which should result in a more
// smooth response from the led. I will give you a hint on how to make an averaging function;
// it involves the use of an array
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
}
I'm gonna use Pin 6 for my Volt Meter so it reads as a EMF known as Miliguass and this would pick it up as a voltage like the REAL one.
is there a way to make it start from 0 volts then max out to 5 volts if it detects a EMF field reading? I've tried modding his code for that and had this with my tricks
// EMF Dectector for Volt Meter v1.0
// 11/7/14
// Coding by SuperScourge A.K.A Christopher Letterle - Doctorsonic@icloud.com
// Made to Detect EMF Fields using a voltage meter & LED
// original code/project by Aaron ALAI - aaronalai1@gmail.com - Credit goes to him for the Code
// without his simple code I couldn't try out my own version of his EMF Detector Code
int inPin = 5; //analog 5
int val = 0; // where to store info from analog 5
//int pin11 = 11; // output of red LED
// int pin6 = 6; // Power indicator of LED (Test only - to see if lights up as a power inidcator)
int pin6 = 6; // output of Analog Volt Meter
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(inPin);
if(val >=1){
val = constrain(val, 100, 0); // mess with these values
val = map(val, 1, 100, 1, 300); //to the change the response distance of the device
// analogWrite(pin11, val); // note also messing with the resistor of the device
analogWrite(pin6, val); // should change the sensitivity
// analogWrite(pin11, val); just turns on the led with
// the intensity of the variable Val
// also with my code analogWrite(pin16, val)
// does the same as the LED with variable val
}else{ // the else statement is just telling the microcontroller
// analogWrite(pin11, 0); // to turn off the light if there is no EMF detected
analogWrite(pin6, 0); // to turn off the volt meter if there's no EMF detected
}
Serial.println(val); // use ouput in aid in calibrating
}
it still kinda maxes out instead of starting at 0 volts so it has a good start to detect the EMF Field. - I've just got started with Arudino when I've got it from Sparkfun and mine is the Uno R3