This project is read-only.

New major version 1.1.0

I’m very happy to announce new major version of Nextion.NET driver. The biggest improvement is Display Configuration Generator which generate helper class out of your HMI file.

Using generated file will show errors in compile time instead of runtime. Read more about generator here.

Side effect of this new feature is slightly change of Driver API. All Controls.Define methods now required control index. Before that index was calculated from order of calling these methods. Dummy control was removed because it is not necessary any more. I guess it won’t take you a lot to migrate your project to new API. In any case I still recommend you to use Display Configuration Generator

There is also new getting started guide available here.

Project Description

The goal of this project is to provide a managed NET Micro Framework 4.3 library for Nextion displays.
The library is developed independently from display manufacturer and is open source.

Project was developed and tested on devices:

  • FEZ Spider
  • FEZ Cerberus
  • FEZ Cerb40 II
  • FEZ G120 HDR
  • Mikrobus.Net Dalmatian mainboard
  • Mikrobus.Net Tuatara mainboard
  • Mikrobus.Net Quail mainboard
  • SecretLabs Netduino 3 Wifi

Code uses plain .NET so it should work on other Micro Framework devices.

Quick start

Getting started guide is available here.


This project also contains gadgeteer driver. Quick start documentation is available here.

Properties and methods

The most useful properties are:

PageId Get or set current HMI page ID
TouchMode Get or set current touch mode. In Component mode you get reference to touched component in Coordinate mode you get X and Y coordinate of a touch.
GUI Direct access to GUI drawing board where you can print texts, draw lines and shapes.
Backlight Get or set display backlight in % (0-100).

If no serial data, it automatically activates sleep time (unit: second, minimum 3, maximum 65,535, power-on default 0)


If no touch operation, it automatically enters into sleep time (unit: second, minimum 3, maximum 65,535, power-on default 0)


Touch in sleep mode will auto-awake

The most useful methods are:

SetPage Set the current HMI page by page id or by page name .
SetSleepMode Turn sleep mode on or off. When sleep mode is activated, display turn off backlight and change TouchMode to Coordinate. Check demo project for example.


Get component attribute (like textbox text or progress bar value). It is recommended to use controls helper classes. Check demo project for example.


Get or set component attribute. It is recommended to use controls helper classes.


For some of Nextion build in controls there is a .NET class available which allows you to access them in an object oriented way. Controls need to be defined in correct order (like in Nextion editor). You can check Demo.TestControl project in source code for my suggestion how to define and use Nextion controls classes.

Currently these controls are supported in Nextion.NET:

Nextion name Nextion.NET name
Text TextBox
Number NumberBox
Button Button
Progress bar ProgressBar
Picture PictureBox
Waveform Waveform
Slider Slider
Dual-State Button DualStateButton
Gauge Gauge
Timer Timer
Variable Variable

For unsupported controls define Dummy control to keep the correct control indexes.


Through display property GUI you have direct access to the display drawing board. Some of the methods are:


Clear screen.


Draw circle on screen with provided coordinates, radius and line color.


Draw the line between two points in provided color.


Draw rectangle between two points with provided color.


Draw rectangle with provided starting point, width, height and color.


Draw filled rectangle between two points with provided color.



Draw filled rectangle with provided starting point, width, height and color.


Draw text on provided area. You can also specify font, color, alignment (vertical, horizontal)

Demo project

There is also demo project provided. To use it you need to upload provided HMI file to your Nextion display using Nextion Editor. This demo project gives you an example of:

  • Instantiate Nextion display driver using SerialPort or TemporaryChangeBaudRate method.
  • Use some of Netion controls like Text, ProgressBar, ...
  • Direct GUI access to draw text, shapes and lines.
  • How to use and respond to touch event in Cooridinate and Component touch mode.
  • My suggestion how to store display configuration in object oriented manner.
  • Use of sleep mode.

Tic Tac Toe

There is a demo project Demo.TicTacToe which contains complete implementation of classic game Tic Tac Toe for two players. Before you can run this application you need to upload TickTackToe.HMI from the HMI folder to your Nextion.NET display using Nextion Editor.


DebugHelper is another library which depends on Nextion Driver and allows you to use Nextion display to show debug messages. Just create new instance of DebugHelper, change font and background color and start writing messages.

var messageDisplay = new DebugHelper.NextionDebugHelper(new SerialPort("COM2", 9600), 240, 320, 20);

messageDisplay.BackgroundColor = (int) Driver.Color.Black;
messageDisplay.FontColor = (int) Driver.Color.Green;

messageDisplay.Add("------" + DateTime.Now.ToString() + "------");

There is also demo project called DebugHelper.Demo.


Nextion displays allow temporary and permanent baud rate change. Default baud rade is 9600. If you don't want to change default baud rate permanently but want to use high speed serial communication use TemporaryChangeBaudRate helper method inside NextionDisplay display class. Here is an example:

Display = new Driver.NextionDisplay(Driver.NextionDisplay.TemporaryChangeBaudeRate("COM2", 9600, 115200), 240, 320);

Last edited Nov 21, 2015 at 10:12 AM by jernejk, version 31