Nextion actually saves 99% of the time when developing an application where we need to work with graphic display and touch controls. I decided to conduct a thorough store search. For a reasonable price, these displays are useful not only in prototype construction, but can also be used for mass production.
- Availability in dimensions from 2.4 "to 7"
- Always touch layer
- Availability graphical editor for the definition and components of graphics environment with realistic simulations of what we actually see on the screen (WYSIWYG)
- Display control via UART - need only two pins of communication
- All the burdens associated with the graphics is transferred to the ARM processor to the display, it can be achieved by a perfectly ordinary Arduino to ATmega328P, which was at most a variety of SHIELD, etc. A problem is we were limiting the performance 8-bit processor, so the available space for the program, because the operator graphical display was most often swallowing capacity and the application itself took very little space.
- 5V, 3.3V and tested without problems
The strongest part of Nextion displays is the existence of a graphics studio, which can completely define graphics and touch environment. Many functions can be entrusted directly to the display (eg. Switching between pages, changes color buttons and headings, etc.) Nextion is not the only kind of displays that allow you to define an environment outside of your control processor applications, however, the prices of these displays were practically unusable. To start working, you need to download Nextion Editor and install it. Installation does not bring any pitfalls, so let's cut to see what Nextion Editor allows.
After starting, the welcome screen appears not unlike what many of us know from Visual Studio:
To save you the first steps in exploring Nextion Editor, I have prepared such a small and very simple set, which should demonstrate the basics of screen Nextion. We often don't think about screen resolution and what uses graphic driver, just when starting a new project. Only Editor gives you what screen hand held and whether you want it horizontally or vertically.
Get StartedNow go to File -> Open and open the downloaded test.HMI. If everything is in order, amid the editor appears in my "Project":
Because I work with display 3.5", I prepared some pictures on background and then just tentatively thrown on the surface of some elements that you can simply drag and drop to move from the Toolbox on the left side of the editor. Note that each element has its unique identification (in the yellow square) - this is very important because just by this identification - component ID, then we will display communication needs for Arduino or ESP8266. An example: component t1 is actually text window where I prepared for some hours. Now we figure static, which is the clock state when called. "worth." we have to take momentum and every second to send data - text to change - we do it through said UART and the Send t1.txt command = "1:23:15 p.m.," at that moment reading our display changes. The editor has one great feature - Debug (top bar).
Debug ModeNotice in Debug mode three fields at the bottom of the screen - Instruction Input Area - here we will insert the commands exactly then we will send the Arduino or ESP8266- to debug and we will not have too much to think about. I told you that these displays will save 99% of development time. What you send into this window, then in reality we send to the RX pin of the display. Another window is to monitor the response of the display - Simulator Return Data - this what we receive on TX pin display. The last window still will not use.
So into the first window, click t1.txt = "1:23:15 p.m." and watch what happens. On the one hand, the display changes the text from the original 12.59: 15 to 1:23:15 p.m. and partly in the simulator window (middle window) screen displays its return value. This must change in the text is interesting, but where it is definitely interesting - for buttons, sliders and other interactive things we controlled via the touch layer.
Click Wave and get to the second page of my "Project". Note that the simulator window now appears in response from the button we pressed. The sequence is terminated 0xff 0xff 0xff - thus ending all sequences and those that will be sent to the display. From the Arduino then you need to send this to you achieve the same functions as the above-described changes to the text:
display.print ( " t1.txt = \" 13: 23: 15 \ "");display.write (0xff);display.write (0xff);display.write (0xff);
More experienced readers appreciate that the practical display connection instance can be defined as follows: Softwareserial display (2.3); and then physically connect the display to pin2 - TX display and pin 3 - RX display. the setup (), then be sure to initialize the default communication speed deisplay (9600); But this will be discussed in some of the other articles including a model sketch.
Note that we are on the next screen display one of the more interesting elements prepared - window for registration hodonot in graphical form ... for example, create a simple oscilloscope it is not even a matter of hours - here you have further evidence of the Nextion displays saves up to 99% of the time the development. Now we can leave debug mode (to exit the simulation of the real state of the display) and let's have a look at three more important things in the Editor.
SitesAccording to your plan, you can define multiple screens and switch between them as needed in your project. Add or delete pages you can use the box at the top right of the screen - Page. Click on the page first.
AttributesEach element, be it text, image slider, etc. Has its own attributes - you see the box on the right side Atributes Editor. Check out the attributes necessary to Home button on page 1 - parameters shown in green can be changed programmatically, which I will clearly demonstrated above to change the element txt for the title. For other elemnty everything works similarly.
In the under side of the screen is a very important window Event - here we define our interaction with Arduino or ESP8266. Event window again varies depending on the element with which we work. Taking for example a button. Click the Home button on page 1 and see what we offer window Event - 3 important things:
- Send Component ID - if you leave this checkbox unchecked, then the TX pin of the display will not go - and you will not know what he was doing display. It is not always necessary to see everything - typically Home used to return to the home screen. But if you still want to know about each activity, check this option and display for you to spew what just happened.
- Touch Press Event - here you can define what should happen when you click the button
- Touch Release Event - similar to what happens when you release the press - specifically here I am in this event "programmed" to return to page 0, so the initial screen.
The aim of this article was not to give a comprehensive guide to working with display Nextion. Those on the Internet cloud and everything is perfectly described on manufacturer's website in the wiki . Those interested in the details thus refer to these sources. I will try in the next article to describe the interaction with the Arduino, which we have already indicated above. The prices of these displays start from 16$ for version (2.4 ') - that is higher than other displays, but I personally for such an elaborate display gladly pay more, because time is very precious and your development time savings are really significant. So try elements, lets go work on your fantasy, what should be done with the display and return to those projects that you left lying in a drawer because the traditional approach was just too complicated!
I highly recommend the need to see this video .
Comments