Transform EMF Voltage into Frequency

Hi All,

I have very limited programming experience, I am looking for some help. I am trying to make my own DIY EMF detector using the following :

I was able to recreate the assembly fairly easily, as well as upload the code to my Uno.

I would like to create a frequency (magnitude of signal(s) per second) from the analog input that feeds into pin 5. I was able to do this using a while loop as millis()<= 1000 but for only one second.

I do not know how to take this further so that it will run indefinitely. Any help would be much appreciated.

The code for the EMF is below, along with what I was able to add.

define sample 500 //this is how many samples the device takes per reading

int inPin = 5; float val; int start;

unsigned long averaging; //the program uses this variable to store the sum of each array it makes unsigned long inputRead;

void setup() { Serial.begin(9600); inputRead = analogRead(inPin); }

void loop() {

for(int i = 0; i < sample; i++){ //this code tells the program to fill each element in the array we made with array1 = analogRead(inPin); //information from the antenna wire coming out of the Arduino _ averaging += array1*;_ _*start = millis(); // take the start time_

while((millis()-start < 1000)){ // do the following loop for 1000ms = 1 second * inputRead ++;* * Serial.println(inputRead);* }

OK, never did find an actual drawing of the device itself. Most devices like this are more a novelty item than actual measuring instrument. All the code will do is produce a number but the number only correlates to a bit count. EMF is one of those things that can be debated because I learned EMF as Electromotive Force and the unit of measure is the Volt. Now if we want to make EMF Electromagnetic Force then the units of measure are:

Magnetic Fields Magnetic fields are usually measured in microteslas (┬ÁT)

Multiple used for large fields: 1 millitesla = 1000 microteslas or small fields: 1 nanotesla = 0.001 microteslas Other units are sometimes used:

1 milligauss = 0.1 microteslas (milligauss is common in the USA) 1 ampere per metre = 1.25 microteslas (this conversion for amperes per metre is only true for air and other non-magnetic materials. It changes in the pressure of magnetic materials such as iron.)

Your code nor the linked code mentions any units or measure? Nothing I can find.

Magnetic field is not measured as a frequency and frequency is measured as Hz (Hertz) There is no conversion between Gauss and Hz. Then you mention Magnitude which my best guess for the context used would be Amplitude which can be expressed several ways.


magnitude of signal(s) per second

Huh? That's meaningless! A frequency is a number of cycles per second (unit hertz).

Do you mean a rate of change ?