Skip to content

Commit

Permalink
Nextion documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aderusha committed Apr 1, 2020
1 parent 20ce49e commit b3df42d
Showing 1 changed file with 22 additions and 36 deletions.
58 changes: 22 additions & 36 deletions Documentation/02_Nextion_HMI.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Basic first-time use

For most users the deployment of the Nextion firmware is straightforward - simply copy [the compiled firmware image](../Nextion_HMI/HASwitchPlate.tft) to a FAT32-formatted microSD card, insert the microSD card into the Nextion LCD, and then apply 5VDC to the power pins on the panel. It should power up the panel, recognize the .TFT file, and update the panel automatically. Once the firmware update has completed you can remove power and eject the microSD card.
For most users the deployment of the Nextion firmware is straightforward - simply copy [the compiled firmware image](../Nextion_HMI/HASwitchPlate.tft) to a [FAT32-formatted microSD card](https://nextion.tech/faq-items/using-nextion-microsd/), insert the microSD card into the Nextion LCD, and then apply 5VDC to the power pins on the panel. It should power up the panel, recognize the .TFT file, and update the panel automatically. Once the firmware update has completed you can remove power and eject the microSD card.

Compiled TFT files are included for the [Basic](https://github.com/aderusha/HASwitchPlate/raw/master/Nextion_HMI/HASwitchPlate.tft) and [Enhanced](https://github.com/aderusha/HASwitchPlate/raw/master/Nextion_HMI/HASwitchPlate-Enhanced.tft) versions of the panel. This project does not currently utilize any features offered in the Enhanced panel, and some users have reported the Enhanced device does not fit in the provided enclosure. **It is strongly recommended that you do not use the enhanced display**.
Compiled TFT files are included for the [Basic](https://github.com/aderusha/HASwitchPlate/raw/master/Nextion_HMI/HASwitchPlate.tft) and [Enhanced](https://github.com/aderusha/HASwitchPlate/raw/master/Nextion_HMI/HASwitchPlate-Enhanced.tft) versions of the panel. This project does not currently utilize any features offered in the Enhanced panel, and the Enhanced device does not fit in the provided enclosure. **It is strongly recommended that you do not use the enhanced display**.

Once the project is assembled, future updates to the Nextion firmware can be handled over-the-air by utilizing the built-in web interface or by [issuing an MQTT command](06_MQTT_Control.md#command-syntax) with a URL to the target TFT file.

Expand All @@ -14,55 +14,41 @@ With the Nextion firmware flashed you can proceed to the [Electronics Assembly s

## Nextion Editor

For advanced customization you will need to download the (Windows-only) [Nextion editor](https://nextion.itead.cc/resource/download/nextion-editor/). You can find instructions on its use [here](https://www.itead.cc/blog/nextion-editor-a-basic-introduction).
For advanced customization you will need to download the (Windows-only) [Nextion editor](https://nextion.tech/nextion-editor/). You can find instructions on its use [here](https://www.itead.cc/blog/nextion-editor-a-basic-introduction).

If you want to edit the existing HASP interface, you will likely need to delete some pages in order to add your own work as the project consumes nearly the entire memory space of the Nextion basic panel. If you'd like to start a new interface from the ground up, copy over the existing Page 0 page as the ESP8266 firmware makes use of page 0 for user interactions and WiFi setup. The Home Assistant automations will probably need to be changed if any major modifications are made to the HMI.

## Nextion Instruction Set

The Nextion accepts and sends commands over the serial interface. A detailed guide to the Nextion instruction set can be found [here](https://nextion.itead.cc/resources/documents/instruction-set/). A mostly-complete list of all available instructions and their use is available [here](https://www.itead.cc/wiki/Nextion_Instruction_Set).

## Nextion color codes

The Nextion environment utilizes RGB 565 encoding. [Use this handy convertor](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to select your colors and convert to the RGB 565 format.

## HASP Nextion Object Reference

### Page 0
## Nextion Page and Object IDs

![Page 0](Images/NextionUI_p0_Init_Screen.png?raw=true)
Objects are referenced by page number (*not page name*) and object ID (*not object name*) as shown in the Nextion editor. The Nextion notation for each object is of the form `p[1].b[2]` meaning page number 1, object ID 2. Confusingly, button object *names* will start at `b0` but it might be object ID 2, or 7, etc. Other objects will be named similarly with different letters. For example, the first text field on the page will be automatically named `t0`. **Ignore these names**. They have nothing to do with the object ID, and all objects regardless of type are still referenced as `p[<page number>].b[<object id>]`

### Pages 1-3
![Page and Object IDs](https://github.com/aderusha/HASwitchPlate/blob/master/Documentation/Images/Nextion_Editor_Page_and_Object_Ids.png?raw=true)

![Pages 1-3](Images/NextionUI_p1-p3_4buttons.png?raw=true)
Screenshots of each object number on each page of the HASP project can be found in the [Nextion HMI documentation section](02_Nextion_HMI.md#hasp-nextion-object-reference).

### Pages 4-5
An object will have multiple attributes, some of which can be changed. For example, a button named `p[1].b[2]` may have a "txt" attribute which we'd refer to as `p[1].b[2].txt`. Not all attributes can be changed at runtime, the ones which can are shown in a green font in the Nextion editor (see the right pane of the image above.)

![Pages 4-5](Images/NextionUI_p4-p5_3sliders.png?raw=true)

### Page 6

![Page 6](Images/NextionUI_p6_8buttons.png?raw=true)

### Page 7

![Page 7](Images/NextionUI_p7_12buttons.png?raw=true)

### Page 8
## Nextion Instruction Set

![Page 8](Images/NextionUI_p8_5buttons+1slider.png?raw=true)
The Nextion accepts and sends commands over the serial interface. Your Home Automation system will send Nextion instructions wrapped in an MQTT message to be delivered by HASP to your display. A detailed guide to the Nextion instruction set can be found [here](https://nextion.tech/instruction-set/).

### Page 9
## Nextion color codes

![Page 9](Images/NextionUI_p9_9buttons.png?raw=true)
The Nextion environment utilizes RGB 565 encoding. [Use this handy convertor](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to select your colors and convert to the RGB 565 format.

### Page 10
## HASP Nextion Object Reference

![Page 10](Images/NextionUI_p10_5buttons.png?raw=true)
| Page 0 | Pages 1-3 | Pages 4-5 |
|--------|-----------|-----------|
| ![Page 0](Images/NextionUI_p0_Init_Screen.png?raw=true) | ![Pages 1-3](Images/NextionUI_p1-p3_4buttons.png?raw=true) | ![Pages 4-5](Images/NextionUI_p4-p5_3sliders.png?raw=true) |

### Page 11
| Page 6 | Page 7 | Page 8 |
|--------|--------|--------|
| ![Page 6](Images/NextionUI_p6_8buttons.png?raw=true) | ![Page 7](Images/NextionUI_p7_12buttons.png?raw=true) | ![Page 8](Images/NextionUI_p8_5buttons+1slider.png?raw=true) |

![Page 11](Images/NextionUI_p11_1button.png?raw=true)
| Page 9 | Page 10 | Page 11 |
|--------|---------|---------|
| ![Page 9](Images/NextionUI_p9_9buttons.png?raw=true) | ![Page 10](Images/NextionUI_p10_5buttons.png?raw=true) | ![Page 11](Images/NextionUI_p11_1button.png?raw=true)

## HASP Default Fonts

Expand Down

0 comments on commit b3df42d

Please sign in to comment.