Introduction: Attiny85 EMF Detector

This is a simple tutorial to create an EMF detector. You can use Arduino for this job, but is better use a microcontroller called Attiny85. It is possible program it throe the Arduino interface.

What is a Magnetic Field [from Wikipedia]

An electromagnetic field (also EMF or EM field) is a physical field produced by electrically charged objects. It affects the behavior of charged objects in the vicinity of the field. The electromagnetic field extends indefinitely throughout space and describes the electromagnetic interaction. It is one of the four fundamental forces of nature (the others are gravitation, weak interaction and strong interaction).

The field can be viewed as the combination of an electric field and a magnetic field. The electric field is produced by stationary charges, and the magnetic field by moving charges (currents); these two are often described as the sources of the field. The way in which charges and currents interact with the electromagnetic field is described by Maxwell's equations and the Lorentz force law. From a classical perspective in the history of electromagnetism, the electromagnetic field can be regarded as a smooth, continuous field, propagated in a wavelike manner; whereas from the perspective of quantum field theory, the field is seen as quantized, being composed of individual particles.

The materials of this project are:

Many of these components are in this KIT

Step 1: The Circuit

First step is create a circuit on the breadboard. Use a breadboard like in photo and try the circuit before solder it on protoboard. After the test you can use a protoboard to connect the attiny85 to leds and antenna.

For upload the code on Attiny85 you can use this shield and a programmer, or your Arduino UNO.

Step 2: The Code

See the code also on GitHub: https://github.com/masteruan/Attiny85_EMF

// EMF Detector Attiny85 and 4 led v1.0
// 23.10.2015
// original code/project by Aaron ALAI - aaronalai1@gmail.com
// modified for use by Giovanni Gentile - giovanni@0lab.it

#define NUMREADINGS 15 // Number of readings

int senseLimit = 15; // Raise this num to decrease sensitivity int val = 0; int antenna = A2;

int LED[] = {2,0,1,3}; // After verify the position of red green and yellow leds

// Variables for smoothing

int readings[NUMREADINGS];

int index = 0;

int total = 0;

int averange = 0;

void setup() {

pinMode(2, OUTPUT);

pinMode(0, OUTPUT);

pinMode(1, OUTPUT);

pinMode(3, OUTPUT);

pinMode(A2, INPUT);

// Test leds on start

for (int i=0; i<4; i++) {

digitalWrite(LED[i],HIGH);

delay(500);

}

for (int i=0; i<4; i++) {

digitalWrite(LED[i],LOW);

}

// Initialize all the readings

for (int i = 0; i < NUMREADINGS; i++) {

readings[i] = 0;

}

}

void loop() {

int val = analogRead(antenna);

if(val >= 1){

val = constrain(val, 1, senseLimit); // turn any readings higher than the senseLimit into the senseLmit

value val = map(val, 1, senseLimit, 1, 1023); // remap the values

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) index = 0;

averange = total / NUMREADINGS;

if (averange > 50) {

digitalWrite(2,HIGH); }

else {

digitalWrite(2,LOW); }

if (averange > 350) {

digitalWrite(0,HIGH); }

else {

digitalWrite(0,LOW); }

if (averange > 750) {

digitalWrite(1,HIGH); }

else {

digitalWrite(1,LOW); }

if (averange > 950) {

digitalWrite(3,HIGH); }

else { digitalWrite(3,LOW); }

}

}

Step 3: Install Arduino IDE and Programming Attiny

Go to www.arduino.cc

Go to Download (https://www.arduino.cc/en/Main/Software)

And select the previous installation of Arduino IDE 1.0.6. This is very IMPORTANT because with the new version of Arduino IDE is impossible to program the Attiny85. After the installation of attiny85 package you can select the Attiny models.

After installation of IDE you can programming the Attiny85 by your Arduino UNO. Then following this tutorial https://www.instructables.com/id/How-to-program-the...

Step 4: Final Result

I have used a perfboard and 4 little leds. The result is more pretty. A micro, open source, portable and geek EMF detector.

The electromagnetics fields now are visible. I use this in my courses. With this I demo the force of electromagnetic field. You can use this EMF detector, near a microwave or fridge or a big power supply. Also the ventilator generate a big electromagnetic filed.

Comments

author
TheProfess0r (author)2017-02-10

I'm kinda of new at circuitry and I don't quite know how to work the circuit on the breadboard, could you help?

author
daryl.rasmusen (author)2016-10-21

What resistors do you use? I'm pretty sure you're not using non-standard 40ohm ones.

author
masteruan (author)daryl.rasmusen2016-10-22

The 4 resistors are for leds. The resistor for probe is 1 M ohm.

author
bcb10 (author)2016-09-11

Excellent circuit! Just finished my own version of your project and wanted to say thanks forbthe inspiration

author
masteruan (author)bcb102016-09-11

Wooo great! Post some photo if you can.
Thank's for your message. I make the Instructables just for people like you :)

author
Akshaypoh (author)2016-05-22

hi thanks for the information I was wondering if you can modify this circuit to measure the level of emf for a particular frequency band .

author
masteruan (author)Akshaypoh2016-05-25

Hi, you can change the resistance for modify the frequency.

author
Akshaypoh (author)masteruan2016-05-25

can you suggest a combination to measure power of 10khz to 10ghz band

author
Captain CFCs (author)2015-11-12

Hi, I was wondering if you had any advice for someone who wants to add a buzzer sound that increases in intensity (similar to a Geiger counter) as opposed to LEDs?

author
masteruan (author)Captain CFCs2015-11-13

Hi,
you can use a simple buzzer. Then Arduino have an excellent library to use the piezo buzzer. You can use "tone(xx,xxx)".

author
Captain CFCs (author)masteruan2015-11-13

Okay, thank you! Very eager to begin construction.

author
Lance_Tronic made it! (author)2015-11-12

Excellent Instructable. Very simple and easy to follow.

I added a slide switch (easier to turn off than it is to pull the battery out of the holder).

I will be testing the sensitivity of different antenna types and lengths. Also I will try to reduce the code to fit the 1kb on the ATtiny13 (because I have heaps of these). Then maybe look into the ATtiny441/ATtiny841 and connect to an LCD Display.

This has given me some ideas for future projects.

Lance.

Will

ATtiny85 EMF.jpg
author
masteruan (author)Lance_Tronic2015-11-12

Thank's
Woow cool!
An LCD is a really good idea. I do not have a switch but is a good upgrade!

Good Work!

author
fraz75 (author)2015-10-29

hi, how is the resistor that you see in the circuit?

author
masteruan (author)fraz752015-10-29

Are the (optional) 4 40 Ohm resistors

author
yakirmalka (author)2015-10-25

NICE!

author
Saiyam (author)2015-10-24

This could be very useful for my workspace. Thank you for this great project :)

author
masteruan (author)Saiyam2015-10-25

I'm glad you can use it. I use it during my workshops.

author
kooth (author)2015-10-24

Very clever and concise! Thanks for posting!

author
masteruan (author)kooth2015-10-25

Great! Thanks :-)

author
Ahsan Babu (author)2015-10-24

Its cool

author
alcurb (author)2015-10-23

Interesting device.

How sensitive is it in terms of things you sensed with it?

Is it frequency dependent? Seems that the little coil antenna would resonate mostly with the microwave band.

You can use it as a lurker detector. Most people keep their cell phones turned on, on their person. Your device can act an alarm when someone is near.

author
masteruan (author)alcurb2015-10-23

I tried it with a microwave, refrigerator, fan and motors 3d printer.

author
godfish (author)2015-10-23

Why are the 4 40 ohm resistors optional? Are they for the LEDs.

author
masteruan (author)godfish2015-10-23

Yes, exactly. For the leds.