Wall Pluggable Nextion Screen with WiFi
 Page :   [ 1 ]    [ 2 ]    [ 3 ]  

After the last screen experiment I wanted to try a Nextion screen.  These screens are somewhat interesting as you load the GUI onto the screen module itself and interact with the GUI objects programatically from your microcontroller device (in my case an ESP8266).

I also wanted to make it a bit easier to view and use so made the 3D printed case so the screen was at a 45 degree angle.

These guys make the screens : itead.cc

They also make available an IDE for designing your interface. (located here)

I tried the library from ITEAD and a couple other variants but there was problems stemming from the fact the ESP only has one hardware serial.  I ended up using a library modified by someone to use sortware serial.  It works well and can be be found here on github.

Heres the schematic I came up with (click here for PDF version):

You will need to modify the file named "NexHardware.cpp" to reflect the pins you happen to be using for your software serial.

e.g. in my case as follows:

SoftwareSerial nexSerial(5, 4); // RX, TX

I also ended up needing to add a method to NexButton in order to set the image for a button.

In NexButton.h add :

bool setPic(uint32_t number);

In NexButton.cpp add :

bool NexButton::setPic(uint32_t number)
{
    char buf[10] = {0};
    String cmd;
    
    utoa(number, buf, 10);
    cmd += getObjName();
    cmd += ".pic=";
    cmd += buf;

    sendCommand(cmd.c_str());
    return recvRetCommandFinished();
}

I basically just copied the setPic method from the NexPicture class :)

There's a bit of a learning curve to use their IDE and also get a grip of the concepts to interact with it but it's pretty straight forward and wasn't too painful to get some stuff up and running!

 

Next page : making the PCB.

 

 

 

 (Page 1 of 3)