Categories

KY-036 Metal touch sensor module and Arduino example

This time we look at another one of the sensors in the sensor kit – this time its the KY-35 Metal touch sensor module

Very simple – the touch sensor (mosfet) will generate an output when the metal leg of the mosfet is touched. This is then fed to the LM386 amplifier. The amplifier then sends the data to the analog output pin of the module. We then connect this to an Arduino analog input pin

Schematic

In this example you can see that the ‘metal touch’ is a leg of a

Connection

Easy to connect

Code Examples

Again the best way of testing is a basic analog output to serial example

int touchPin = A0;
int sensorValue = 0;
 
void setup () 
{
  Serial.begin (9600);
}
 
void loop () 
{
  sensorValue = analogRead (touchPin);
  Serial.println (sensorValue, DEC);
  delay (1000);
}

Open the serial monitor and touch the sensor – lower value is when I touched the sensor

1023
383
363
365
355
980
970
970

Another example

int analogInput = A0;
int digitalInput = 3;
 
void setup ()
{
  pinMode (analogInput, INPUT);
  pinMode (digitalInput, INPUT);     
  Serial.begin (9600);
}
 
 
void loop ()
{
  float Analog;
  int Digital;
 
  // Current value will be read and converted to the voltage
  analogValue = analogRead (analogInput) * (5.0 / 1023.0); 
  digitalValue = digitalRead (digitalInput);
 
  // and outputted here
  Serial.print ("Analog voltage value:"); 
  Serial.print (analogValue, 4);  
  Serial.print ("V, ");
  Serial.print ("Touch input:");
 
  if(digitalValue==1)
  {
      Serial.println (" detected");
  }
  else
  {
      Serial.println (" not detected");
  }
  Serial.println ("----------------------------------------------------------------");
  delay (250);
}

 

Links

Free Shipping 1pcs Metal touch sensor module KY-036 Human Body Touch Sensor 100% new original

Share

Leave a Reply