keyes- 036 and LCD on arduino

in #utopian-io6 years ago (edited)

What Will I Learn?

  • how was the metal touch works on arduino
  • how to program a code on arduino Desktop IDE
  • how to connect all the components connection using diagram
  • how to connect LCD 16X2 on arduino uno.
  • 20180312_145522.jpg


    • Step 1: Gather all the Requirements


  • Breadboard or PCB
  • LCD 16X2 with i2 breakout
  • keyes ky- 036 metal touch sensor
  • jumper wires
  • Type B usb cable
  • Arduino UNO R3 board
  • PC
  • Difficulty

    • Basic

    Tutorial Contents


    Step 2 : Dowload the Software and Libraries
    If you’re ready to get started, click on the link below then select the version with your operating system.
    Dowload the arduino Desktop IDE:
    When the download is finished, un-zip it and open up the Arduino folder to confirm that click yes, there are some files and sub-folders inside. The file structure is important so don’t be moving any files around unless you really know what you’re doing.

    Download the liquidcrystal LCD library : This library is a modified version of the H. Mario LiquidCrystal_I2C V.2.0 lib.

    • Step 3: Include libraries to arduino IDE


    Once installed the Arduino desktop IDE. open the software then locate the SKETCH tab at the top of the software, navigate ADD ZIP LIBRARY >> then look for the downloaded libraries in the download folder. SELECT the zip file then wait for the process. include all the libraries fo liquidcrystal display.

    Experimental Procedures

    Step 4: Build the circuit

    The arduino UNO R3


    it has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. 32k Flash Memory, 


    codes and programs can be uploaded on to it from the easy Arduino computer program. which makes it a very easy way to get started working with embedded electronics. The name R3 is the third, and latest version of Arduino Uno Board

    • Connection of LCD 16X2 to arduino

    The 16x 2 LCD with I2C module you will be able to connect the LCD with Arduino board with only two Data cables! The i2c module has a built in potentiometer bakpack for contrast adjustment. The 16x2 display is the set up LCD number of columns and rows ( 16 columns, 2 rows Display ).


    The LCD has 4 pins (1) VCC it refers to the power signal of the LCD typically connected to 5volts, (2)GND or sometimes zero voltage, It is also the common connection of the LCD must connect to in one way or another path in order to complete the circuit. (3) SDA and (4) SCL is the i2c serial bus pin it is used to synchronize all data transfers over the I2C bus from the 16 pin of the normal LCD, Both SCL and SDA are connected to analog pin ouputs of the arduino beacasue i2c lines are open drain drivers, means is that the chip can drive its output low.


    LCD Pin output connection to arduino

  • GND- GND
  • VCC - 5V
  • SCL - A4
  • SDA - A5
  • The Metal touch sensor


    A metal touch sensor is a type of switch that only operates when it's touched by a charged body. It has a high-frequency transistor which can conduct electricity when receiving electromagnetic signals. reference

    the keyes - 036 has 4 pins the power pins GND / VCC , the analog pin AO and the Digital pin output D0, use the digital pin output DO for sensor pin of the module to arduino.


    connection to arduino

    • GND - GND
    • VCC - 5V
    • DO- D2

    • Step 5: Building the code

    Open the arduino Desktop iDE then type the codes


    #include  // include wire .h file 
    #include  // include the i2c LCD library 
    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // 16X2 lcd display address
    int pin = 2; // pin connection of metal touch

    void set.png

    void setup()
      lcd.begin(16,2);  // initialize the lcd 
      lcd.print("METAL TOUCH"); // text to be displayed on the LCD when boot up
      delay(1000); // delay time of the TEXt 1000 is equal to 1 seconds


    void loop()
      lcd.setCursor(1, 0); // first row cursor of the lcd
      lcd.print("Metal Touch"); // text displayed on the lcd 
      int val = digitalRead(pin); // reads the value of the touchpin
      lcd.setCursor(0, 2); // 2nd row cursor
      if(true == IsTouchec(pin)) // Text that the sensor has been triggered
        lcd.setCursor(0,2); // text displayed at the 2nd row of the LCD
        lcd.print("Sensor=Touch "); 
      else // otherwise
        lcd.setCursor(0,2); // text displayed at the 2nd row of the LCD
        lcd.print("Sensor=None "); // text that the sensor is not triggered
    bool IsTouchec(int p)
     int time = 0;
       if (HIGH == digitalRead(p)) return true;
     } while (time++<15);
     return false;
    • Step 6: copy the sketch code to arduino IDE sketch bar. click the UPLOAD icon on the upper right side toggle, it will automatically compile the sketch to check if theres an error with the code before uploading to the arduino board.


    • once the code is successfully uploaded to the board touch the electrode of the transistor with your fingers, this should chenge the none touch to TOUCH on the LCD indicate that the sensor has been triggered.

    I hope this Tutorial might help you on your future activity. thank you.

    Posted on - Rewarding Open Source Contributors


    Thank you for the contribution. It has been approved.

    • Geek

    You can contact us on Discord.

    Hey @lapilipinas I am @utopian-io. I have just upvoted you!


    • Seems like you contribute quite often. AMAZING!


    • Contribute more often to get higher and higher rewards. I wish to see you often!
    • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

    Get Noticed!

    • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

    Community-Driven Witness!

    I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!


    Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord

    Coin Marketplace

    STEEM 0.33
    TRX 0.14
    JST 0.041
    BTC 66943.88
    ETH 3714.45
    USDT 1.00
    SBD 5.23