Ciao a tutti sto provando a realizzare un emf detector preso da questa guidahttps://www.instructables.com/id/Arduino-Ghost-EMF-Detector/
Arduino nano, 7 led, sui pin digitali ed un'antenna sul pin analogico 5 con resistenza da 3.2M Ohm
Risultato quando carico il codice si accendono a palla tutti i led, guardo il monitor seriale e mi da fisso 1023:

Solo quando stringo l'antenna nella mano il valore scende e si spengono il blu e uno o due rossi!
Ovviamente vorrei che partisse tutto spento e come sente un campo elettromagnetico, segnalasse progressivamente dal verde al blu. Ps ma se ci metto un cellulare che chiama, a contatto con i fili scoperti dell'antenna non dovrebbe variare il livello della rilevazione?
Ho provato a giocare con queste due variabili ma non trovo una quadra sensata:
#define NUMREADINGS 15
int senseLimit = 15;
#define NUMREADINGS 15 // raise this number to increase data smoothing
int senseLimit = 15; // raise this number to decrease sensitivity (up to 1023 max)
int probePin = A5; // analog 5
int val = 0; // reading from probePin
int LED1 = 3; // connections
int LED2 = 4; // to
int LED3 = 5; // LED
int LED4 = 6; // bargraph
int LED5 = 7; // anodes
int LED6 = 8; // with
int LED7 = 9; // resistors
// 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(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
Serial.begin(9600); // initiate serial connection for debugging/etc
for (int i = 0; i < NUMREADINGS; i++)
readings[i] = 0; // initialize all the readings to 0
}
void loop() {
val = analogRead(probePin); // take a reading from the probe
if(val >= 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 > 250){ // and so on ...
digitalWrite(LED2, HIGH);
}
else{
digitalWrite(LED2, LOW);
}
if (average > 500){
digitalWrite(LED3, HIGH);
}
else{
digitalWrite(LED3, LOW);
}
if (average > 600){
digitalWrite(LED4, HIGH);
}
else{
digitalWrite(LED4, LOW);
}
if (average > 700){
digitalWrite(LED5, HIGH);
}
else{
digitalWrite(LED5, LOW);
}
if (average > 800){
digitalWrite(LED6, HIGH);
}
else{
digitalWrite(LED6, LOW);
}
if (average > 900){
digitalWrite(LED7, HIGH);
}
else{
digitalWrite(LED7, LOW);
}
Serial.println(val); // use output to aid in calibrating
}
}



