This is the NEXTION HMI a Human Machine Interface device that provides a GUI control of instruments that feeds from your microcontroller. The Nextion is simplified interface to visualize the process between a human and machine, these device is useful on IOT projects or simply an display to your project instead using a traditional LCD or LED display. NEXTION included hardware and series of TFT boards along with a software editor to design your desired interface at the screen. The board uses a one serial communication port to communicate to your Arduino, RPI or AVR, and it works only RX/TX communication and let you avoid hassle of wirings, The NEXTION editor has an ability to provide a drag and drop component such as buttons, Pictures, toggle buttons, slider, progress bar, etc. to ensures that you spend less time in programming your development workloads with the help of WYSIWYG editor. As you can see the diagram we hookup a relay module work as a switch to any home, automotive, & industrial devices.

Required Components

  • Arduino Microcontroller / Tenssy / NodeMCU (Arduino IDE Integration)
  • USB  TTL- UART  Serial (CP2XX)/(PL2XX) will work
  • Relay Module (4 to 8 channel)
  • Jumper Wires / DuPont Wires

Wiring Guide

Uploading the HMI File with NEXTION GUI Editor

  • Nextion editor can be download here > http://nextion.itead.cc/download.html
  • Download the HMI File below

Source Code

Downloads

Download the GUI Editor software > http://nextion.itead.cc/download.html
Designer Starter Guide > http://wiki.iteadstudio.com/Nextion_Editor_Quick_Start_Guide

Wiring The HMI NEXTION TFT Touch Display on 6 Channel Relay Module with Microcontroller
Facebooktwittergoogle_plusredditpinterestmail
Tagged on:                             

7 thoughts on “Wiring The HMI NEXTION TFT Touch Display on 6 Channel Relay Module with Microcontroller

  • at
    Permalink

    Super guideline. Everything included and very helpful. Thank you.

    Reply
  • at
    Permalink

    great Tutorial.
    Some days ago i try to run/upload to Wemos D1 R2 ESP8266 and found some occured. Please help me to solve til it work. This Hardware and software i used :
    – Nextion 3.2″ Standart/Basic
    – Wemos D1 R2 ESP8266
    – Arduino IDE

    This is errors occured :

    Arduino: 1.8.1 (Windows XP), Board: “WeMos D1 R2 & mini, 80 MHz, 921600, 4M (1M SPIFFS)”
    sketch_apr03a:7: error: ‘NexDSButton’ does not name a type
    NexDSButton bt0 = NexDSButton(0, 1, “bt0”);
    ^
    sketch_apr03a:8: error: ‘NexDSButton’ does not name a type
    NexDSButton bt1 = NexDSButton(0, 1, “bt1”);

    sketch_apr03a:18: error: ‘bt0’ was not declared in this scope
    &bt0, &bt1, &bt2, &bt3, &bt4, &bt5,
    ^
    C:\DOCUME~1\Me\LOCALS~1\Temp\arduino_modified_sketch_560165\sketch_apr03a.ino: In function ‘void setup()’:
    sketch_apr03a:24: error: ‘bt0’ was not declared in this scope
    bt0.attachPop(bt0PopCallback, &bt0);
    ^
    C:\DOCUME~1\Me\LOCALS~1\Temp\arduino_modified_sketch_560165\sketch_apr03a.ino: In function ‘void bt0PopCallback(void*)’:
    sketch_apr03a:41: error: ‘NexDSButton’ was not declared in this scope
    NexDSButton *btn = (NexDSButton *)ptr;
    ^
    sketch_apr03a:41: error: ‘btn’ was not declared in this scope
    NexDSButton *btn = (NexDSButton *)ptr;
    ^
    sketch_apr03a:49: error: ‘bt0’ was not declared in this scope
    bt0.getValue(&dual_state);
    ^
    exit status 1
    ‘NexDSButton’ does not name a type
    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    Thanks a lot for shared with me.

    Reply
      • at
        Permalink

        I was try to uninstall arduino also libraries then install again, put the libraries ESP8266WiFi.zip, ESP8266WebServer.zip and ITEADLIB_Arduino_Nextion-0.7.0 (stable version one). But still not working.
        This is errors message :

        Arduino: 1.8.1 (Windows XP), Board: “WeMos D1 R2 & mini, 80 MHz, 115200, 4M (1M SPIFFS)”
        Touch_Nextion_6_Channel:7: error: ‘NexDSButton’ does not name a type
        NexDSButton bt0 = NexDSButton(0, 1, “bt0”);
        ^
        Touch_Nextion_6_Channel:8: error: ‘NexDSButton’ does not name a type
        NexDSButton bt1 = NexDSButton(0, 1, “bt1”);
        ^
        Touch_Nextion_6_Channel:9: error: ‘NexDSButton’ does not name a type
        NexDSButton bt2 = NexDSButton(0, 1, “bt2”);
        ^
        Touch_Nextion_6_Channel:10: error: ‘NexDSButton’ does not name a type
        NexDSButton bt3 = NexDSButton(0, 1, “bt3”);
        ^
        Touch_Nextion_6_Channel:11: error: ‘NexDSButton’ does not name a type
        NexDSButton bt4 = NexDSButton(0, 1, “bt4”);
        ^
        Touch_Nextion_6_Channel:12: error: ‘NexDSButton’ does not name a type
        NexDSButton bt5 = NexDSButton(0, 1, “bt5”);
        ^
        Touch_Nextion_6_Channel:18: error: ‘bt0’ was not declared in this scope
        &bt0, &bt1, &bt2, &bt3, &bt4, &bt5,
        ^
        Touch_Nextion_6_Channel:18: error: ‘bt1’ was not declared in this scope
        &bt0, &bt1, &bt2, &bt3, &bt4, &bt5,
        ^
        Touch_Nextion_6_Channel:18: error: ‘bt2’ was not declared in this scope
        &bt0, &bt1, &bt2, &bt3, &bt4, &bt5,
        ^
        Touch_Nextion_6_Channel:18: error: ‘bt3’ was not declared in this scope
        &bt0, &bt1, &bt2, &bt3, &bt4, &bt5,
        ^
        Touch_Nextion_6_Channel:18: error: ‘bt4’ was not declared in this scope
        &bt0, &bt1, &bt2, &bt3, &bt4, &bt5,
        ^
        Touch_Nextion_6_Channel:18: error: ‘bt5’ was not declared in this scope
        &bt0, &bt1, &bt2, &bt3, &bt4, &bt5,
        ^
        C:\Documents and Settings\Me\My Documents\Arduino\Touch_Nextion_6_Channel\Touch_Nextion_6_Channel.ino: In function ‘void setup()’:
        Touch_Nextion_6_Channel:24: error: ‘bt0’ was not declared in this scope
        bt0.attachPop(bt0PopCallback, &bt0);
        ^
        Touch_Nextion_6_Channel:25: error: ‘bt1’ was not declared in this scope
        bt1.attachPop(bt0PopCallback, &bt1);
        ^
        Touch_Nextion_6_Channel:26: error: ‘bt2’ was not declared in this scope
        bt2.attachPop(bt0PopCallback, &bt2);
        ^
        Touch_Nextion_6_Channel:27: error: ‘bt3’ was not declared in this scope
        bt3.attachPop(bt0PopCallback, &bt3);
        ^
        Touch_Nextion_6_Channel:28: error: ‘bt4’ was not declared in this scope
        bt4.attachPop(bt0PopCallback, &bt4);
        ^
        Touch_Nextion_6_Channel:29: error: ‘bt5’ was not declared in this scope
        bt5.attachPop(bt0PopCallback, &bt5);
        ^
        C:\Documents and Settings\Me\My Documents\Arduino\Touch_Nextion_6_Channel\Touch_Nextion_6_Channel.ino: In function ‘void bt0PopCallback(void*)’:
        Touch_Nextion_6_Channel:41: error: ‘NexDSButton’ was not declared in this scope
        NexDSButton *btn = (NexDSButton *)ptr;
        ^
        Touch_Nextion_6_Channel:41: error: ‘btn’ was not declared in this scope
        NexDSButton *btn = (NexDSButton *)ptr;
        ^
        Touch_Nextion_6_Channel:41: error: expected primary-expression before ‘)’ token
        NexDSButton *btn = (NexDSButton *)ptr;
        ^
        Touch_Nextion_6_Channel:41: error: expected ‘;’ before ‘ptr’
        NexDSButton *btn = (NexDSButton *)ptr;
        ^
        Touch_Nextion_6_Channel:49: error: ‘bt0’ was not declared in this scope
        bt0.getValue(&dual_state);
        ^
        Touch_Nextion_6_Channel:50: error: ‘bt1’ was not declared in this scope
        bt1.getValue(&dual_state);
        ^
        Touch_Nextion_6_Channel:51: error: ‘bt2’ was not declared in this scope
        bt2.getValue(&dual_state);
        ^
        Touch_Nextion_6_Channel:52: error: ‘bt3’ was not declared in this scope
        bt3.getValue(&dual_state);
        ^
        Touch_Nextion_6_Channel:53: error: ‘bt4’ was not declared in this scope
        bt4.getValue(&dual_state);
        ^
        Touch_Nextion_6_Channel:54: error: ‘bt5’ was not declared in this scope
        bt5.getValue(&dual_state);
        ^
        exit status 1
        ‘NexDSButton’ does not name a type

        This report would have more information with
        “Show verbose output during compilation”
        option enabled in File -> Preferences.

        Reply
  • at
    Permalink

    I am using an Arduino MEGA with this code. I changed pins 2-6 on the 14core output to pins 34-38 on the MEGA. I can see functionality on the serial out of the Arduino seen below, but the command is not sending to the relay switch.. any suggestions?

    [17recvRetCommandFinished ok
    recvRetCommandFinished ok
    setup done
    [1755:0,1,bt0]
    Callback
    ptr=1755
    recvRetNumber :0
    recvRetNumber :1
    recvRetNumber :1
    recvRetNumber :1
    recvRetNumber :1
    recvRetNumber :1

    Reply
    • at
      Permalink

      yes because there is never declare the output’s , that’s the reason !
      just input like that exmp. pinMode(R1, OUTPUT);
      pinMode(R2, OUTPUT);
      pinMode(R3, OUTPUT);
      pinMode(R4, OUTPUT);
      pinMode(R5, OUTPUT);
      pinMode(R6, OUTPUT);
      in section : void (setup)

      Reply
  • at
    Permalink

    Hi there!
    Where can I find the Nextion library, because with my library doesn’t work?
    Error message:

    Nextion_relay:21: error: no ‘void NexTouch::sendCommand(const char*)’ member function declared in class ‘NexTouch’

    void NexTouch::sendCommand(const char* cmd)
    ^
    exit status 1
    no ‘void NexTouch::sendCommand(const char*)’ member function declared in class ‘NexTouch’

    Thanks for your answer!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *