Nextion Display Page Change With Arduino and Visuino

by RonFrtek in Circuits > Arduino

127 Views, 1 Favorites, 0 Comments

Nextion Display Page Change With Arduino and Visuino

Nextion Display Page Change with Arduino and Visuino

Learn how easy it is to make a simple Page Change using Nextion display with Arduino and Visuino.

By using 1 or 3 buttons we can shift between pages. This is just an example to learn how everything works so that you can later use it in your own projects.

Watch the Video!

What You Will Need

nextion-display.jpg
download.jpg
jumper-wires.jpg
button.png
VisuinoAdvrtisemenPortentaC33-small.png
nextion-editor.jpg
breadboard.png
FZEK4WBK3XGYAP0.LARGE.jpg
  1. Arduino UNO (or any other board)
  2. Nextion Display
  3. 3X Button
  4. 3\x 1K ohm resistor
  5. Breadboard
  6. Jumper wires
  7. Nextion Editor program: Download Nextion
  8. Visuino program: Download Visuino


The Circuit

2024-10-23_12-23-37.jpg
2024-10-23_15-45-29.jpg
  1. Connect Nextion Display VCC red wire to Arduino 5V pin
  2. Connect Nextion Display GND black wire to Arduino GND pin
  3. Connect Nextion Display Yellow wire (RX) wire to Arduino TX pin
  4. Connect Nextion Display Blue wire (TX) wire to Arduino RX pin


  1. Connect Arduino pin [5V] to breadboard positive pin [Red line]
  2. Connect Arduino pin [GND] to breadboard negative pin [Black line]
  3. Connect Arduino Digital pin [2] to button1 on the breadboard and to the Resistor1
  4. Connect other side of the resistor1 to the breadboard pin [GND]
  5. Connect Other pin of the button1 to the breadboard positive pin [5V]
  6. Connect Arduino Digital pin [3] to button2 on the breadboard and to the Resistor2
  7. Connect other side of the resistor2 to the breadboard pin [GND]
  8. Connect Other pin of the button2 to the breadboard positive pin [5V]
  9. Connect Arduino Digital pin [4] to button3 on the breadboard and to the Resistor3
  10. Connect other side of the resistor3 to the breadboard pin [GND]
  11. Connect Other pin of the button3 to the breadboard positive pin [5V]


Note: If you plan to use only one button then connect only first button (Picture2)




Nextion Editor

F8PP3IALZTV44C8.jpg
FVZPTRCLZTV44BO.jpg
FXS5HDLLZTV44AO.jpg
2024-10-23_15-52-46.jpg
FDF5RHHLYPURIP0.jpg
FN345D5LYPURIP7.png
F3FKN27LYPURIPF.png
FRTBSUELYPURIPO.jpg
2024-10-23_15-57-03.jpg
FZKBLXXLZTV44A7.jpg
FZ31POFLZTV44A6.jpg
  1. Download Nextion Editor and Install it
  2. Start Nextion Editor
  3. In the Nextion Editor click on the "New" button
  4. In the Window set the name for the Project like "Scope"
  5. In the "Setting" window select the Model of your Nextion Display & click "Ok"
  6. Select Display Direction 90 & click "Ok"
  7. On the right side in the "Page" window add 3 pages (see the picture)
  8. On each page you can add whatever you like in my case I added text element to each page
  9. In the Editor on the left in the "Toolbox" find:


  1. To add Text element:
  2. In the Menu select "Tools">"Font Generator"
  3. In the Font creator window set the "Height" to 40 & set the name for your font and click "Generate Font", Save the Font, you will be asked "Add the generated font?" Click Yes
  4. In the Editor on the left in the "Toolbox" find:  "Text" & drag it to the right and in the properties set "txt" to your desired text



  1. In the Toolbar click on the "Compile" button
  2. In the Menu Select "File" > "TFT File Output"
  3. Set the Output folder & click on the "Output" button
  4. Save the File to the SD card
  5. Insert the SD card to your Nextion Display
  6. Power the Arduino and you will notice that the Nextion Display will start to Update it self
  7. On the Finish disconnect the power and remove the SD card from the Nextion display


Start Visuino, and Select the Arduino UNO Board Type

select-board-uno.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

Using Three Buttons - in Visuino Add & Connect Components

F9TGB4ZL1P0GJHI (1).jpg
FZFFV2GLZTV4550.jpg
2024-10-23_15-10-55.jpg
2024-10-23_15-11-11.jpg
2024-10-23_15-11-26.jpg
2024-10-23_15-11-40.jpg
2024-10-23_15-17-08.jpg
Nextion-pages.png


If you plan to use 3 buttons, one for each page then use this approach:


  1. Add 3X "Debounce Button" component
  2. Add "Nextion Display" component
  3. Double click on the "DisplayNextion1" And in the Elements window drag "Activate Page" to the left side and in the properties window set "Element Name" to page0
  4. drag another "Activate Page" to the left side and in the properties window set "Element Name" to page1
  5. drag another "Activate Page" to the left side and in the properties window set "Element Name" to page2
  6. Close the Elements window


  1. Connect Arduino digital pin [2] to "Button1" pin [In]
  2. Connect Arduino digital pin [3] to "Button2" pin [In]
  3. Connect Arduino digital pin [4] to "Button3" pin [In]
  4. Connect "Button1" pin [Out] to "DisplayNextion1" > "Activate Page1" pin [Clock]
  5. Connect "Button2" pin [Out] to "DisplayNextion1" > "Activate Page2" pin [Clock]
  6. Connect "Button3" pin [Out] to "DisplayNextion1" > "Activate Page3" pin [Clock]
  7. Connect "DisplayNextion1" pin [Out] to Arduino serial pin [In]


Using One Button - in Visuino Add & Connect Components

2024-10-23_15-26-01.jpg
2024-10-23_15-26-30.jpg
2024-10-23_15-27-15.jpg
2024-10-23_15-27-33.jpg
F9TGB4ZL1P0GJHI (1).jpg
FZFFV2GLZTV4550.jpg
2024-10-23_15-10-55.jpg
2024-10-23_15-11-11.jpg
2024-10-23_15-11-26.jpg
2024-10-23_15-11-40.jpg
Nextion-pages2.png
2024-10-23_15-31-38.jpg

If you plan to use 1 button to change pages then use this approach:


  1. Add "Counter" component and in the properties window set "Max" > "Value" to 2 (Number of pages 0 to 2) and "Min"> "Value" to 0
  2. Add "Clock Demux(Multiple Output channel Switch)" component and in the properties window set "Output Pins" to 3


  1. Add "Debounce Button" component
  2. Add "Nextion Display" component
  3. Double click on the "DisplayNextion1" And in the Elements window drag "Activate Page" to the left side and in the properties window set "Element Name" to page0
  4. drag another "Activate Page" to the left side and in the properties window set "Element Name" to page1
  5. drag another "Activate Page" to the left side and in the properties window set "Element Name" to page2
  6. Close the Elements window


  1. Connect Arduino digital pin [2] to "Button1" pin [In]
  2. Connect "Button1" pin [Out] to "Counter1" pin [In]
  3. Connect "Counter1" pin [Out] to "ClockDemmux1" pin [In]
  4. Connect "ClockDemmux1" pin [0] to "DisplayNextion1" > "Activate Page1" pin [Clock]
  5. Connect "ClockDemmux1" pin [1] to "DisplayNextion1" > "Activate Page2" pin [Clock]
  6. Connect "ClockDemmux1" pin [2] to "DisplayNextion1" > "Activate Page3" pin [Clock]
  7. Connect "DisplayNextion1" pin [Out] to Arduino serial pin [In]



Generate, Compile, and Upload the Arduino Code

FR51O5BLZTV45X4.jpg
Visuino-Compile-UNO.jpg

Before Uploading Disconnect RX pin on Arduino and connect it back after the Upload.

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, press the buttons and the pages on the Nextion display will change.

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