TinyEMF Detector

The next device for my attiny85 to tackle is a tiny EMF detector. So I saw a video from Make magazine on youtube, which then linked me to another random youtuber who had originally done this for their arduino. Essentially the original user had just a single LED which was showing the EMF strength vida LED intensity, the Make guy kind of just improved on that buy using a bar graph and now in the ultimate show of one up-man-ship I decided to move this project over to the ATtiny85 because why waste all those arduino pins.

To find the original video go here http://www.aaronalai.com/emf-detector

The Make magazine article is here http://makezine.com/2009/05/15/making-the-arduino-emf-detector/

The code is here and for the most part it’s a copy of the original code

int aOut2 = 0;
long EMFval = 0;
int averaging = 0 ;
int EMFread = 1;
int sample = 25; // number of samples per read
int sensingRange = 100; // the max expected analog response
void setup() {
// put your setup code here, to run once:

void loop() {
for (int x =0; x < sample ; x ++) {
averaging = analogRead(EMFread)+ averaging;
EMFval = averaging / sample ;
//Serial.println (EMFval);
EMFval = constrain (EMFval, 0, sensingRange);
EMFval = map (EMFval,0,sensingRange,0,255);

analogWrite (aOut2, EMFval);
averaging = 0;



The difficult part clearly wasn’t going to be the code since well I copied the crap out of that. The tricky parts were the pin constraints. Now the hardware required for this project is as follows : 

LM3915 bar graph driver

10LEDS or a bar graph (I used 10 leds because I had them lying around.

0.1 uf Cap

10K resister

1K resister

2x100k resister

500K resister

1 push button


5V 1A regulator (if you want to have it fun off batteries or an unregulated supply)

9V (and battery) battery adapter (if you want to have it run on batteries)

and some wire

One you have that you can follow this schematic load up the ATTiny and go on finding some interesting fields


I just realized that I didn’t put a button in the schematic, but anyway it’s trivial pick a spot between the power or ground and connect it, that way when you press the button it’ll power up and you can see the fields.  Also I used 400k of resisters because I didn’t have any bigger lying around you can choose bigger or smaller ones based on your needs and just tune the code a bit specifically this variable “sensingRange”.

Here’s a photo of my finished product, I made it a case with my new 3d printer which I will talk about later. Image

As of yet I don’t have a video of it in action because well I didn’t know how to record it nicely, I would like to walk around home and detect things but then you’d have to view it in shakey cam, so if you want to see it in action click the links above to the original folks who did this and watch their demo, it’s essentially the same, mine is just smaller 🙂