Attachments

Senior Member

Not used them myself but I would expect them to be similar to other LCD graphic displays.

The main problem with graphic displays is the amount of memory required to hold images for them and the time it takes to get data to them, though that's not so problematic if they support raw text display and they can simply be used as very large LCD text displays.

Some displays also have the ability to hold their own graphics and backdrops and it's simply a matter of asking for an image to be put somewhere. The Nextion seems to have some standalone capability in that respect, and an editor which can help with creating displays, images and backdrops, but I don't know much more about them than that.

Senior Member

im waiting for one of these to arrive, but it shouldnt be an issue to use with picaxe as all of your display for pages ect is all handled by the lcd and the nextion software to create/load onto the lcd.

the picaxe wont have to do all of the grunt work for the display just send and recieve data and process it, if a button is pushed on the screen it spits out a serial data packet and the picaxe can simply read what happened with the display and what button was pressed and carry out an appropriate action or send data to the screen when something happens so it can alert you of something by changing the display.

looking forward to getting mine although i have to decide now what project gets it and what others can wait lol.

Senior Member

"Nextion is a Seamless Human Machine Interface solution that provides a control and visualisation interface between a human and a process, machine, application or appliance. It is the best solution to replace the traditional LCD and LED Nixie tube.
This solution includes hardware part - a series of TFT boards and software part - Nextion editor. Nextion TFT board uses only one serial port to do communicating. Let you get rid of the wiring trouble. We notice that most engineers spend much time in application development but get unpleasant results. In this situation, Nextion editor has mass components such as button, text, progress bar, slider, instrument panel etc. to enrich your interface design. And the drag-and-drop function ensures that you spend less time in programming, which will reduce your 99% development workloads. With the help of this WYSIWYG editor, GUI designing is a piece of cake."

Looks like a neat device. I hope anyone here working with it posts examples and links! I can't wait to "reduce my 99% workloads" while avoiding "unpleasant results" when replacing my nixie tubes.

Senior Member

it's worth having a look at their development tool, you design your screen and objects, say a dial to control a variable and then upload the final result to the display via serial, then call the e.g, dial with the data value to be displayed, it does the rest. There are a few YouTube videos demonstrating the display.

Senior Member

Senior Member

You draw your screen and download that to the Nextion. Then say your screen has a button at drawn at some location, and that location is pressed, then the Nextion sends the data item for a touch event to the PICAXE, e.g:
0X67++ TouchCoordinate_X_MSByte+TouchCoordinate_X_LSByte+TouchCoordinate_Y_MSByte+TouchCoordinate_Y_LSByte+TouchEvent_State+End_Sequence 0x01 means pressed 0x00 means no press

So the display will send to the PICAXE when pressed at the location (x,y) of 150,100 the data bytes in this order:

0x67 0x00 0x96 0x00 0x64 0x01 0xFF 0xFF 0xFF

Which means:

0x67 - screen was pressed
0x00 - MSB of x location is zero because 150 fits in one byte
0x96 - LSB is 150 the x location of the press
0x00 - MSB of y location is zero because 100 fits in one byte
0x64 - LSB is 100 the y location of the press
0x01 - it was pressed
0xFF
0xFF
0xFF - end of event marker

All that means a touch event occurred at coordinate 150,100 and the screen was pressed.

Your PICAXE then needs to read the sequence and act on the various messages sent by the screen. SO you'd need to know that 150,100 was say button A that means Up or whatever then programme the PCIAXE to do that command, say speed up a motor or whatever.

The Nextion does not need to know what the screen press at that location over a superimposed graphic of a button means if that makes sense.

When you design your screen you can also call a button a logical name say 'Button 2' and if it was drawn on 'Page-0' and the button was pressed, the screen will return (Check documentation) 0x65 Page0 Button-2 Pressed EndSequence or:

Senior Member

If you took a display new out of the box and switched on and pressed the screen where I did in the example it would respond with the sequence above. There is no programming in the next ion editor all the programming is done in the PICAXE environment.

Senior Member

HELP!
I do not seem to have any response from the nextion serial port nor does it respond to a simple command ei:draw 0, 0, 100, 100, RED
I start with a blank nexion display, connect it to the Picaxe editor serial terminal, the only time i receive something from the display is when i power it ON: [00][00][00][FF][FF][FF][88][FF][FF][FF]
If i put a command in the transmit buffer ei: draw 0, 0, 100, 100, RED, nothing happens, the display stay blank(all white)
Touching and releasing the display does no returns any action in the receive buffer.
What did I miss?

Edit:I am connected with USB-serial CH340 at 9600 baud and the display programs correctly with the Nextion editor.

Senior Member

What PICAXE serial command at you using, I suspect a polarity problem. Try prefixing speed with an N and then T to see if that solves the problem.
serout 7,N9600,(b1) ; transmit values to serial LCD
or
serout 7,T9600,(b1) ; transmit value to serial LCD

It's odd because the start-up sequence from the display looks about right.

And make sure your PICAXE is running at 8Mhz so that it can send and receive at 9600buad

Senior Member

This is the prog i use using a 14M2
Setfreq M8
Let dirsb=%00001000
mainause 1000
Serout b.3, T9600_8, ( "draw 0, 0, 100, 100, red") ; draw a red rectangle
Pause 1000
Goto main
I am simply using the Picaxe serial terminal to receive and send commands when the display is directly connected to the ch340.
I have tried both T and N 9600

Senior Member

After many attempts to communicate without success between a Picaxe 14M2 and a basic 3.5 inch Nextion (NX4832T035_011) display, I still need help!
A simple command like rest (Reset Nextion device) is not executed and no parameters are returned from the Nexion device.
I have tried serout b.2, n9600_8, ("rest")
And serout b.2, t9600_8, ("rest"), no luck
I have tried to connect the display through a CH340 USB/TTL adapter and sending commands with the PICAXE Editor&#8217;s terminal set at 9600 no parity 8 bits 1 stop, still no luck.
The only way I can have the display to accept commands and to return parameters is to use the Nextion editor in debug mode connected to the same CH340 USB/TTL adapter and to choose to send the command to the Nextion device instead the current simulator.
Can someone help PLEASE!

Senior Member

If the display can be controlled by the Nextion editor but not by the PICAXE Terminal it suggests the Terminal is not sending what the display is expecting; if the baud rate and settings are correct it may be that some specific command terminator is required which is not being sent.

I am not familiar with your display or its protocol but example code and comments found via Google suggests a terminator of three 0xFF ($FF) bytes is required -

Moderator

...and speed up the somewhat pedestrian baudrate from 9600 to something like 57600 (or even 115200 if the PICAXE can do it - I've lost track of the tricks to get the maximum rate)
...to get everything to go a bit snappier

Senior Member

Hippy
Pushing speed to M32 works as well!
SERIN pushed at T9600_32 also still works!
Should not be to difficult to read touches or button pushes back.
Will let you know if it works when i can fine some time.

Senior Member

Reading is easy,
first, you create a button or simply a text field in the Nextion editor
You need to tick the send component ID case in the touch release event of that text field.
The display returns 7 bytes, 0x65,(means a push)0x00,(page 0)0x01(button ID1),0x00(not sure about that one), 0xFF,0xFF,0XFF
To change the value of a text string, the the Nextion debug, you type t1.txt="Moon"
I have tried to find the right syntax in Picaxe basic, i tried Serout b.4, T9600_32, ("t2.txt="Moon"",$FF,$FF,$FF) syntax error
Serout b.4, T9600_32, ("t2.txt=""Moon""",$FF,$FF,$FF) syntax error
what is the correct syntax?

Senior Member

It's always a (potential) issue with "non-printing" (e.g. TAB) or "control" characters (e.g. "newline", CR,LF) or where the characters have a special function within the "editor" (e.g. the double-quotes). Typical solutions are to use an "escape" character (e.g. hippy's \ ) or to repeat the character, but these are "language dependent".

Since an ASCII character table is included (for example under "Help" in PE5), then using the explicit ASCII value is probably the easiest solution, but you can always use symbols if you wish, e.g. SYMBOL DOUBLE_QUOTES = 34 : SYMBOL SINGLE_QUOTE = 39 : SYMBOL COLON = 58 etc..

However, as WA55 recently noted, to enter each "hard space" in PEBBLE (which employs JAVA), it's necessary to write &nbsp - now that (IMHO) is complicated.

Senior Member

Another nextion problem
I am trying to draw a circle using picaxe variables
This instruction works
Serout nextion_rxd, nextion_baud_rate, ("cir 100,100,100,RED",$FF,$FF,$FF)
This one also works as red is 63488 in nextion language
Serout nextion_rxd, nextion_baud_rate, ("cir 100,100,100,63488",$FF,$FF,$FF)
but this does not even if it passes picaxe syntax
w0=63488
Serout nextion_rxd, nextion_baud_rate, ("cir 100,100,100",#b0,#b1,$FF,$FF,$FF)
or
Serout nextion_rxd, nextion_baud_rate, ("cir 100,100,100"#w0,$FF,$FF,$FF)