Start a new topic

How to connect Nextion to Arduino

We are trying to lighting a led from Arduino Mega 2560. But we couldn't find the code that connects the Nextion panel to Arduino. Can anyone help about this ? We tried every way but we couldn't communicate Nextion. Are we skipping something. Nextion panel is 7 inch and wont work with 5V thats because we are plugging it to plug socket with 12V. This is the code and HMI we are trying. Thanks in advance.
(349 KB)
(646 Bytes)

You have several issues that require more reading.

 - This includes the Nextion Data Sheet

    Nextion 7 inch is recommended to be supplied 5V 2A

 - The Arduino MEGA 2560 Data Sheet

    Max 5V current supplied by MEGA is less than recommended 5V 2A

    Refer to the MEGA 2560 Documentation for what MEGA is capable of

Thats fine but we cant communicate Nextion panel to Arduino. What solution do you propose for it ?

More reading.

If I could read everything ı wouldnt ask here right ?

not mandantory ... :-)

You started off with telling me you tried pulling from current Arduino Mega.

 - I told you MEGA is not capable in this manner as per its documentation.

- this does suggest you didn't read Nextion Documentation nor MEGAs

Besides a "that's fine", insufficient current to run everything will be your undoing and

you can kiss your 7" goodbye as you end up tossing it out because you damaged it.

So how would you like me to proceed?

  If you have 5 or 6 extra 7" Nextion's laying around and such doesn't matter

  Then lets proceed and we can waste them one by one because errors from you 

  not reading any of the documentation.

My reading off the documentation does not increase your understandings of.

 - it increases my understandings.

So start with what you understand

 - and what have you read and understood thus far?

You stated:

  We are trying to light an LED from Arduino Mega

    - an LED only draws more current from Mega

  as stated, Mega does not have sufficient to supply Nextion recommendations

  and now you wish to draw even more current from this insufficient supply.

  This is not a Nextion issue but understanding Arduino Mega.

You stated:

   We couldn't find the code that connects Nextion Panel to Arduino

   The Nextion connects to Arduino via wires

     - as described in the Nextion documentation

   To me this states you haven't read the documentation

You asked:

   Can anyone help about this?

   - The Nextion Documentation and many other writings are this help.

   I concluded, you haven't read any about

  They are written so that people can find at 2:00am or 7:00pm

You stated:

   We have tried every way but we couldn't communicate to the Nextion

   - every way is indeed incorrect, as correct way you didn't try, so not every

   but two possibilities exist

      - one is that you already damaged by hooking it up incorrectly and

        perhaps there is no longer any means to communicate.

      - or you haven't read Itead's documentation on how to communicate.

Your code .ino file shows you have read other peoples code

   - and it shows you haven't read Itead's code

     and it shows you haven't tried any of Itead's Arduino examples

   using a library that is not Itead's and made for specific project

      (such iis the origins of such library), the author's do not support

      and you want to come and ask to fix their code for your needs?

   Such is indeed the wrong manner.

Code can be accomplished with or without a Library

Both are outlined and pinned in Forum

  - the forum also has a search bar on every page

    but then same with Google, Bing, Yahoo

The Nextion Instruction Set needs to be read.  This is indeed help you seek.

You state:

   We are skipping something.

   - I agree, the reading of documentations for Nextion and for MEGA

   - The Quick Step Guide.

   - The Iteadlib Arduino Nextion Library

   - The Nextion Instruction Set

   and any of the examples provided.

You do not need to read all that was ever written

   but you do indeed need to read the basics.

If you are a high tech millennial, the box's QR code launches

    Nextion HMI Solutions page in web browser

If you are not - Help menuitem from Help menu in Nextion Editor.

    also launches Nextion HMI Solutions page.

Or i think I couldnt express myself. It is working, we didnt damage anything. We tried to work with 5V 2A supply from Arduino but the Nextion panel is turning on and off so we thought that it needs more power than that. But it didnt work either. We tried to plug 5V to Arduinos 5V GND to GND, what the documentation is telling us to do. We just trying to figure out why it doesnt communicate with Arduino. Nextion panel is working fine that I told "Thats fine" was for it. My english is insufficient for some technical words thats why I needed help. Thank for replying anyway.

And we didnt take any higher than 2A current I am sure about it.

Serial port doesnt respond too. Two of them are responding to pc when we plug them to pc seperately. But they don't communicate. And by the way we tried CompButton example too. Serial Port is responding with recvRetCommandFinished err

recvRetCommandFinished err

setup done

Nextion HMI Solutions page

Nextion Instruction Set

Nextion Enhanced 7.0" DataSheet

Nextion Basic 7.0" DataSheet   

Nextion Editor Quick Start Guide

Nextion Arduino Tutorial without Nextion library

IteadLib Arduino Nextion Library

Arduino Nextion Examples

Nextion FAQs

* Tools, Tips, Tricks and How-TOs

» Nextion TTL Serial

* Nextion user manual (updating)

But also Arduino MEGA 2560 documentation on

Getting Started

Need Help?



ATmega2560 Datasheet - 435 pages attached below


You state:

   both work with PC independently

   but do not communicate with each other

What is your connections?  GNDs have to be common.

But the 5V 2A supply comes from where?

  - the Mega can surely not deliver from its 5V line.

  - therefore 5V 2A supply needs to come from elsewhere

Serial responses of Nextion CompButton

   recvRetCommandFinished err 

This is inconclusive if Nextion is plugged into wrong Serial port

  it will also give this response

Correct details important to find out why.

port Serial was working, this is how error message was received.

 - default Configuration in NexConfig.h is for Serial2

therefore Nextiion RX/TX needs to be connected to TX2/RX2

On smaller Nextion displays such as 3.5",  or 2.4"

   5V 0.5A is recommended and as such Mega is able to deliver

   (Refer to Nextion Datasheet for specific model)

   as such Nextion 5V to Mega 5V and Nextion GND to Mega GND

   Nextion RX to Mega TX2 and Nextion TX to Mega TX2 is okay.

At least until many more things are connected to Mega

   when demand is too high for Mega to output such supply

   then powering Nextion by external-to-Mega supply is needed.

But on Nextion 7.0" 5V 2.0A is recommended

  this always means powering Nextion external-to-Mega.

But Mega is certainly unable to supply 2.0A to its 5V pin.

  As more is connected to Mega and more subsystems kick in

  more demand is met, supply needs to be re-examined.

Nextion RX to Mega TX2, Nextion TX to Mega RX2

Nextion 5V 2.0A from external supply

Mega power supply in from source

But Mega source GND and Nextion source GND common

Login or Signup to post a comment