TruePatrick
Published © GPL3+

EMF Detector Using ATtiny24A-PU

This simple project will make you feel proud of yourself.

BeginnerFull instructions provided1,236
EMF Detector Using ATtiny24A-PU

Things used in this project

Hardware components

ATtiny24A
Microchip ATtiny24A
×1
Resistor 1M ohm
Resistor 1M ohm
×1
Resistor 221 ohm
Resistor 221 ohm
OPTIONAL - to leds
×7
3 mm LED: Red
3 mm LED: Red
×11

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Connections

I didn't want to use fritzing program because of lacks of elements.

Code

Arduino Code of this project

Arduino
// EMF Detector Attiny85 and 4 led v1.0// 23.10.2015// original code/project by Aaron ALAI - aaronalai1@gmail.com// modified for use by Patryk Bedkowski - bedkowskisite@gmail.com

#define NUMREADINGS 15 // Number of readings
int senseLimit = 16; // Raise this num to decrease sensitivity
int val = 0; 
int antenna = A7;
int LED[] = {0,1,2,3,4,5,6}; // 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() {
  for(int i=0;i<7;i++){
    pinMode(i, OUTPUT);
  }
pinMode(antenna, INPUT);
// Test leds on start
for (int i=0; i<7; i++) {
digitalWrite(LED[i],HIGH);
delay(250);
}
for (int i=0; i<7; 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
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 > 380) {
digitalWrite(0,HIGH);}
else{digitalWrite(0,LOW);}

if (averange > 480){
digitalWrite(1,HIGH);}
else{digitalWrite(1,LOW);}

if (averange > 580){
digitalWrite(2,HIGH);}
else{digitalWrite(2,LOW);}

if (averange > 680){
digitalWrite(3,HIGH);}
else{digitalWrite(3,LOW);}

if (averange > 780){
digitalWrite(4,HIGH);}
else{digitalWrite(4,LOW);}

if (averange > 830) {
digitalWrite(5,HIGH);}
else {digitalWrite(5,LOW);}

if (averange > 900) {
digitalWrite(6,HIGH);}
else {digitalWrite(6,LOW);}
}}

Credits

TruePatrick

TruePatrick

0 projects • 0 followers

Comments