HMI (Nextion) connection using Software serial on Portenta Machine Control

Hi there,

I have a Portenta Machine Control (AKX00032) which I want to connect to a Nextion NX8048P070 HMI.

There are a few compatible libraries for this but the NextionX2 looks like a good option. The example code includes "SoftwareSerial.h" which gives me the following error on compilation:

fatal error: SoftwareSerial.h: No such file or directory

After some digging I found someone trying to achieve something similar on the ArduinoCore-mbed gitHub repo and some example code setting up UART on PC_6 & PC_7 on a Portenta H7 but I cannot access the pins directly due to the design of the Portenta Machine Control.

Can I maybe use a I2C to UART or RS485 to TTL adapter to establish serial communication with the Nextion HMI?

I have more experience with ES32 and I have never come across a situation where I do not have any spare serial capable pins.

Any help would be greatly appreciated!

There is an RS232 port on the board at J5. The post linked below suggests you would have success using an RS232 to TTL adapter, you could give that a shot.

Portenta Machine Control RS232 Communication - Portenta / Portenta Machine Control - Arduino Forum

Hi @automatedmachine,
Thankyou for your suggestion. I am using RS485 in my project so I have ordered 2x Industrial 3V-5.5V TTL To RS485 Modules off eBay. I will report back when they arrive and hopefully this will solve the problem.

Were you able to get this to work? What was the trick?

I'm fighting with mine right now trying to do the same thing. I've purchased adapters for RS485 and RS232 to can't get it to work with either protocol. Some characters come across, but are displayed as empty boxes as though the baud rates don't match.

Hi @a67429, I have 2x "Industrial 3V-5.5V TTL To RS485 Module RS485 To TTL Serial UART With Isolation" from eBay but have not done any testing with them yet.

I will report back when I have tested them and hopefully I will have more luck than you. What modules did you use and do you have any example code?

Hi,

Did anyone figure his out?

Hi @omarfakhr,

Unfortunately not. My current project uses multiple RS485 modules so I could not figure out how to interface with the Nextion HMI in the same way I do with my other devices:

// Example
// Read 1 value from address 0x100 on device 1
ModbusRTUClient.requestFrom(1, INPUT_REGISTERS, 0x100, 1)
int value = ModbusRTUClient.read()

// Example
// Write 1000 to address 0x001 on device 2
ModbusRTUClient.beginTransmission(2, HOLDING_REGISTERS, 0X001, 1);
ModbusRTUClient.write(1000);
ModbusRTUClient.endTransmission();

If anyone can help with this it would be greatly appreciated. As I cannot see a way to integrate a TTL/UART HMI with the PMC.

I think these are the viable HMI options you have with the PMC:

  • HDMI display with connected PC
  • RS485 display (Limiting GUI software)
  • CAN Bus display (Limiting GUI software)

My workaround is to use a HDMI touchscreen on a USFF PC connected to the PMC via Ethernet and write a program on the PC to send/receive data to and from the PMC using the Arduino EthernetServer. It is not ideal but unless someone else knows any better its the most cost effective and feasible solution I can come up with.

1 Like