Shop OBEX P1 Docs P2 Docs Learn Events
Nextion display modules — Parallax Forums

Nextion display modules

Think it was @JonnyMac that told me about these things:
https://nextion.tech/

This kind of thing could be useful if very low on system resources and want to add a display...
Maybe better suited for P1 though really.
It is sorta like FTDI EVE, but only needs 2 pins, TX & RX and uses a simple serial interface.

Anyway, bought a "discovery" 2.8" module to check it out.
Seems they also have a "basic" series, but that appears to be being phased out...

Just got it talking to P2 today using FlexProp and the C code from here:
https://github.com/vusivus/Nextion-C-Library

One thing that held me up a little bit is that I didn't understand how it works...
Was thinking that this example was creating a button and slider that would appear on the screen:

#define buttonPageID 0
#define sliderPageID 0
#define buttonID 2
#define sliderID 2

void main()
{
    CreateNexObject(button, buttonPageID, buttonID, "MyButton");
    CreateNexObject(slider, sliderPageID, sliderID, "MySlider");

...

But, that's not how it works at all.
You must have already created a button and slider using the Nextion GUI and have the screen already programmed with these objects. The module was completely ignoring my requests to move the slider because it didn't exist... You'd think it might give some kind of error code, but appeared to just be silent...

If I had an FTDI serial board, like a PropPlug that also had +5 V, seems one could program the board directly. But, I had to save the project as a .tft file on uSD and stick into the 2.8" module to program it.

Comments

  • RaymanRayman Posts: 14,632

    Contemplating doing something similar with a P2 powered display. That would be a ton of work, but would be fun.
    Might be able to get a P2 onto a 5" display. 7" would be easier though...

  • JonnyMacJonnyMac Posts: 9,102
    edited 2024-10-02 19:10

    I am a very big fan of the Nextion displays. I first got serious with it helping my friend John Huffman (JonyJib.com) with his Ultimate controller product. We had tried other touch displays, but Nextion worked out the best and was very cost-effective. His customers love the Ultimate interface.

    https://www.myelectronicsguy.com/products/ultimate-1-controller-for-cammate

    The next big project I used it on was a P1-prototype of a product for Elite Laser Tag -- which is now being ported to the P2.

    To that end I have a fairly full-featured object for the Nextion (P2 version attached) that uses a stripped-down serial driver (in products I dump the fancy stuff in jm_fullduplexserial). Note that my object works with my style of using custom messages from the Nextion to the Px generally look like this

    entity=value

    In John's controller we did additional parsing on the value field for one of his advanced screens. In most cases, this is not necessary.

    Tip: If you don't already have a favorite vector editor, I recommend Inkscape -- it's free, easy to use, and I find it my go-to for many tasks. The attached image shows my screens layout for the Elite Laser Tag Tower project I'm doing for work right now. In a way, we get another processor when using the Nextion. Note the bullet animation frames toward the right of the image. Those animation frames are run by the Nextion with no involvement from the Propeller except switching to the screen that runs those frames.

    But, that's not how it works at all.
    You must have already created a button and slider using the Nextion GUI and have the screen already programmed with these objects.

    This is why I start in Inkscape. I can set my screen size and then paint the interface -- kind of like a storyboard. The next step is exporting those images (I use PNG) , loading them into the display, and then writing the display code to control everything. The Nextion debugging feature allows you to send messages to the virtual display to test what you'd be doing with the Propeller. I really like this.

  • RaymanRayman Posts: 14,632

    When having problems figuring it out, looked at module output with scope.
    It was very noisy. Wasn't the problem though. Kind of surprised it's not a problem, but could be that it's just too high frequency to make a difference.

    Does make me wonder though if need some kind of filter on the input.
    Googled up some mention of this, but that was for a larger display.
    There, seems the SMPS for the backlight was the issue...

  • RaymanRayman Posts: 14,632

    Think have code 100% working finally...
    Learned that you have to have "Send Component ID" checked in order to get any feedback when pushing or releasing buttons. Releasing seems to be called "pop" in the driver...

    539 x 143 - 11K
  • RaymanRayman Posts: 14,632

    Here's the C source code and binary.
    Thanks to @JonnyMac for fullduplexserial and the (new?) available() function needed here.

    Also, is the test Nextion project and upload file for the 2.8" Discovery module.

  • JonnyMacJonnyMac Posts: 9,102

    Think have code 100% working finally...

    Cool. What are you making?

    Learned that you have to have "Send Component ID" checked in order to get any feedback when pushing or releasing buttons.

    That is the case with the Nextion Arduino library and it may be the case with the C library you're using which is using standard (binary) Nextion messages. I didn't like that style so I do everything with text messages that can be created and monitored by a standard serial terminal. It may be a little more work on the front end, but it makes following the Nextion code a bit easier (I think). Once the Nextion interface works the way I want it's easy to deal with those messages with the Propeller. My Spin drivers are configured to work with text messages.

    I use the Touch event to highlight the entity, and the Release event to do something with it. Typically I will create a screen in Inscape with all items that can be lit or highlighted turned off. I make a copy and "light" the entities as desired. Then I use the crop feature to control what the user sees.

    Show a highlight:

    Release the highlight and act on the widget that was touched/released

    Now... my style may not be typical. What I like about it is that I can control everything in my graphics which means my buttons can be any shape I want. This also allows me to use the PNG files created for the Nextion in my product documentation.

  • RaymanRayman Posts: 14,632
    edited 2024-10-02 22:38

    @JonnyMac Not making anything with this right now. Was just curious how it works...
    It does have a nice price point. Maybe they will upgrade to IPS screens one day.

    Personally, I'm interested in a 7" (maybe 5" and 10") IPS display module driven by P2 chip.
    Thinking that would be pretty awesome...

    It is strange how adding HDMI, or EVE, or Nextion, appears to add zero to the display module cost.
    Definitely not true for P2...

  • RaymanRayman Posts: 14,632

    Do have a major project though that currently uses four ftdi eve2 displays. Switching to nextion would save pins…

    That was some of the motivation here.

    Might not be too hard to modify fullduplex serial for multiple ports…

  • JonnyMacJonnyMac Posts: 9,102

    Might not be too hard to modify fullduplex serial for multiple ports…

    I'm pretty sure @Cluso99 made a 16-port version. I wrote the assembly code in a way that I thought would be easy to make multi-port -- I've just never done it myself.

  • RaymanRayman Posts: 14,632

    Do like some aspects of nextion interface. @JonnyMac agree could be simpler. Think there is some room for improvement here…

  • MicksterMickster Posts: 2,692

    Knob Studio (free and link to my DropBox) is hardly known but is great for generating animated controls (png)

  • iseriesiseries Posts: 1,492

    Have been using Nextion displays for years now. The old models were very noisy in the WiFi band and made it hard to use with a WiFi Module.

    The newer modules do not have this issue and they also updated the Text graphics so they are no longer use fixed pitch fonts which made the text look bad.

    Created a weather display and used the onboard real time clock to display a clock using the P1.

    Have library functions for both the P1 and the P2.

    Mike

  • RaymanRayman Posts: 14,632

    What kind of baud are you all using?
    Comes set at 9600, which is pretty slow. Appears can be upped though...

    Also, appears to be ok being directly connected to P2 I/O pins. Are you doing that? Adding any pullups or pulldowns?

  • iseriesiseries Posts: 1,492

    Not much data being moved to the display so 9600 is fine. Direct drive the serial lines and also have a TTL/232R-3v3 FTDI cable for programming the display.

    Mike

  • JonnyMacJonnyMac Posts: 9,102
    edited 2024-10-06 04:53

    What kind of baud are you all using?

    I use 115200 (allows me to use P1 or P2).

    Also, appears to be ok being directly connected to P2 I/O pins. Are you doing that? Adding any pullups or pulldowns?

    The Intelligent series uses 5v IO so you'd want a resistor in your RX line to deal with that. For other displays, I connect directly. No pull-ups or -downs. You could put a hi-z pull-up on your RX line in case the Nextion is not attached.

  • VonSzarvasVonSzarvas Posts: 3,448
    edited 2024-10-06 07:39

    @iseries Which model of screen did you use for your weather display?
    I'm curious to experiment with Nextion- I found this one at a local supplier: NX4832F035. Seems a bit small though ?

    @JonnyMac That Ultimate control screen is a monster ! Is that a 4:3 ? Looks like the size of a 6 or 7" in-car entertainment display.

  • iseriesiseries Posts: 1,492

    I like the NX8048P050-011R. It's a 5-inch display without a case since I 3D print my own and resistive touch.

    I like 5-inch displays as it's not too big and not too small. 800 X 480 display resolution.

    I used to use the NX8048K050-11R but they are phasing this model out and it also was very noisy in the WiFi band.

    I get mine from Itead.cc. $63.90.

    Mike

  • RaymanRayman Posts: 14,632

    I'm thinking EVE is a lot more powerful, but this is a lot easier to use. EVE can get very complicated...
    Plus, this just needs two pins.
    For some of my applications, Nextion might be the way I'd switch to.
    If don't need fancy graphics...

  • iseriesiseries Posts: 1,492

    I have the same project using EVE as well.

    CLEAR(1, 1, 1)
    CMD_ROMFONT(1, 34)
    CMD_TEXT(8, 4, 30, 0, "Outside")
    CMD_TEXT(410, 5, 30, 0, "Inside")
    CMD_TEXT(10, 130, 30, 0, "Wind:")
    CMD_TEXT(10, 170, 30, 0, "Humidity:")
    CMD_TEXT(410, 170, 30, 0, "Humidity:")
    CMD_TEXT(179, 17, 28, 0, "Sunrise:")
    CMD_TEXT(183, 48, 28, 0, "Sunset:")
    CMD_TEXT(180, 81, 28, 0, "Current:")
    CMD_TEXT(100, 230, 31, 0, "overcast clouds")
    BEGIN(LINES)
    LINE_WIDTH(32)
    COLOR_RGB(128, 128, 128)
    VERTEX2II(400, 0, 0, 0)
    VERTEX2II(400, 210, 0, 0)
    VERTEX2F(0, 3360)
    VERTEX2F(12800, 3360)
    END()
    COLOR_RGB(0, 255, 0)
    CMD_NUMBER(30, 30, 1, OPT_SIGNED, -2)
    CMD_NUMBER(430, 30, 1, OPT_SIGNED, -2)
    CMD_TEXT(100, 130, 25, 0, "N @ 10")
    CMD_TEXT(150, 170, 25, 0, "100% (45%)")
    CMD_TEXT(550, 170, 25, 0, "100%")
    CMD_TEXT(270, 20, 28, 0, "07:25:03 AM")
    CMD_TEXT(270, 50, 28, 0, "06:40:33 PM")
    CMD_TEXT(270, 80, 28, 0, "05:00:00 PM")
    COLOR_RGB(0, 255,255)
    CMD_TEXT(25, 300, 28, 0, "06:40:33 PM")
    CMD_NUMBER(25, 320, 31, OPT_SIGNED, 100)
    CMD_TEXT(25, 360, 28, 0, "N @ 10")
    CMD_TEXT(25, 380, 28, 0, "overcast clouds")
    CMD_TEXT(225, 300, 28, 0, "06:40:33 PM")
    CMD_NUMBER(225, 320, 31, OPT_SIGNED, 100)
    CMD_TEXT(225, 360, 28, 0, "N @ 10")
    CMD_TEXT(225, 380, 28, 0, "overcast clouds")
    CMD_TEXT(425, 300, 28, 0, "06:40:33 PM")
    CMD_NUMBER(425, 320, 31, OPT_SIGNED, 100)
    CMD_TEXT(425, 360, 28, 0, "N @ 10")
    CMD_TEXT(425, 380, 28, 0, "overcast clouds")
    CMD_TEXT(625, 300, 28, 0, "06:40:33 PM")
    CMD_NUMBER(625, 320, 31, OPT_SIGNED, 100)
    CMD_TEXT(625, 360, 28, 0, "N @ 10")
    CMD_TEXT(625, 380, 28, 0, "overcast clouds")
    COLOR_RGB(128, 128,0)
    DISPLAY()
    

    You have to write a program to drive the screen instead of just filling in fields with new data.

    The programming language was not designed for larger screens, so you have to fudge some things to get them in the right place.

    The Nextion can be programmed as well but the program is written on the screen and not in the P1 program.

    Mike

  • @iseries said:
    I like the NX8048P050-011R. It's a 5-inch display without a case since I 3D print my own and resistive touch.

    Thanks Mike. Appreciated.

    Actually interesting to me how much detail you've got presented on only the 5-inch display. I'll be looking to order one - experimentation long overdue!

Sign In or Register to comment.