Introduction
RS-232 is an interface that designates a standard for the exchange of serial binary data between a DTE (Data Terminal Equipment), such a computer, and a DCE (Data Communication Equipment), such a router.
In this post, you will learn how to test with the RS-232 communication protocol from our 7" Industrial Panel PC with another Raspberry Pi PLC controller for industrial automation.
Related Links
Basics test
RS-232 Protocol
1. First of all, let's take the Raspberry Pi based PLC and wire it to your Industrial Panel PC as shown in the picture below. By doing this, you will be able to send any message from any Raspberry Pi industrial PLC to our 7" Panel PC through the RS-232 protocol for industrial control.Â
2. Once your hardware is ready, let's go into the devices. If you have two screens, you just have to connect an HDMI cable to the HDMI ports from both devices and connect them to the screens. Otherwise, both have a static IP address: 10.10.10.20, which allows you to connect through SSH.
3. Open the RS-232 ports in both Linux terminals with baudrate 115200 in the /dev/ttyS0 port:
stty sane 115200 -F /dev/ttyS0 raw -echo
4. From the Panel PC where the RX cable is connected, run the following command to wait for the message to be received:
cat /dev/ttyS0
5. From the industrial Raspberry Pi PLC, where the cable is connected to the TX pin, echo a message to send through RS-232:
echo "OK" > /dev/ttyS0
6. Finally, this is what you will get in your Industrial Panel PC terminal window, which will tell us that the communication was successful!
Tip:Â Try wiring a cable from the RX port from the open source PLC Raspberry Pi to the TX port of the 7" Panel PC. Also, reverse the commands to test the RX from the Raspberry PLC and the Tx from the TouchBerry Pi 4.
Want to know the basics about the RS-232 communication protocol with an Arduino PLC?
Check the following link.
How to test RS-232 from 7" Raspberry Pi Panel PC