Start a new topic

Nextion Display with Arduino Uno: How To

I finally got my 7" Nextion Enhanced display working with the Arduino Uno R3 board.  It took a lot of trial and error and I'm sure there are other ways of doing it but, this is what I did. 

1. Download ITEADLIB_Arduino_Nextion-master from

ITEADLIB Arduino Nextion


2. Setup Arduino Uno with SoftwareSerial according to these instructions.

SoftwareSerial Setup


3. I opend the CompNumber example from the library example folder. There are 3 files CompNumber.HMI, CompNumber.INO and CompNumber.TFT 

4. I opened the CompNumber.HMI file with the Nextion Editor. I then compiled it and got the newly created Compnumber.TFT file (File-->Open Build Folder) and copied to a SD card making sure it was the only .TFT file on the card. I then loaded the file to the display by doing

  •  First power off the display and insert the SD card then power on display.  
  •  When the display shows success message.  
  •  Power off the display and remove the SD card.  
  •  Then Power on display. You should now see the display you have      uploaded. 

5. I Modified the .ino file to use SoftwareSerial as shown in attached CompNumber.ino file.

6. Upload the attached file and run. When the "+ Button" is touched the number should incremrnt and when the "- Button" is touched the number should decrement.

That's it. It is enoubn for me to start experimenting and using the display.

I hope you find this information useful and it helps getting you started.

Gene-



ino
(3.13 KB)

2 people like this idea

I have same problem. Please help us.


1 person likes this

Hi Bayram,


I know exactly how you feel. I've struggled for weeks trying to get my Nextion display to do something using an Arduino Uno. After a lot of trial and error I finally got something working using the method described above your comment.


Give it a try and let me know how you make out.


Gene-

Hi I did all instructions step by step and tried three different uno boards but I could't manage it. Something is wrong and I couldn't find it. I attached my files . May you check them please?

HMI
ino
(3.12 KB)
h
(1.34 KB)

Hi Bayram,


I quickly looked at the HMI file and the first thing I saw was the "Send Component ID" (lower right section) was not checked. It needs to be checked on both buttons as shown in the bottom picture. I did not try your HMI and INO files together yet I had some things to take care of. I will try them when I get a chance I just wanted to point out the obvious thing that I first noticed. Maybe this is the problem.


I'm using a 7 inch display so, I would have to make some adjustments to run your project.


Let me know how you make out.




Gene-

Hi Eugene,


I checked and upload hmi(.tft) file again. It didn't work again but tx and rx lights are blink when I touch those buttons(+ and -). Namely we manage communicating of uno and nextion but there are a few mistakes to work properly.

Hi Bayram,


Well, I had a good look at the files you gave me and I've come to the conclusion that there is something wrong with the Number Component or we're not implementing it correctly.I tried a bunch of things but couldn't get it to work so I switched it to a Text Component and re-worked the .INO file a little. I got it working so at least you have a working example of something to experiment with.


The .INO and .HMI files are attached. The NexConfig.h file was configured correctly so leave it as is.


I will have to see if I can figure out how to use the Number Component. There is no reason why it's not working other than we're implementing it incorrectly.


You'll have to change the display back to match your display model.


Please let me know if this works or not so I can know for myself what's going on.


Good Luck,

Gene-

HMI
ino

Hi Eugene,


Thanks a lot. it is working very well. I have to be careful about component name and id. I am learning step by step by practising with these tutorial. May I ask you if I have problem in future about nextion? 

Thank you very much again. :)

Hi Bayram,

I'm so glad you got it working on your display although, it's not using the Number Component at least the Text Component is working. I will try to see if I can get the Number to work I will certainly need that in the future. If/when I do get it working I will let you know.


I would be more than willing to help with future questions/problems just keep in mind I am by NO means an expert when it comes to Nextion displays. I too am learning step by step so with that said I am willing to share what I know.


Good luck and happy programming.

Gene-


The CompNumber example is working. I really didn't do anything to it other than add the SoftwareSerial code to the INO. I am also using the newest version of the Nextion Display Editor V0.37 so I don't know if that did anything but any way it's working.


Gene-

HMI
(2.01 MB)
ino
(2.99 KB)

 @ Gene,


Thanks for sharing this SoftSerial part.

It makes it more easier to use a Atmel 328 based chip.


I've tested some more setups, like the hardware serial.

(after disabling the #define DEBUG_SERIAL_ENABLE)

Both are working fine without any problems.


The only thing what can happen, is the communication from the FTDI chip.

In both (SoftSerial and hardware serial) it can happen by powering the set with a USB output, that they can't connect to the Nextion.

For sure when you running Arduino IDE, because it's looking/searching for hardware !

Most time after uploading the sketch, it all go's well...

When I re-boot (power off/on) the Nano and I still running Arduino IDE, it go's wrong.

The Red LED onboard starts flashing, after I've closed Arduino IDE, the connection is OK.

(if the Red LED isn't flashing, the communication is OK between the Arduino board and the Nextion.)


During this tests, I was running at Arduino IDE 1.6.8 and Nextion library 080.

Hallo pleas code 

entryapp-gen.ino

I can not compile it in ide 1.8.2.Reports an error


entryapp-gene:31: error: 'NexText' does not name a type

 NexText t0 = NexText(0, 3, "t0");



Pleas help . thank you


In your ino, you include the Nextion.h library. But to compile, it must not only be included, it has to be installed in the correct user library directory, so that Arduino 1.8.2 might find it and accept NexText class declarations.

Hello
I downloaded the entire library of ITEADLIB Arduino Nextion and put it in the libraries directory.The library contains the Nextion.h folder., But it does give me this error.Should I remove the Nextion.h library and paste it into a separate directory?How to name it?

adr.jpg
(75.4 KB)

Library is installed through the IDE

Sketch -> Include Library -> Add .ZIP Library ...

(corrected above)


> ... gives me "this error".

What error.  Any error given tells of nature

 - based on nature - determines exactly how to fix.


Such is an adruino.cc issue for their forums and documentation


Login or Signup to post a comment