rs232 communication between arduino uno & fanuc cnc

hello. I'm using ATmega328P board (arduino uno) with rs232 shield (max232) and an lcd screen to print strings received. I have a rs232 usb adapter on my computer to test and send messages to arduino. I receive fanuc cnc messages successfully with my usb rs232 from pc and send messages to arduino with this converter succesfully also. all the baud rate and other rs232 port settings are the same with fanuc machine but arduino doesn't read anything coming from the machine. but pc does. I simulate pc as fanuc machine with the same settings and send messages to arduino and arduino successfully receives and displays them on lcd screen. What am I missing? I tried to switch pin2 to pin3 on the cables, tried many things but no success. it doesn't even get noise or something else to show weird characters on screen. just nothing. I played with rs shield and inserted random current on the cable to create noise, arduino captures this noises and shows weird characters but doesn't get one bit from the machine. thanks.

1 Like

Perhaps the Fanuc machine needs DSR pin connected to DTR pin. And possible the RTS pin connected to the CTS pin.
Does your PC support the use of those pins? Your Arduino probably does not.

Paul

I use prolific PL2303 chipset adapter on pc. doesn't max232 shield support these pins? is it possible to activate them on arduino? do you know how to test if machine requests these pins to be active?

kowalski_61:
I use prolific PL2303 chipset adapter on pc. doesn't max232 shield support these pins? is it possible to activate them on arduino? do you know how to test if machine requests these pins to be active?

The max232 boards ONLY support the RX and TX pins. The best test is to just jumper the pins on the connector for the other device. Otherwise you would need two more max232 boards and a whole lot of programming.
Paul

I checked and wired DSR-DTR and CTS-RTS on the fanuc side and nothing changed. Still no data coming from cnc machine. I need to know what is the behaviour of usb pc serial adapter while transferring. It doesn't make any sense.

I do not see where you state you have the ground connections for the RS-232 connected. Could this be your problem?
Paul

ground connection comes with the rs232 cable from the machine, so it directly enters to the rs232 shield on arduino. isn't it the proper way to do it?

kowalski_61:
ground connection comes with the rs232 cable from the machine, so it directly enters to the rs232 shield on arduino. isn't it the proper way to do it?

It is, but did you test it to the Arduino ground?
Paul

I powered arduino with a 5V battery pack, ground cable enters max232 shield from the machine. What do you mean by testing it to the arduino ground? I can connect a 220v to 5v adapter directly to machine power lines and get power from there. do you think does this make a difference? (and why both battery powered pc and arduino receives messages without a problem but machine not? they don't have same ground either.)

The Arduino Uno and Nano have two ground pins on the board. Use you Ohmmeter to check for continuity between one of those ground pins and the MAX232 where your cable from the CNC machines is connected. Otherwise, take you Ardino an all with the CNC cable attached over to the CNC machine and test for continuity between the Arduino ground and the machine controller ground.
Paul

so you are saying that the ground of the machine should reach to arduino uno over the shield. I'll check that. thank you. (I thought shield should be isolated from the arduino)

kowalski_61:
so you are saying that the ground of the machine should reach to arduino uno over the shield. I'll check that. thank you. (I thought shield should be isolated from the arduino)

No, I am saying the RS-232 has a signal ground wire in addition to the TX and RX data wires. The signal wire must be connected machine to machine or there is not a RS-232 signal circuit.
If the wire from the CNC machine has a shield it must NOT be connected to other than the CNC machine or else it is not a SHIELD, it is a conductor of noise, etc.
Paul

This page has wiring details for the Fanuc and PC side. This is something I used to deal with 20+ years ago but have since destroyed all my programs, tips and cheats.

well, thank you guys I figured out the problem. I use POPEN command to send data via serial but it turned out that after POPEN command cnc doesn't send or complete sending the string until it sees PCLOS command. After using pclos command arduino reads everything machine sends. But pc usb adapter captures everything even without pclos command. maybe the code I use in arduino couldn't catch it before transfer completed with pclos command.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.