nextion lcd screen made in china

If you’re a Nextion user you might have run across the name TJC. TJC is Taojin Chi, a Chinese company that is somehow affiliated with Nextion and which Nextion generally denies any involvement with.

Apart from the silkscreened logo and the first characters of the part number, these PCBs are 100% identical. The part numbers are the exact same, silkscreened part references the same, PCB traces the same, everything except the model is identical. (see below)

Apart from one being in Chinese and one in English, these too are identical. All features, buttons, etc are the same. When pressed, the Nextion support crew will tacitly acknowledge that TJC is the same product, but is supposed to only be sold in mainland China. TJC panels typically sell for less than half the price of the equivalent Nextion panel. Anyone selling TJC outside of mainland China is pretty quickly shutdown, presumably by the Nextion team to protect their profit margins.

The challenge with this is that the source (HMI) and compiled (TFT) files for each device are nearly identical but region-locked, so you cannot use a Nextion HMI in the TJC editor and vice versa, nor can you flash a Nextion TFT to a TJC panel, etc. After some basic investigation this appears to be due to security measures enabled on the STM32 processor which prevents simple hardware attacks from allowing the translation.

So that’s the deal - TJC is the Chinese Nextion, (officially) sold only in China, and the tools for programming it are only offered in Chinese language. The Nextion folks freak out whenever anyone brings it up, because they are busy collecting 100% extra $$$ whenever they can sell you a Nextion LCD instead of a TJC LCD.

nextion lcd screen made in china

OverviewNextion is a Human Machine Interface (HMI) solution combining an onboard processor and memory touch display with Nextion Editor software for HMI GUI project development. Using the NEXTION Editor software, you can quickly develop the HMI GUI by drag-and-drop components (graphics, text, button, slider, etc.) and ASCII text-based instructions for coding how components interact at the display side. Nextion HMI display connects to peripheral MCU via TTL Serial (5V, TX, RX ,GND) to provide event notifications that peripheral MCU can act on, the peripheral MCU can easily update progress, and status back to Nextion display utilizing simple ASCII text-based instructions. Comparing with Basic Series, the Discovery Series has a better MCU performance, the same functionalities as Basic, and Lower Price. That’s Nextion Discovery Series Products.

nextion lcd screen made in china

In the first article, we downloaded the Nextion IDE (integrated development environment), built a couple screens with various objects, and tested it in simulation. For this installment, we’ll be loading software onto a real Nextion TFT display and interacting with a PIC16F1824 microcontroller programmed with ME Labs PBP3 BASIC software. Finally, it will be tested on a breadboard.

It is assumed you have already read the Touch Screen Display Part 1 article in Issue-4 of Nuts & Volts and have downloaded the Nextion IDE Editor software (see Resources). For the PIC side, if you don’t already have the PBP3 software, go to http://pbp3.com/download.html and grab your copy. (Note, only the PBP3 Gold is able to program the PIC16F1824. It’s available as a free 30 day trial if you wish to test it.) A PIC programmer will surely be needed. I strongly suggest you go to www.Microchip.com and download the PIC16F1824 datasheet for easy reference. Also, we’ll be using real hardware in this installment which requires a Nextion display, a breadboard, a PIC16F1824 processor, as well as a few ancillaries (resistors, LEDs, a pot, etc.).

This time, we’ll be frequently referencing the Nextion Instruction Set. Although it’s available in the IDE (so long as you’re connected to the Internet), I chose to print it out for easier reference (I’m one of those 50+ years old school types who favor paper). I have made numerous notes to my printed copy. Due to the length, the PBP code will not be printed in this article but is available in the downloads. As a side note, the PBP3 BASIC firmware’s fundamental function is to convert BASIC to ASM. The ASM created by PBP is not easily extracted and edited. Also, there’s no easy way to “port” code from PBP to C. It would have to be rewritten in C. There is a massive amount of information on the Internet supporting the Arduino platform for Nextion.

The objective is to create an HMI (Human Machine Interface) using a Nextion TFT display that communicates with a PIC16F1824 processor to actually do stuff. To keep it short and simple, we want:

Keeping with the “cheap” concept while learning, this article will be built around the smallest NX3224T024_011 2.4” (240 x 320 pixel) resistive touch display. Nextion sells displays as large as 9.0” (800x480 pixels), for a total of eight size choices. If your project requires something larger than 2.4”, you have several options.

In the previous article, the Nextion Instruction Set wasn’t much more than a mere footnote. For this phase, the Instruction Set will be referenced quite often. You may wish to print it for easier reference (and notes) as mentioned previously. At a minimum, be sure you have either the web version or the Instructions tab open in your Nextion IDE (which requires Internet access).

We’ll be breadboarding a fairly simple circuit to facilitate digital and analog inputs and outputs from and to the PIC processor, feeding our Nextion display. When you look at the schematic in Figure 1, you’ll see lots of unused pins on the PIC. In fact, we could actually do this experiment with an eight-pin PIC. The extra pins are to add more buttons, switches, knobs, and other real world gizmos to your experiment later. You could also substitute the PIC16F1824 with practically any other PIC of your choosing.

The PIC RA0 (TX) is connected to the RX pin on the Nextion, and the PIC RA1 (RX) is connected to the Nextion TX pin. We’ll throw a momentary button on RC4 because it’s digital only. It will use a pull-up resistor R3, making it Active-Low (when pressed, it’s at ground state; = 0). A pot on RC2/AN6 gives us an analog value to send to the Nextion. RA3 is the !MCLR, or RESET pin. It should be tied to five volts with a 4.7K ohm resistor.

We’ll be using the same NX3224T024_11 2.4” (240x320 pixels) resistive touch screen as in the first article. The display is oriented at 90° horizontal. We’ll also be reusing the Splash1 screen (available in the downloads), as well as the MS_Sans_16 and WideLatin_48 fonts.

At this time, open the Nextion Instruction Set to review a few things pertaining to the above code. The “prints” command (Section 3 - Operational Commands) instructs the Nextion to send data over the serial port.

The first obvious anomaly is the use of prints 0xFF,1 three times to terminate a UART transmission. The very first thing the Instructions mention is “All instructions over serial: are terminated with three bytes of 0xFF...”. We could send anything we wanted over serial, and the Nextion will obediently send it. However, for consistency, we’ll use the Nextion convention. When we decipher the PIC code, it will make more sense.

Notice we created a Number object (n0) but nowhere in the Nextion code did we provide any means of doing anything with it. Also, we added a Picture of a red bulb (p1), then turned it off at start-up. Again, nothing further is mentioned in the Nextion code. Changes are handled from the PIC side of things.

Lastly are the Variables. A couple notes: The variable Hin is listed as Hin VAR BYTE[10]. The bracketed 10 reserves 10 memory addresses — all called Hin — but with offsets. In short, this creates an array to store bytes of received information from the Nextion. It’s a bit large for this project, but perhaps too small for others.

Finally, we get to the code. The first line is PAUSE 200. When the Nextion first starts, it shoots out 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, (Startup), then 0x88, 0xFF, 0xFF, 0xFF (Ready). We can skip all that and start communications when both sides are ready. The rest of Start turns off the amber LED (Aled = 0), clears a few working variables, fires up Timer 2, enables UART Receive (RCSTA.4 = 1), and enables Interrupts (INTCON.7 = 1).

Skip over Main for now and let’s look at the subroutines. Sort loads the Hin array as Bytes are received from the Nextion. When three $FFs are received, it sets our Mail flag indicating Transmission is Complete. (Dealt with in Main.)

Next, Clear_Hin rotates through the array, Hin clearing each memory address. The reason for this is we need to count 0xFF ($FF) Bytes to know when the Nextion is finished transmitting. As a value could conceivably be 0xFF, it shouldn’t be counted as End of Transmission. Clearing Hin avoids left-over values that could potentially contaminate future Receive transmissions.

Filter is where we decipher the Nextion packet. Looking at the Nextion Instruction Set, Section 7 - Format of Nextion Return Data, it lists Code Bytes and their meaning. The subroutine Filter is where we decipher them. As you scroll down through the SELECT CASE offerings, you can match every Code from Nextion to a CASE, plus three extra.

Referencing the Nextion Instruction Set for a moment, notice the Codes are sequentially listed. However, there are several gaps; 0x06 > 0x10, 0x13 > 0x19, 0x21 > 0x22, 0x25 > 0x64, 0x72 > 0x85, 0x8A > 0xFC, and 0xFF. Consider these pockets as empty apartments to house your variables (except 0xFF covered shortly). This gives us a total of 215 available slots to assign variables.

Back to Filter in the PBP code, CASE $06 is where the state of our Nextion b0 Button arrives, and CASE $07 is for our Slider (h0) value. Additional variables would be assigned other available hex values. CASE $FF is special, as there is no Nextion command 0xFF. Receiving $FF for Hin[0] indicates we received a real value of $FF for h0 (or something else) and mistook it for the first $FF in the End of Transmission sequence. Bytes are shifted one address to the left, and the Filter routine is exited (to preserve our Mail and rDone flags).

Get_Knob first reads the ADC value of our pot and decides if it changed (IF Knob != OldKnob THEN). If it has, we send the new value to the Nextion (GOSUB Send_Knob). Send_Knob sends ASCII “n0.val=“ and our ADC value for Knob. We’re using a variable Kval to determine how many ASCII characters we need to send. IF Knob > 100, THEN we send three digits (Kval = 2). If it’s less than 100, we send two (Kval = 1), and if it’s less than 10, we only send one character (Kval = 0). FOR b0 = 0 TO Kval sends only the needed characters. Without this special clause, a value of 99 would read 990 on our Nextion n0. A value of 7 would read 700.

The subroutine Send_Knob requires a bit of explanation. The Nextion Instruction Set tells us that all transmissions are in ASCII. It also tells us that most Nextion commands can be sent via UART.

We’ll be using the PBP LOOKUP command to bit-bang out our Nextion commands. PBP offers a simpler solution than the route chosen. You could use HSEROUT or even DEBUG to send data. Nevertheless, follow along as we manually execute our transmissions.

The value 99 becomes 990. The value 7 becomes 700. Just below ARRAYWRITE KnobA... is an IF/ELSEIF statement that limits how many digits will be sent to the Nextion. Finally, there’s a FOR/NEXT LOOP that sends three $FFs. Note that in the C programming language (and the Nextion Instruction Set), hexadecimal is denoted as 0xFF, while PBP uses the $FF nomenclature.

The subroutine Send_Button is very similar to Send_Knob, except we test our Sw input and send an ASCII command that reflects the state of our button. IF Sw = 0 THEN indicates the button is pressed (pulled high with R3, grounded when pressed). We then send “vis p1,1” to the Nextion — a literal command turning on our red circle. If the Sw button is not pressed, “vis p1,0” is sent, turning off the circle.

Scroll back up to the Main routine. The first task is to check to see if our Sw button has changed states. If so, we tell the Nextion with GOSUB Send_Button. Next, we read the pot value, but only once per 256 cycles through Main (using Rot). Within the Get_Knob routine, we check to see if Knob changed since the last reading. If it did, Send_Knob is called.

The third section of Main checks for Framing or Over-run Errors and does a UART RESET if there are any. Fourth, if the Nextion has sent us anything, we have to load it into our Hin array. When we get our End of Transmission (3 x $FF), we know we have a complete packet and it’s time to “read our mail:” IF Mail = 1 THEN : GOSUB Filter. Every pass through Main increments our Rot variable. When it rolls over from 255 to 0, we check our Knob value again. This throttles visits to the ADC Register and reduces congestion for our slow 9600 baud UART.

The software for the Nextion is created using the Nextion IDE. Programming is done one of two ways: serial port or SD card. Instructions for using a serial port are quite explicit and covered numerous times in various Nextion documents. However, using the SD card to program was quite difficult to find. For this reason, I’ll cover that method here.

The SD card slot in most laptops is sized for the regular SD card. The Nextion takes only microSD cards. The solution is something like Figure 3. All Electronics offers SD card adapters for micro-to-standard. The SD card must be formatted as MS-DOS FAT 32.

Make sure the SD card is completely empty with no folders. From the Nextion Editor, click on File, then “Open build folder.” A new window will appear with your project(s) listed and the .TFT file(s). Copy the appropriate .TFT file to the SD card. When you create a program in Nextion, it generates an .HMI file, which is the whole project. The .TFT file is the only thing the Nextion can use for programming.

Copy the .TFT file to the SD card, remove the micro from the holder, insert it into the Nextion, then power it up. You’ll see it loading, running through the programming sequence, then finally it will read, “Update Successed!” (remember, Nextion is a Chinese company). Power-down, remove the SD card, and you’re done!

With your breadboard loaded as per the schematic, the PIC programmed with the software in the downloads, and the Nextion programmed with the screen we just created, you should have a functioning HMI. If you turn the knob on the breadboard, the Nextion n0 value should read the ADC value (0 >> 255). Press the momentary button and the red circle appears; let off and it disappears.

From the Nextion screen, press “Blink LED” and the amber LED lights up. Press it again and the LED goes out. Slide the red bar across the Slider (h0) and the red LED gets brighter and brighter. Slide it the other way and the red LED gets dimmer (see Figure 4).

nextion lcd screen made in china

Why use Nextion ? -Firstly, Nextion is easy to use. With the Nextion Editor software, you can easily create an intuitive touch user interface even if you are a beginner.

Nextion Display Connection Nextion display has a built-in ARM microcontroller that controls display, for example it takes care of generating buttons, creating text, store images or change background. Nextion display communicates with any microcontroller using serial at a 9600 baud rate.

Nextion Display Weather Station Kit Nextion display could be used together with other accessories to assemble DIY kit, for example weather station kit.

With the microcontroller and Nextion HMI display, you can easily make alightweight phone that is able to make calls, receive calls, send and also receive SMS. It uses a GSM module to connect to the mobile networkand Nextion display to visualize GUI interfaces.

nextion lcd screen made in china

Nextion LCD Touch is a powerful 7.0-inch TFT HMI display with 32MB of flash memory data storage space, 1024 bytes of EEPROM, and 8192 bytes of RAM. With GPIO support, customers can now use Nextion to control external devices such as RFID NFC devices, Wireless Barcode / QR code scanners and upload data to a database server using WIFI. The add-on for this display also features Bluetooth/ BLE 5.x for local connectivity with nearby devices.

Powering this LCD touch can be made using a standard micro USB cable 5V 1A , alternatively can be made with a power supply up to 12V 1A using two copper wire screwed to the corresponding onboard terminal block.