NEXTION Tutorial V2.03a
NEXTION Tutorial V2.03a
______________________________________________________________________________
for MMDVMHost
“THE SAMPLE SCREEN PROJECT”
This document’s goal is to help you start to build your own screens or
modify existing screens .
For omissions, add-ons, tips and tricks, please mail to the Author:
[email protected]
Content overview
Introduction............................................................................................................................................. 4
From the author .................................................................................................................................. 4
Rob van Rheenen | PD0DIB ............................................................................................................. 4
The Nextion display as an add-on ........................................................................................................... 5
What you need .................................................................................................................................... 5
What’s in this project zip-folder .............................................................................................................. 6
The Nextion Editor – an overview ........................................................................................................... 7
The Attribute window ......................................................................................................................... 8
The Font Manager ............................................................................................................................... 9
Adding a font ................................................................................................................................... 9
Buttons in the Font manager window ............................................................................................. 9
The Picture manager ......................................................................................................................... 10
The Page Manager............................................................................................................................. 11
The Event window ............................................................................................................................. 11
The Output window........................................................................................................................... 12
The “Project screen” explained Step-By-Step ....................................................................................... 13
Step 1: prepare all graphics needed .................................................................................................. 13
Step 2 Download a template screen: “The Basic screen” ................................................................. 14
Start to build “The Project screen” ................................................................................................... 15
The Editor screen: an overview ..................................................................................................... 15
Step 3 Modifying Page 0 - MMDVM page ......................................................................................... 16
Step 4 Modifying Page 1 – D-Star page ............................................................................................. 21
Step 5 Modifying Page 2 – DMR page ............................................................................................... 21
Step 6: modifying Page 3 – YSF page ................................................................................................. 22
Step 7: Modifying page 4 – P25 page ................................................................................................ 22
Field numbers MMDVMHost Nextion display.................................................................................. 23
Comments by ON7LDS Screens (source = Github by ON7LDS): ............................................................ 24
How to upload your design into the Nextion and connect your screen ............................................... 25
Upload your design into your Nextion .............................................................................................. 25
Connect the NEXTION via USB to your PC or Raspberry ................................................................... 25
Connected to the GPIO pins – Raspberry (all versions, included Pi Zero)......................................... 26
The NEXTION configured in MMDVMHost ........................................................................................ 26
Pi-Star configuration...................................................................................................................... 26
Introduction
A licensed Dutch HAM operator since 1977 (so English is *not* my native language and you have to
forgive me my bad spelling and syntax). Long time on HF, VHF and UHF and D-Star with the basic
gear, but stopped being “radio-active” in 1997 for job and family matters.
Now I’m retired and have time again to spend on this fantastic hobby. Restarted in 2016 and decided
to go digital (no place / not allowed placing huge antennas). Started (again) with D-Star, but quickly
adopted DMR too. As I’m living in an area with no digital repeaters in reach, discovered the hotspot
and build / using several of them with various radio-modem boards.
Discovered the NEXTION ® device and decided to add those to my projects. As I love to build and
‘program’ (I’m in the process of building a digital multi-mode voice repeater, based on MMDVM,
MMDVMHost and Pi-Star), I discovered too that the documentation for this device is poor. So I’ve
decided to start the Nextion support Facebook group and wrote some How-To’s for this device.
Grabbing all those How-To’s together and made this tutorial with a sample screen to give some
insights of the workings of the NEXTION ® Editor.
Hope this will inspire you to build and publish your designs and tips & tricks.
73
PD0DIB
The Nextion Editor, which you can download for free here:
https://nextion.itead.cc/resources/download/nextion-editor/
The basic screens for MMDVMHost, which you can download here:
https://github.com/g4klx/MMDVMHost
o There are three Nextion sub-folders:
Nextion_G4KLX, which contains all the screen-sizes and both .hmi and .tft
files with the standard logo’s
Nextion_ON7LDS, which contains all elements from the G4KLX screens;
ON7LDS can display the IP-address from the hotspot and the decoded info
from Talker Alias too. This will be explained in another chapter.
Nextion_DB2OE, which contains not all sizes (3.5”is not there), but has some
nice logo’s; both .hmi ands .tft files are there.
A Nextion screen . For this tutorial screen (“The Project screen”), preferable a 3.5 inch
Basic or Enhanced (Basic will do all).
To build “The Project screen”” : the zipped file in the file-section from the Facebook group
https://www.facebook.com/groups/Nextion/
with the name “NEXTION_Tutorial_Project.7z”; this file is zipped with 7-Zip (free), you have
to unzip it (preferable with 7-Zip, it is free, but every Zip-program can handle this zipped file)
If you want to connect the screen to your computer to upload the screens to your Nextion
(which I do): an USB-to-TTL (UART) adapter to connect the screen via USB to your computer.
Not all adapters are supported, see Chapter How to upload your design into the Nextion and
connect your screen
A photo editor like Photoshop1 or Paint.net (free to download) or equivalent to edit and size
the logo’s and other graphic stuff you want to be part of the screen.
You cannot edit graphics or fonts with the Nextion Editor, they have to be the right
size/pixels for your screen size!
1
Do you know Photoshop CS2 is FREE? You have to Google / search for it, but it is a legal free version; I’m using it for my designs too.
In the display window is an example from the project you’re working on.
In this example the Nextion is getting the most of the info from the MMDVMHost, so the Editor can’t
display all info in this example, since it is not connect to the device (radio-modem) which is delivering
that info.
But we can modify the way that info is presented and add “static” info to the screen pages.
t0(Text): Pull down menu, you can select a particular text field here. Also
useful to check the numbering of your text fields.
See the chapter regarding reserved text field numbers.
id: System field.
objname: to give that text field a specific name.
See the chapter regarding reserved text field names.
type: system field.
vscope: Variable scope(local-visible in current page, global-visible in all
pages):0-local;1-global. (did notice that this option is not working for me,
probably have to play some more with this option.)
sta: Background fill:0-crop image;1-solid color;2-image; to change the
background behavior.
style: Set a border or 3-D effect for that field. Click the attribute to display
corresponding notes.
key: Binding keyboard; bind that field to a specific key / keyboard layout.
(no experience with it.)
bco: Set background color. Click on the colored block or number to select. If
your color is not in the pull down menu, use more colors to add a color for
this project. It will give you the RGB settings too, handy if you want to use
the same color in your Artwork (or vice versa) to select that color. Use the
WEB-color scheme for a correct color.
pco: Set font color. Click on the colored block or number to select. If your
color is not in the pull down menu, use add more colors to add a color for
this project. It will give you the RGB settings too, handy if you want to use
the same color in your Artwork to select the same color.
font: Select the font number to use in that field from the Font Manager.
xcen: horizontal center: center, left or right aligning the text in the text box.
ycen: vertical center: center, up or down aligning the text in the text box.
pw: make the text box a standard textbox or a password text box; during design, made it a textbox and put in
your password; then change this setting to password, the entered text will be showed as ***** and have to
match the entered text.
txt: The content for that field.
txt_maxl: Maximum number of digits / letters in that box.
isbr: turn word-wrap on/off. With this feature you can make a text box instead of a field. Test the word-wrap in
the design phase for correct wrapping.
spax: horizontal spacing between individual letters/numbers in that field
spay: vertical spacing between lines (text block) in that ’block’
x and y: horizontal (x) and vertical (y) place of that field on the screen
w and h: Width and height from that text field or -block
Adding a font
The Editor has NO font library built-in, just a Font Manager. So we have to generate each font we
want to use. In existing screens (.hmi files), fonts that are used in
that particular screen are existing in the Font Manager and can be
(re)used.
There is a tool for it, which you can find at the top-menu-bar of the
screen, called *Tools*.
Click on it and select Font Generator. A new window pops-up.
Select a font, size, etc… and click *Generate font*. It will ask you to
save the font (make a folder for it for future use in other projects),
after saving it will ask you to import the font into your project .
Click Yes to add the font and it will show up in the Font Manager of
your project.
With the circle-arrows you can replace a font with an existing font from your library in your font-
folder. This is an important feature for ON7LDS screens, font number 1,2,3 and 4 are needed with
that number (place in the font-list) to let auto-sizing TA info correctly do the job (t0.txt and t2.txt
field on the DMR-page / Page 2 in the Project screen).
With the ‘squared’ arrow you can add a font above the selected font, so keep the numbering the
way you want; pay attention to the ordering of the fonts, see remark by circles arrows
With the up- and down arrows you can sort the project fonts in the manager (important for the
ON7LDS Screens, see that chapter).
The most right button shows an example of the complete font-set from the selected font.
The Nextion Editor has no graphic / picture editor, you can’t edit
anything from that picture.
In this given example, the sizing is for a 3.5”screen. You need to size the pictures so it will fit into the
screen size. For example: 480 pixels is the maximum width for a 3.5”screen.
If the picture is larger, it will result in an error; you have to resize the picture with the external image-
editor, such as Photoshop.
First we can rearrange the pages in the project by the red arrow
keys.
REMARK: do not change this order for the MMDVM pages,
they are ‘called’ by the page number/name by MMDVMHost.
And if you want to copy a page, select the page you want to copy and click on the most right button.
This is ‘powerful”: if, for example, you have designed the D-Star page to your satisfaction and all the
fields correctly positioned, you can copy that page, rename it to YSF (page 3) and, with minimal
corrections, that page is ready too; do the same with P25 and you’re ready .
If you are in the designing phase, it is handy to use dummy text to see how font and colors are
displayed on that page (as we do in the Project screen). Normally, I clean up all the fields by
removing the dummy text when I’m ready, but it is not necessarily needed 2. In the Preinitialize part
of this window, you can see how/what content is showed when the Nextion is powered on; you can
put in your own text between the quotes per page.
In this example: for Page 0, I’ve put in the text INITIALIZE in t0.txt. After completed the init-phase,
this text will be replaced by MMDVMHost by your call / DMR-ID in the Idle screen.
The tx.txt=”” will replace the dummy text (if you didn’t cleanup) with a blank line during startup,
after startup, the fields are used by MMDVMHost
2
Some Nextion screens, special the 3.5” screens, don’t handle the refresh cycle correct (new firmware is
promised by iTead); if you see some ‘strange’ things in your text field happening, please do not use this option
and remove all text for those fields (tx,txt=“”).
Double click on any reported error shows more info regarding that error.
As earlier noted, I’m using Photoshop (CS2, it’s free) to make the graphics. You have to pixel-size the
image according the screen size you’re going to use; in this example the screen size is 3.5inch.
I’m not a Photoshop expert, so I’m using “the Basics” from that program to make my graphics; there
are for sure better workflows to make better graphics.
The 3.5inch screen has a 480x320 pixel resolution, so the maximum picture resolution should not be
exceed the screen resolution. The background image for this screen is 480x320.
My “Workflow”, using Photoshop (think every photo-editor can use this workflow if it can handle
layers):
1. Making a background layer 480x320 pixels (sample screen: 3.5inch) in the color I wanted; in
this example black
2. On that background layer, I put all static elements, one element per layer. So all logo’s,
“buttons”, graphics or pictures has its own layer. Reason: I make one “Master” per screen
size and switch on on/off the layers I want to use on the background for a particular screen.
3. Remember, you have to reserve space on that background for the text/info fields from
MMDVMHost; in the example: the lines “INITIALIZING”, “MMDVMHost – G4KLX”, “Pi-Star –
MW0MWZ” and “Design: PD0DIB” is reserved space for the MMDVMHost info and should
not used for other elements.
Download the size you want to use; ”The Project screen” used in this tutorial is 3.5 inch:
https://github.com/g4klx/MMDVMHost/tree/master/Nextion_ON7LDS
If you want to build the screen from scratch, you need to know which tx.txt fields are reserved for
MMDVMHost info: see this Chapter: Field numbers MMDVMHost Nextion display
The numbers in the Basic screen in the pictures are just “test content” that’s helping you to pick the
(background or font) color, font size, etc.;, later on we will modify/remove that.
Save (or make a copy) from the downloaded screen (.hmi file) for future use and give your project-
screen (save as) a name that suites you.
In the next steps we are going to modify this screen (all pages) to “The Sample screen”.
(5)Attribute
(3) Picture window
and Font
manager box
(1) The first page of the sample project. The ‘content’ (Dummy text and numbers) is just a help
to design your page, that will be removed if the page-design is ready.
(2) The Toolbox in which you can add all kinds of field types like text, scrolling text, pictures, etc..
to you project
(3) Picture- and Font manager; showed is the picture manager, you can switch between pictures
and fonts with the buttons down in that window
(4) Page selector to switch to the page you’re working on (in the sample screen: the mode-pages
as Idle, D-Star, DMR, etc..).
(5) The Attribute window to select / change behavior and presentation from fields like font,
(background) color, text, width and height, etc…
The two lower based windows are not explained (yet), you don’t need them for this tutorial.
spec’s, not the (pixel) sizing of the ArtWork backgrounds or any number (value) in this tutorial. If you
want to use another size, you have to recalculate those values, fonts and ArtWork-pixel sizing.
After selecting the correct model we are going to modify the background to the new design. For that,
we have to replace the MMDVM logo for the new background:
(1) Right-click on the MMDVM logo in the Picture manager and select
replace, file manager opens and you have to go to the folder ArtWork.
(2) Select IDLE SCREEN copy.png from that folder, click Open.
A window is popping up with the text Import successfully 1 pieces, click
OK.
In the Picture manager, the MMDVM logo should be changed into the
chosen background picture.
So we‘re going to change that: click on the picture in the project window to select the picture. Move
by clicking the picture and drag it to the upper-left corner.
Click on the upper text fields (t0) and go to the Attribute window:
Find bco in the Attribute window, click on number displayed; a pull down menu will open and you
can select from the available colors. Pick black to change the background of the field into that color.
Find pco in the Attribute window and do the same to change the font color, but chose dark yellow as
the font color (or any other color you want but pay attention to readability).
Do the same with the t1, t2 and t3 fields: make the background (bco) black, but change the font (pc0)
t1 and t2 into light-grey and t3 into white (or pick any other color you want but pay attention to
readability). If a color you want is not available in the pull down menu, add that color by clicking
more colors in the dropdown menu, a new window will open and you can add more colors to this
project.
If you have completed all the text fields you have this screen:
2. Click on the upper text field (t0) and find font in the Attribute window.
3. Change the number (5) into 2 and Enter; the font size will change to that size.
4. Then go in the Attribute window to the bottom line h (height) for that field and change the
number to 45. On the project screen you see the new font size and the text field height is
changed according to that font.
5. now click on text field t1 and do the same, but change the font number into 1 and field
height into 35
6. Change t2 to font 1 and field height 35 and t3 to font 0 and field height 35
7. Re arrange the fields in the screen by clicking and dragging to free the lower part of the
screen, so you can see the new designed part (Idle and S-meter bar).
After completed all the steps, you should have this screen:
Now we have to delete the existing content (the numbers) in the text fields:
1. Select by clicking text field t0
2. Find txt in the Attribute window and remove all letters and numbers in the Attribute window
by txt, followed by Enter; so the field must be empty.
3. Repeat with the other text fields to clear the existing content.
WARNING: do not select the field by clicking the text field and Delete. Then you have removed the
complete field!
This is the Idle-screen – page 1 if you completed all steps, check t0, t1, t2 and t3 are all there:
Remarks regarding the DMR page (only if you use ON7LDS designed screens with Talker Alias info, as
in this tutorial):
1. The font colors (pco) for t0 and t2 are “hard coded”, we will explain the colors in the ON7LDS
screen Chapter. Therefore, you cannot alter the font color for those fields and you cannot
change the background color to any color you want due to readability (black font on a black
background is hard to read ).
2. The screen is too small to display all the info, so we have to make choices:
a. There are two fields which are not visible in the original ON7LDS page, but they are
there, hidden beyond t0 and t2: the fields showing RSSI: t4 and t53
b. Since nearly all radio-modem boards for hotspots (DVMega, ZUMspot) are not
‘transmitting” the RSSI value, we leave those fields behind the t0 and t1 fields;
however if you have a board who can handle the RSSI (like ZUM board and other
boards, mostly for repeaters), you have to rework the sizing of all other fields to
make t4 and t5 visible. You have to read the ON7LDS chapter carefully to handle the
font sizing correctly to make auto-resizing Talker Alias info possible
3
We’ve made the background AND the font color for both t4 and t5 yellow so they don’t interfere with t0 and
t2. If you want to use those fields, you have to alter them according your design.
After completing all steps, you should have this screen in your project window:
Congratulations, now you have completed all steps to change “The Basic screen” into “The Project
screen” .
Study all the steps you’ve made to design your own screen; we welcome you to post them (please zip
both .tft and .hmi files and publish the zipped file into the file section from the Facebook support
group for Nextion: https://www.facebook.com/groups/Nextion/ ; post pictures to show your design
too.
MMDVM Page
"t0.txt= callsign, dmrid
"t0.txt= LOCKOUT
"t1.txt= MMDVM IDLE
"t1.txt= ERROR
"t2.txt= date/time
"t3.txt= ipaddress
DStar Page
"t0.txt= type, my1, my2
"t1.txt= your
"t2.txt= reflector
"t3.txt= rssi
"t3.txt= rssiAccum1 / DSTAR_RSSI_COUNT
"t4.txt= ber
"t4.txt= berAccum1 / float(DSTAR_BER_COUNT)
DMR Page
"t0.txt= type, src
"t0.txt= 1 Listening
"t1.txt= group ? "TG" : "", dst
"t2.txt= type, src
"t2.txt= 2 Listening
"t3.txt= group ? "TG" : "", dst
"t4.txt= rssi
"t4.txt= rssiAccum1 / DMR_RSSI_COUNT
"t5.txt= rssi
"t5.txt= rssiAccum2 / DMR_RSSI_COUNT
"t6.txt= ber
"t6.txt= berAccum1 / DMR_BER_COUNT
"t7.txt= ber
"t7.txt= berAccum2 / DMR_BER_COUNT
YSF Page
"t0.txt= type, source
"t1.txt= dest
"t2.txt= origin
"t3.txt= rssi
"t3.txt= rssiAccum1 / YSF_RSSI_COUNT
"t4.txt= ber
"t4.txt= berAccum1 / float(YSF_BER_COUNT)
P25 Page
"t0.txt= type, source
"t1.txt= group ? "TG" : "", dest
"t2.txt= rssi
"t2.txt= rssiAccum1 / P25_RSSI_COUNT
"t3.txt= ber
"t3.txt= berAccum1 / float(P25_BER_COUNT)
The ON7LDS Screens has some changes compared to the G4KLX Screens:
On the main screen there is a field to display the active IP address of the device. On Linux it is
preceded with the network interface name.
DMR: if received, the Talker Alias is decoded and displayed. The TA will be in green, so user
knows it is a decoded TA displaying.
This happens on-the-fly: as the parts of the TA arrive, they will immediately be shown.
If you want to change the ON7LDS screen layout, the only thing to keep in mind is that the
MMDVMHost program will select following font numbers:
o Default font for TA field : font 4
o TA > 16 characters : font 3
o TA > 20 characters : font 2
o TA > 24 characters : font 1
o
REMARK (ON7LDS screens only): you can’t change the font-color for field-text t0 and t2
(received call) in the DMR-Page (ON7LDS screen only), they are set by MMDVMHost and
have a meaning:
o Starts with Black (received call or start TX (your own call))
o Changes to Green if TA data is decoded
o Changes to Grey if RX ended (for 3 seconds, than the screen goes to Idle).
This will limit the possibilities to change the background color for that field too!
Check the chosen background for readability.
There always have to be at least 5 fonts, of which font 1 – 4 are used for the TA. If your
display is wide enough to show all characters in one font, you must copy this font to the
lesser (‘smaller’) fonts.
i.e.: the 3.2” the display can show more than 31 characters (the maximum TA length) in font
2, so this font is also copied to font 1.
How to upload your design into the Nextion and connect your screen
1. A micro-SD Card and a card reader/writer. Copy the .tft file from your design to the SD Card
(it should be the only file on that card!). Power off the Nextion screen, place the card in the
card slot and power on the Nextion screen. The screen will automatically upload the image,
while showing the progress, and when the upload is complete, you see your design. Power
off the Nextion screen and remove the SD Card. You’re finished.
a. How to make and were to find the compiled (.tft) file: In the Nextion Editor under
Files you find the option Open build folder. If your design is finished, click on Compile
in the Editor and the .tft file is saved in that folder.
2. Connect your Nextion device via an USB-to-TTL (UART) adapter to your PC. Look which com-
port it is connected to and select Upload in your Nextion Editor. Select the correct com-port
and start the upload. As is the case with the TFT file upload, the screen will display its
progress as the upload progress. Once it hit 100% your image will appear. Disconnect the
USB to TTL adapter from the computer.
I’m using a CH340(G) USB-to-TTL (UART) adapter for both programming (connecting the Nextion to
the PC-USB) and to connect the Nextion to the Raspberry via USB.
I’ve experienced that for Windows 10 (64, Pro) there is no need to install ‘special’ drivers; this
adapter is working with Raspberry / Pi-Star too.
CH340 (G) USB to TTL (UART) example
Pi-Star configuration
Pi-Star users live easier : All necessarily steps are pre-programmed by The Master (Thanks
Andrew, buy him a beer): go to the configuration page for Pi-Star and set Nextion layout to ON7LDS
to ‘activate” the TA info on your Sample display.
Credits
Special credits for those who made this all possible (buy them a beer, or two, or three, or …PayPal
them so they can continue support this great project ):
OM Jonathan Naylor (G4KLX): “Spiritual” leader and lead-developer for the MMDVMhost
project and all the connected utilities;
OM Andrew Taylor (MW0MWZ) : Lead-developer Pi-Star;
OM Dennis Björn Karl Boniakowsky (DB2OE) for his NEXTION Screen layouts;
OM Lieven (ON7LDS): who made “The Basic screen” for this project and wrote parts of the
MMDVMHost code to support the NEXTION devices;
Max Donoghue (VE3TMT) as Co-writer / Editor for this tutorial
All users from the Facebook group https://www.facebook.com/groups/Nextion/ for their
tips and tricks.
Sources
The MMDVMHost project by Jonathan Naylor:
o https://github.com/g4klx/MMDVMHost/
The Pi-Star project by Andrew Taylor:
o http://www.pistar.uk/index.php
Nextion Support group:
o https://www.facebook.com/groups/Nextion/
You can find the latest version of this project tutorial in this support group,
including all files needed for “The Sample screen” project.
Document history
Disclaimer
Information in this document is provided "as is" without warranty of any kind, either express or implied, including, but not limited to, the
implied warranties of merchantability, fitness for a particular purpose, and no infringement. In no event will the author be liable for
damages of any kind, including without limitation any special, indirect, incidental, or consequential damages even if The Author has been
advised of the possibility of such damages.
Although every effort is made to ensure the correctness of information submitted for publication, the document may inadvertently contain
technical inaccuracies or typographical errors. Information may be changed or updated without notice. The Author may also make
improvements and / or changes to the document, products and the programs described in this information at any time without notice. The
Author assumes no responsibility for errors or omissions in this publication or other documents that are referenced by or linked to this
publication.
iTead, Nextion, and their associated logos are registered trademarks of iTead Intelligent Systems Co Ltd. This document is not associated with iTead or any other manufacturer in any
way.
MMDVMHost and all related names to MMDVMHost are Open Source Licensed by Jonathan Taylor (G4KLX) & his project-team.
Pi-Star and code from the Pi-Star program is Copyrighted by Andrew Taylor (MW0MWZ) & his project-team.
Copyright
© 2017 by Rob van Rheenen – The Author (mailto: [email protected])
All rights reserved by the author.
This document and related products (Project screen, ArtWork, etc..) is intended for Personal Amateur Radio use only. You agree not to utilize the
Project screen or any components downloaded from this site in any commercial application. No part of this publication may be commercially used, reproduced
or distributed in any form or by any means, or stored in a commercial database or retrieval system, without the prior written permission of The Author.