Turn LCD on and Off With Push Button Using Arduino

by RonFrtek in Circuits > Arduino

902 Views, 2 Favorites, 0 Comments

Turn LCD on and Off With Push Button Using Arduino

Turn LCD On and Off With Push Button Using Arduino

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

What You Will Need

i2c-1602-lcd-display-module-500x500.jpg
resistor-1k-ohm-14w-5.jpg
button.png
FMT2X9VKEY93G5P.jpg
FNLOD2CKEY93G5N.jpg
VisuinoAdvrtisemenESPNowESP32C3-1.jpg
breadboard.png
  • Arduino UNO (or any other Arduino or ESP)
  • LCD I2C
  • 1K ohm resistors
  • LED
  • Button
  • Jumper wires
  • Breadboard
  • Visuino program: Download Visuino


Brought by PCBWay

2022-08-26_13-41-18.jpg

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.

The Circuit

2022-09-30_15-46-33.jpg
  • 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]


Start Visuino, and Select the Arduino UNO Board Type

F5ZAEMUK36U3RS2.LARGE.jpg
Visuino-Select-Board-UNO.jpg

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

In Visuino Add Components

2022-09-30_11-27-51.jpg
2022-09-30_11-27-18.jpg
2022-09-30_11-28-37.jpg
  • Add "Debounce Button" component
  • Add "Toggle(T) Flip-Flop" component
  • Add "Liquid Crystal Display (LCD) - I2C" component

In Visuino Set Components

2022-09-30_11-28-57.jpg
2022-09-30_11-29-22.jpg
2022-09-30_11-29-47.jpg
2022-09-30_11-30-03.jpg
2022-09-30_11-30-22.jpg
  • 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

In Visuino Connect Components

2022-09-30_11-31-28.jpg
  • 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]

Generate, Compile, and Upload the Arduino Code

FBR42I2KXBU01YW.jpg

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.

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