Problem with sending data from Arduino to Nextion display

Hi everyone,
I am using Nextion display (Nextion Enchanced NX4832K035) for my diy sim racing steering wheel project. My board is Sparkfun Pro micro 5V (its based on Arduino Leonardo) with AVR Atmega32U4.
My problem is that my microcontroller is no sending data to nextion display. I have done exactly the same things as in this tutorial Using Nextion displays with Arduino for check and won't work. I tried with Arduino Uno like in this tutorial Nextion+Arduino Tutorial #1 Beginner's Guide - YouTube but still doesnt work. So i think it must be the RX pin damage in nextion display. Please help i need a confirmation or denial if im wrong.

I don't recommend a Uno because there is no separate serial port available, you have to use the same one that drives the USB port, which is possible but problematic.

I am not familiar with the other board, can you provide a link to it please.

Please post photos of your set up, clearly showing all the wiring.

Also your code with code tags </> as per the forum instructions How to get the best out of this forum
Note I am asking for YOUR code as you have it, I don't just want you to say you used my code from the tutorial, I want to see exactly what you used.

Please also post a schematic, hand drawn and photographed is fine.

Finally which Nextion configuration from the tutorial did you use?

Thanks,

https://www.sparkfun.com/products/12640 This is board.
That is my code from your tutorial

void setup() {
  //This is for the serial monitor. Remove the // if you need to use it.
  //Serial.begin(9600);
  
  //This is for serial port 1, which is the one used for the Nextion in this demonstration. 
  //You might need to change this depending on which serial port you are using for your display.
  Serial1.begin(9600);
  
  //For demonstration
  HMI_startup_message();
}
void HMI_startup_message() {
  Serial1.print(F("t0.txt=\""));
  Serial1.print(F("Nextion demonstration by Perry Bebbington. For support go to https://forum.arduino.cc/index.php?board=7.0"));
  Serial1.print(F("\""));
  Serial1.write(0xff);
  Serial1.write(0xff);
  Serial1.write(0xff);
}
void loop(){
  
}

And fast drawn easy schematic

I know its awful but im sure i connect everything right


So On the first photo from right, Nextion RX to TX(yellow) TX to RX (blue) and fourth black wire is GND GND.


Second photo first red wire from the bottom 5V to VCC.

The 'fast drawn easy schematic' says it all: you have the serial port connected incorrectly.
Tx > Rx
Rx < Tx
Which is not what you have.

No sorry this drawn is incorrect it rush. i connect Nextion Rx to Tx and Tx to Rx correctly

1 Like

You have a lot of wires that have nothing to do with the Nextion, so, please just connect the Nextion and nothing else and try it like that without all the other stuff.

I would like to see a photo that clearly shows the wiring, by which I mean so in one photo I can clearly see both ends of the 4 wires between the Nextion and the Sparkfun Pro micro. I don't want a close up with wires disappearing to I do not know where.

Remember I cannot see your project, so I cannot see any mistakes.

I am not familiar with the Pro Micro, do you know for sure that the serial port is Serial1? I'm not saying it is or it isn't, I'm saying I don't know so that needs confirming.

Can you also post a photo of the Nextion display, so I can see what it is displaying please?

Does the Nextion even light up?

Thanks for fast replying, but man what is the difference if i have lot wires which are not defined and used at the moment than without them. Also this 4 wires that i describe earlier is connected to nextion via this wire is include when you buy display so it must be connected to nextion. Sorry for my little angry tone, but i struggling with this for the last 3 days and I combed the entire internet and i didnt find the answer.

for sure is Serial1

I'm trying to simplify the problem and make sure there is no other influence that might cause a problem. One of the basics of fault finding is to strip away anything that is not directly relevant so you can focus on the problem. I have no idea what those wires do or if they have any effect. Removing them simplifies the problem.

When I get like that I walk away, get some sleep or a beer or anything other than thinking about the problem, then come back rested and often spot the problem straight away.

I notice you are only running the start up code. One possibility is that the Nextion is getting the message before it is ready. Try this:

void setup() {
  //This is for the serial monitor. Remove the // if you need to use it.
  //Serial.begin(9600);
  
  //This is for serial port 1, which is the one used for the Nextion in this demonstration. 
  //You might need to change this depending on which serial port you are using for your display.
  Serial1.begin(9600);
  
  //For demonstration
  HMI_startup_message();
}
void HMI_startup_message() {
  Serial1.print(F("t0.txt=\""));
  Serial1.print(F("Nextion demonstration by Perry Bebbington. For support go to https://forum.arduino.cc/index.php?board=7.0"));
  Serial1.print(F("\""));
  Serial1.write(0xff);
  Serial1.write(0xff);
  Serial1.write(0xff);
}
void loop(){
  delay(1000);
  HMI_startup_message();
}

I tried this 2 times. 2 times failure :frowning:

More beer needed! :rofl:

or something stronger :joy:

1 Like

Do you have an oscilloscope? If so please check the signal on the Pro Micro Tx pin to see if it is sending data.

Also try changing to Serial instead of Serial1 so that the data is send to the serial monitor, what does it display?

its worked :D, thanks a lot so now i want to ask you how to send data to number like you did this for text?

1 Like

What worked? Stronger beer or the code I said to try?