top of page

Make Electromagnetic /Magnetic field detector system with Arduino

  • Writer: Ujash Patel
    Ujash Patel
  • Oct 23, 2016
  • 1 min read

Hello today we are going to learn about electromagnetic / Magnetic Field Detector with Arduino . There is no reason to explain about electromagnetic field or magnetic field . so just start with component you want

List of component

1.arduino board

2.Magnet

3.Piezo electric buzzer

4.Reed switch module

5.general purpose pcb or breadboard

Step 1: Connection

Simply we have to connect

Reedswitch

+5 - Arduino 5 v

Gnd - Arduino ground

Signal - Arduino Pin no 12.

Buzzer

+5 - Arduino 5 v

Gnd - Arduino Ground

Signal - Arduino Pin no 3.

Step 2: Program

int out =2; // The speaker is on pin 2

int led = 13;

const int buttonPin = 12; // connect reedswitch sensor

int buttonState = 0; void setup() {

pinMode(buttonPin, INPUT); pinMode(out, OUTPUT); pinMode(led,OUTPUT); }

void loop() { buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {

digitalWrite(led,HIGH); // turn LED on:

}

else

{

digitalWrite(led,LOW);

unsigned char i, j ;

for (i = 0; i <80; i++){ // number of cycles to sound

digitalWrite (out, HIGH); // turn buzzer ON

delay (1) ;// Delay 1ms set frequency 1

digitalWrite (out, LOW); // turn buzzer OFF

delay (1) ;// delay ms

}

for (i = 0; i <100; i++){ // number of cycles to sound

digitalWrite (out, HIGH); // turn buzzer ON

delay (2) ;// delay 2ms set frequency 2

digitalWrite (out, LOW); // turn buzzer OFF

delay (2) ;// delay 2ms

}

} }

Visit Full Instructable Here

Comments


© 2016 by Ujash patel (Reasercher Mechatronic And Robotics System )

  • Facebook Clean Grey
  • Twitter Clean Grey
  • LinkedIn Clean Grey
Let the future tell the truth, and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I have really worked, is mine.  - Nikola Tesla
 
bottom of page