RS232 to TTL converter electrical noise isolation

I am using AC motor inverter in my project. inverter is separately connected to 220 VAC and Arduino is getting power from printer port from PC and all the relays and sensors are getting power from 5v external DC power supply. when I turn on the motor using relays some how Arduino mega get electrical noise and Serial-monitor get hangs. then I need to reset it in order to work again. so I add optocoupler 6n137 to limit switch, relays and encoder. Now I don't get noise. Now there is a need of weight indicator I try adding hx711 but that is not reliable so I utilize the weighting indicator D-60 sang and used its data using RS232 to TTL converter connect to Arduino. I received the data with no problem. But I get the electrical noise when AC motor gets on. so I try putting 6n137 but I get no serial data displayed. I connect the output of 6n137 to digital pin 29 and read as input to see if the connection are right there I can see the bits 1s and 0s. so I chatgpt the problem it says there might be signal timing issue and it also suggested to use TLP2361, as it is used to isolate high speed signals but I am getting the same problem no data on serial communication but I can see bits in digital pin.

The solution..

There is likely some other thing you failed to mention to chatgpt that is the problem.