Nextion maximum distance serial

Hello, I’ve been using nextion HMI (4.3 intelligent series) for about 2 years and whit more than 100+ deployment in the field I think that nextion has a lot to offer but it misses ports. What is the maximum distance for ttl serial? Whit cable long 50cm I have no problem, but if I go 5+ meters it’s a hit or miss (more hit than miss I should say). I’m using a 9600 baud communication. The cable is a SFTP cat 6 cable. On some unit I have random disconnection from the PLC, until I power cycle the nextion. They are completely random, on 100 board maybe 5 have this problem. But it is annoying. I discovered that if I run the late or turn on the laser cutter (both industrial machinery), the nextion does this problem. The program on the plc continues to run just fine. On some unit affected by the problem I made the cable shorter (from 10 meters to about 2/3 meters) and the problem is gone. Does someone had similar problems?

I use nextion displays to control my power inverters , I use max3232 RS232 buffers from ebay they can be as little as $4 each with DB9 and the nextion cable plus into the header on the board at 2400 baud I have no problems with 45 meters of cable. I have programmed the display to control the inverters which have a CRC with every command which the nextion calculates (my own code on the nextion) and appends to the end of the data.

Have experienced power issues in the past. Can I suggest you power one of your problem units temporarily from much closer to see if the cause is signal or voltage

For powering the nextion I use a 15W meanwell DIN mounted power supply. Voltage drop across 10meters of cat6 cable can be an issue? I don’t have a defective unit on hand, but I can try whit a new unit and a cable and see if the issue reappears.

This can be a solution. However it must be reliable. I don’t have a CRC but a by direction communication protocol that barely send 4 bytes at a time (every 10 seconds when in active use). The same protocol on my domotic system whit a cable length of less than a meter always worked flawlessly. I have an oscilloscope on the way, will try in the field on a test unit if the problem come up and when.

The max3232 have schmitt trigger inputs that clean up the pulses , termination resistors and increase the voltage on the cable they work with 3V and 5V supply so even enable systems at different voltages to be connected.

I will try that chip and report.
I measured the signal whit the oscilloscope, whit and whit out cable extension. At 1 meter of length I have 5V on the other side. At 10 meter I have 4.9V. The signal is the same at the input and output, no interference encountered. The cable is a shielded twisted pair cat 6 eth cable, whit one pair for 5V, one pair for ground, and signal is tx-gnd, rx-gnd. The gnd are all connected together at both ends, the shielding is only connected to the PLC side. The power supply is a meanwell dc-dc whit a ripple of 200mV. But during testing, at random time, the connection stopped working. On the oscilloscope the nextion send some data, but the PLC doesn’t respond. The PLC program is functional and continue to work even if the nextion stop working. I have serial data cleaning if I don’t receive the correct sequence from the nextion and obv. no response from the PLC if the data is not correct. That interruption happened in an industrial setting, whit heavy machinery (laser cutter, 3 axis cnc, lathe cnc etc) all working together. After that interruption, it worked flawlessly until closing time, about 5 hours. I now have a nextion whit the same program at my lab running h24/7 for months and noticed no interruption. So the question is, does the nextion, whit HF machinery, generate a memory error itself that can cause data corruption?

This is a common problem. Serial communications have definite distance limits and they are affected by electrical noise. Serial (232/ttl) is usually good for about 25 feet, but that distance depends on the baud rate. The higher the rate, the shorter the run must be. RS 485 uses a higher voltage and can go much further.

Also, any devices which cause electrical noise, such as VFDs or other PWM devices will wreak havoc on a tiny signal like that. Using shielded cable will help a lot. And if you have to run your serial cable near a noisy cable, try to either keep it far away, or cross it at a right angle.

You should do a test. Set the baud rate at 115k and then determine how far you can go without issues. Then bring it down a little at a time, each time checking your max distance. It would be interesting to see the results.

For no problems at all use RS422 standard

+1
That’s what I use. A few years ago I even bought some TTL to RS422 converter ICs and made a tiny little circuit board with them. Sometimes converter prices are high for what they are.
Full duplex serial communication with differential signals for noise immunity. Use a basic twisted pair ethernet cable.
With a low enough baud rate you could just about go a km with this setup.

So here I am some months after. I tried some rs485 converter and they literally started smoking when the PLC send a lot of data to the screen and the screen tried to reply. So they worked great, until I went into diagnostic on the HMI…
So back to the start, serial TTL. I found a bug in my code, the PLC was sending too much serial data, overflowing the input buffer whit responses from nextion and “freezing” the display.
Solved that, I just connected another 10 meter of twisted shielded cable, the display was working on serial TTL whit 20 meter of cable (at 9600 baud)!
It works pretty well until I just don’t use the machine for some days. The PLC program continue to work just fine, the serial doesn’t send data but it can receive it but the nextion just stops working. It’s not a power saving mode, just the standard command to “dim” the screen after about some minute not being used.
I also have an enanched series nextion whit more than 2 months of uptime, working just fine. On the other hand the little intelligent 4.3 inch just freezes the serial data after some days not being used. I need to find a solution. If someone has the same issue, plz, reply!

little off topic:
Soooo, I bought some DWIN displays. Cheaper, better quality (plastic, screen, build) and also available whit more ports (I bought one whit an rs485 port and two ttl/rs232), up to 24V. The pc editor is clumsy and not so user friendly, but whit some tutorial it can be used whit no major issues. Now testing those, if you have the time and want to try a new cheap HMI, that’s not bad at all.

Is the serial data simplex or duplex? Can differential RS-485 simplex be used to extend the TTL?

Just a consideration when you’re using rs232 near high current/frequency cables, shielding such cables do help a lot. In fact, shielding high frequency power cables helped more than shielding communication cables in my experience. Also you might be able to convert your TTL RS232 signal to differential by using a MAX485 or similiar chip. There are lots of dirt cheap modules(<1$) out there that does that. That would make your communication signal even more immune to noise.

I used some cheap rs485 module. They kinda work, but they are not reliable to work 24/7 for years no stop. I went back to the drawing board and investigated more on why the display works just fine for some hours, then it stop working. I removed the display from the equation and connected my mcu, a serial to usb converter and an oscilloscope in the middle. Well, the mcu serial works fine (new program, only sending one char every 5 second to the pc) for about 12-48 hours, then it stops sending data. So in the firmware I inserted a reset function that fires whenever the machine is not in use for more than 6 hours… and problem solved! Working just fine now.
I also liked the Dwin display I started writing a library for them and they work well (the pc software is bad).

Shield high power cable works very well, it solves a lot of issues. But sometimes to pass the cable through small hole they (“electricians”) cut the connector and leave the shielding unconnected. That causes all sort of problems until someone finds the cause of that. Fortunately near this nextion the only high power cable carries a 24v DC at 4A max. On other application, when very high current is required I use ethernet displays, much more robust and everything, but the easy of use of nextion is almost unbeatable!