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 blog, you will learn how to test with the RS-232 communication procotol from our 7" Industrial Panel PC with another Raspberry PLC.
1. First of all, we are going to take the Raspberry PLC and we are going to wire it to our Industrial Panel PC as shown in the picture below. By doing this, we will be able to send any message from any Raspberry PLC to our 7" Panel PC through the RS-232 protocol.
2. Once our 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 it 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:
5. From the Raspberry 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 it will tell us that the communication was successful!
Tip: Try wiring a cable from the RX port from the Raspberry PLC to the TX port of the 7" Panel PC, and reverse the commands to test the RX from the Raspberry PLC and the Tx from the TouchBerry Pi 4.