Metal Touch Sensor Module [S042] 



https://www.youtube.com/watch?v=rF92w77SAuI


*GitHubhttps://github.com/rdiot/rdiot-s042.git


* Specs

Color: red

Main chip: LM393

Operating voltage: DC 5V

Light weight design

With single channel signal output

Low level output signal used for human body touch sensor alarm

Compatible with Arduino



* Contents

- Connect

A0 ----- X

G ----- GND

+ ----- 5V

D0 ----- D2


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

 

int pin = 2;

 

LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004

 

void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");

 

  pinMode(pin,INPUT);

  delay(1000);

 

  lcd.clear();

}

 

void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("S042:Metal Touch");

 

  int val = digitalRead(pin);

 

  lcd.setCursor(0,1);

  lcd.print("digital=" + (String)val + " ");

 

  if(true == IsTouchec(pin))

  {

    lcd.setCursor(0,2);

    lcd.print("IsTouch=Touched   ");

  }

  else

  {    

    lcd.setCursor(0,2);

    lcd.print("IsTouch=None    ");

  }

 

}

 

bool IsTouchec(int p)

{

 int time = 0;

 do

 {

   if (HIGH == digitalRead(p)) return true;

   delay(1);

 } while (time++<15);

 return false;

}

Posted by RDIoT
|

Catalex Capacitive Touch Sensor (TTP223B) [S009]



https://www.youtube.com/watch?v=ITHiTfEC2CE


*GitHubhttps://github.com/rdiot/rdiot-s009.git



* Specs

This device uses your body as part of the circuit.  When you touch the sensor pad, the capacitance of the circuit is changed and is detected.  That detected change in capacitance results in the output changing states.

When I first got this,  I expected a glitchy device,  that while functional,  would occasionally have unpredictable output results.

I may have been wrong.   After playing for a few hours, I can’t seem to get it to do anything other than what I expected it to do.  If you’re looking for robust user input,  this might do the trick.



* Contents

- Key Code

#define ctsPin 14 // Pin for capactitive touch sensor

 

int ledPin = 13; // pin for the LED

 

void setup() {

  Serial.begin(9600);

  pinMode(ledPin, OUTPUT);  

  pinMode(ctsPin, INPUT);

}

 

void loop() {

  int ctsValue = digitalRead(ctsPin);

  if (ctsValue == HIGH){

    digitalWrite(ledPin, HIGH);

    Serial.println("TOUCHED");

  }

  else{

    digitalWrite(ledPin,LOW);

    Serial.println("not touched");

  } 

  delay(100);

  

}

'2) Sensor > Touch' 카테고리의 다른 글

Digital Touch Sensor Module Capacitive Switch [S243]  (0) 2017.02.28
Metal Touch Sensor Module [S042]  (0) 2016.09.12
Posted by RDIoT
|

Button Switch Module [S062] 



https://www.youtube.com/watch?v=s31LVVFs71E


*GitHubhttps://github.com/rdiot/rdiot-s062.git



* Specs

Weight:10 g

Color: as picture show

Size:35mmx23mmx1mm/1.38"x0.91"x0.04"(inch) (approx)

What is an electronic brick? An electronic brick is an electronic module which can be assembled like Lego bricks simply by plugging in and pulling out. Compared to traditional universal boards and circuit modules assembled with various electronic components, electronic brick has standardized interfaces, plug and play, simplifying construction of prototype circuit on one's own. There are many types of electronic bricks, and we provide more than twenty types with different functions including buttons, sensors, Bluetooth modules, etc, whose functions cover from sensor to motor drive, from Ethernet to wireless communication via Bluetooth, and so on. We will continue to add more types to meet the various needs of different projects.

Electronic brick of button switch is finger-sized, which can be connected to I/O port of main board or externally disconnected to check the switch state so as to control ON/OFF of LED lamp.

Features:

1. Plug and play, easy to use. Compatible with the mainstream 2.54 interfaces and 4-Pin Grove interfaces in the market.

2. With use of M4 standard fixed holes, compatible with M4-standard kits such as Lego and Makeblock

3. Hardware with debouncing function for more stable output


* Contents

- Connect

G ----- GND

V ----- 5V

S ----- D2


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

 

LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004

 

int button=2; //connect button to D2

 

void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");

 

  delay(1000);

 

  lcd.clear();

}

 

void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("S062:Button Module");

 

  lcd.setCursor(0,1);

  lcd.print("btn_read=" + (String)digitalRead(button) + "  ");

 

 

  lcd.setCursor(0,2);

  if(digitalRead(button)==HIGH) 

  {

     lcd.print("STAT = OFF ");

  }

  else if(digitalRead(button)==LOW) 

  {

     lcd.print("STAT = ON ");

  }

 

}

'2) Sensor > Button' 카테고리의 다른 글

Key Switch Module (KY-004) [S024]  (0) 2016.09.12
Posted by RDIoT
|