Wishing a happy 2023 and starting with Hardware FAQ

First of all, a happy new 2023! I’ll use this occasion to introduce a new type of Sunday blog post: From now on, every now and then, I’ll publish a collection of FAQ around a specific topic, to compile support requests, forum posts, and questions asked in social media or by email. Another thing I’ll try to add over the next months should be helpful for all readers as it was often requested. Here an example of an email exchange with an anonymized user (AU):

AU: “Dear Thierry, thank you for all the deep insight in your Sunday blog. I remember that you wrote a few months ago about packing more and mixed data into a single 32bit integer. But now, I can not find the article and the demo code. It’s difficult to scroll through 109 Sunday blog posts”

Thierry: “Dear AU, I had to look up it myself, especially since it was almost one year ago, but here is the link: https://nextion.tech/2022/03/07/the-sunday-blog-data-packing-and-saving-eeprom-space-a-practical-example/.

AU: “Thank you very much. That’s exactly what I was looking for. Don’t you think that a Sunday blog index, ordered by topics, could make sense?”

You have been heard! It may take some time until everything is tagged with the corresponding keywords and the index built, but I find that it’s an excellent idea and worth to be realized.

For now, let’s start with some FAQ as promised…

Hardware FAQ

Q: What is the maximum cable length for serial connections between an MCU and the Nextion HMI?

A: By connecting the serial ports of the MCU and the Nextion directly (TTL UART), the maximum cable length is theoretically 2m when using a 9600 baud rate, and proportionally shorter for higher baud rates. That is due to the fact that the TTL serial pins of any MCU do not have specific line driver capabilities and can not handle the increased serial inductance and parallel capacitance of longer cables which explains the relatively quick signal degradation. Using an additional RS232 driver IC on both sides, MCU and Nextion, the cable length can be up to 15m or even more when low capacitance cable is used, as long as the total load capacitance seen by the TX port does not exceed 2500pF.

Q: My Nextion HMI screen is showing garbage and blinks as if it was constantly restarting. What’s that?

A: This effect occurs if the power supply can not source enough current and its voltage breaks down. That happens mostly with bigger screens (>= 4.3″) when powered from a classic USB port which can only deliver a maximum of 500mA. Use a more robust power supply because the bigger screens need simply more current, especially at startup. The easiest solution is using the Nextion Foca Max Adapter, where you connect the Nextion HMI on one side, and on the other side two things: First, your PC via USB for uploading the firmware and debugging, and second, an external power supply which can deliver enough power to “satisfy” the needs of bigger screens. And don’t forget that a speaker, connected to the Intelligent series HMI, can increase the current consumption by further 600mA

Q: Using a TTL serial to USB adapter, I have difficulties in establishing a stable connection with the Nextion

A: There are basically 4 ICs on the market which do this serial to USB conversion: PL2303, CH340, CP2102, and FT232. All available adapters on the market are based on one of these four. I’ve tested them all, and I do not recommend PL2303 and CH340. These are often not reliable. Especially for the CH340 it is known that there are many counterfeit products on the market which use illegal chip clones. I do recommend the FT232 (they had driver issues in Win10, two years ago, but these seem to be solved) and the CP2102, my preferred workhorse, not only for Nextion communication. That’s why the latter is also used in the Nextion Foca Max Adapter.

Q: Is there more detailed info about the GPIO pins on the Enhanced and Intelligent series?

A: Yes there is. The logic level voltages are only guaranteed up to a current draw of 1mA to protect the Nextion’s internal MCU (which uses more IO pins internally for communication with the Flash ROM and the LCD panel driver) from overload. If you want to drive higher loads like LEDs or even relays, please use an appropriate buffer. In its simplest version, its just 1 resistor, 1 transistor and 1 protection diode (when driving inductive loads) per pin. There are also specific driver ICs like the SN74LV4T125 which does buffering and logic level translation all-in-one or, if you need it bidirectional, the SN74LV4T245.

Q: Sometimes, my Nextion HMI sends garbage or unwanted data over serial, what to do?

A: The cause seen most often is (again) unstable power supply. Since the backlight is internally powered by a pwm modulated SMPS, the current consumption is not constant over time (the average is, though) but there are short periods (a few microseconds now and then) where the consumption is higher and others where the consumption is slightly lower. If your power supply gets down on its knees (as Germans say) during these short periods of higher consumption, this can induce serial garbage and/or a flickering screen. It can also trouble the triggering of timer actions. Thus, always plan the power supply with some headroom!

That was it for today and for the hardware side! Let’s see what the next week will bring us.

Happy Nextioning!

Comments, critics, suggestions? Just send me an email to thierry (at) itead (dot) cc! 🙂