Turn Lcd On And Off With Push Button Using Arduino

About the project

In this tutorial we are going to Turn ON or OFF the I2C LCD using a button & Arduino.

Project info

Difficulty: Easy

Platforms: ArduinoDFRobotVisuino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Breadboard (generic) Breadboard (generic) x 1
Resistor 1k ohm Resistor 1k ohm x 1
DFRobot Gravity:Digital Push Button (Yellow) DFRobot Gravity:Digital Push Button (Yellow) x 1
Arduino UNO Arduino UNO x 1
DFRobot I2C 16x2 Arduino LCD Display Module DFRobot I2C 16x2 Arduino LCD Display Module x 1

Software apps and online services

Visuino Visuino
Arduino Web Editor Arduino Web Editor
Arduino IDE Arduino IDE


Step 1: What You Will Need

1 / 7

  • Arduino UNO (or any other Arduino or ESP)
  • LCD I2C
  • 1K ohm resistors
  • LED
  • Button
  • Jumper wires
  • Breadboard
  • Visuino program: Download Visuino

Step 2: Brought by PCBWay

Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.

What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!

Go check them out here. They also offer a lot of other stuff in case you might need it like assembly3D printingCNC machining and a lot more.

Step 3: The Circuit

  • Connect LCD pin [SCL] to Arduino pin [SCL]
  • Connect LCD Display pin [SDA] to Arduino pin [SDA]
  • Connect LCD Display pin [VCC] to the breadboard positive pin [5V]
  • Connect LCD Display pin [GND] to the breadboard pin [GND]
  • Connect Arduino Digital pin [4] to the Resistor and button
  • Connect other side of the resistor to the breadboard pin [GND]
  • Connect Other pin of the button to the breadboard positive pin [5V]

Step 4: Start Visuino, and Select the Arduino UNO Board Type

1 / 2

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 5: In Visuino Add Components

1 / 3

  • Add "Debounce Button" component
  • Add "Toggle(T) Flip-Flop" component
  • Add "Liquid Crystal Display (LCD) - I2C" component

Step 6: In Visuino Set Components

1 / 5

  • Select "LiquidCrystalDisplay1" and in the properties window set "Columns" to 20 and "Rows" to 4

Note: if you are using a different LCD that is not 20X4 then use Columns and Rows for that LCD

  • Select "LiquidCrystalDisplay1" and in the properties window select "Enabled" and click on the pin icon and select "Boolean SinkPin"
  • Double click on the "LiquidCrystalDisplay1" and in the "Elements" window drag "Text Field" to the left and in the properties window set "Initial Value" to ARDUINO
  • Close the "Elements" window

Step 7: In Visuino Connect Components

  • Connect Arduino digital pin[4] to "Button1" pin [In]
  • Connect "Button1" pin [Out] to "TFlipFlop1" pin [Clock]
  • Connect "TFlipFlop1" pin [Out] to "LiquidCrystalDisplay1" pin [Enabled]
  • Connect "LiquidCrystalDisplay1" pin I2C [Out] to Arduino pin I2C [In]

Step 8: Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Step 9: Play

If you power the Arduino module, The Display will show the Text, if you press the button, the Display will Turn On or Off.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it and open it in Visuino: https://www.visuino.eu

Schematics, diagrams and documents

Visuino File


Visuino File


Photo of Ron


Arduino Developer


Leave your feedback...