Introduction: Simple Metal Detector Using Arduino
What Will I Learn?
You will learn how to use a KY-036 metal touch sensor.
You will learn how to integrate the KY-036 metal touch sensor with the arduino uno board.
You will learn how to program the arduino uno to make use of the metal touch sensor module.
Step 1: Description
This is a simple project that utilizes the use of a metal touch sensor with the arduino uno board. The metal touch sensor is connected to the arduino uno board as the input to detect any electrical connectivity (i.e. human body) and the LED & buzzer are the outputs. Once the sensor is touched by a conducting body, It will trigger the switch then sends that data into the arduino uno board and thus turning the LED & buzzer on .
Step 2: Requirements
Hardware:
Arduino Uno
Metal touch sensor( KY-036)
LED
Resistor(220 ohms)
Breadboard
Jumper wires
USB type A to B cable
Computer
Software
Arduino IDE
Step 3: Circuit Diagram
Connect the LED
Connect the anode(+) of the LED to a 220 ohm resistor that is connected to pin number 7 of the arduino uno board. This resistor will protect the LED from over supply of current.
Connect the cathode(-) of the LED to the common ground.
Connect the sensor
Connect the + pin of the metal touch sensor to the voltage source(+) in the breadboard.
Connect the GND pin of the metal touch sensor to the common ground(-) in the breadboard.
Connect the D0 (digital pin) of the metal touch sensor to pin number 9 of the arduino uno board.
connect the buzzer
connect the buzzer + pin to pin number 8
connect the buzzer - pin to pin number GND
Step 4: Code
int ledpin = 7 ; // sets the LED @pin 7 int touchpin = 9; // sets the KY-036 metal touch sensor @pin 9 int buzzer= 8; int value ; // defines the numeric variables as value void setup () { pinMode (touchpin, INPUT) ; // sets the metal touch sensor as INPUT pinMode (ledpin, OUTPUT) ; // sets LED as the OUTPUT pinMode (buzzer, OUTPUT); } void loop () { value = digitalRead (touchpin) ; // reads the value of the touchpin if (value == HIGH) // If the value is HIGH { digitalWrite (ledpin, HIGH); // It will turn the LED ON, indicating that the sensor has been triggered digitalWrite (buzzer, HIGH); } else //otherwise { digitalWrite (ledpin, LOW); // LED is turned off if sensor is not triggered digitalWrite (buzzer, LOW); } }