Arduino Nano not uploading data to Nextion Display

Hello @Ralphyboy
Welcome.

Please can you read How to get the best out of this forum, then go back and edit your code to include code tags </> as per the instructions. Code tags make the code easier to read and stop the forum software interpreting code as formatting and messing it up.

Your wiring is not easy to see in the photo, so my comments are based on what you said and what I think I can see:

  • LCD 5v to 5v in - OK

  • Arduino VIN to 5v in - No, the 5V pin is where you connect 5V to power the Every, the Vin pin is for about 7V+. If you connect 5V to Vin then the Every is probably running on, maybe, 3V or so.
    LCD GND & Arduino GND to Ground - OK

  • LCD TX to Arduino RX (Pin 2)

  • LCD RX to Arduino TX (Pin 1)

OK but you are confusing 2 different things and treating them as if they are the same. There are 2 ports on a Nano Every: Serial, which is the first serial port, port 0, which is the one you use to upload code over the USB cable to the Nano Every, and also the one used by the serial monitor. In your code where you have, for example:

Serial.print("n0.val=");
Serial.print(variable1);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

You are sending data to the serial monitor on your PC, not to the Nextion. Nowhere in your code are you sending anything to Serial1, which is your Nextion. You need:

void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}

Next, everywhere in your code that you want to send something to the Nextion replace Serial.xxx with Serial1.xxx

How are you putting the configuration from the the Nextion editor on to the Nextion? You can't do it with things wired they way you have them because the PC is connected to Serial and the Nextion to Serial1, the Nextion editor cannot talk to the Nextion. Simplest is to use a micro SD card, as per my tutorial Using Nextion displays with Arduino

You have included nextion.h in your code; are you intending to use the Nextion libraries? If so I will warn you that to the best of my knowledge there is on one who currently answers questions on here who helps with the Nextion libraries. If you use my methods I will help you, but there are other options suggested in the tutorial. My tutorial uses a Mega, but you can substitute a Nano Every; Serial1 on the Every and the Mega work the same (different pin numbers), so my Mega code should be OK with your Every (please tell me if it's not).

Enjoy.

1 Like