How to test RS-485 of 7" Industrial Panel PC
Touchberry 7" HMI Raspberry Pi Panel PC Communications
20 May, 2021 by
How to test RS-485 of 7" Industrial Panel PC
Boot & Work Corp. S.L., Fernandez Queralt Martinez


Introduction


Raspberry Pi automation

The Touchberry Panel PC control for industrial monitoring is provided with two RS-485 communication channels. Both are half-duplex and are controlled via SPI0 bus

The RS-485 is defined as a multipoint differential bus system. It is ideal for transmitting at high speeds over long distances and through noisy channels since the twisted pair and shielded wire reduce the noises induced in the transmission line.

So, let's check how to test the RS-485 in your HMI industrial touchscreen Touchberry Pi 7" Panel PC monitoring for industrial control!

 

Touchberry Pi 4B 7"

Related links

How to connect 
Raspberry Pi industrial PLC to Wi-Fi

Read >>

 

Basics about Raspberry Pi PLC
Analog outputs

Read >>


How to find your
perfect industrial PLC

Read >>

How to program Raspberry PLC
Interrupt inputs with Python

Read >>

Raspberry PLC
Family products

Read >>

TouchBerry Pi
Family products

Read >>

      Hardware

      The industrial Raspberry Pi monitoring for industrial automation has two RS-485 channel communications. Both are Half-Duplex and are controlled via SPI0 bus. So, connect the twisted pair and shielded wire from an RS-485 port to the other one, and add a jumper for the Half-Duplex, as shown in the picture below:

      Hardware - How to test RS-485 of 7" industrial Panel PC























      Software

      1. Open up a terminal window and create a new file called rs485.sh like this:

      touch rs485.sh


      2. Give permissions to execute it:

      chmod 755 rs485.sh


      3. Modify the file content with the nano editor:

      sudo nano rs485.sh


      4. Copy and paste the following code to the file:

      #!/bin/bash

      if [ -d /sys/class/gpio/gpio27/ ] ; then
          echo 27 > /sys/class/gpio/unexport
      fi

      stty sane 115200 -F /dev/ttyS0 raw -echo

      echo 27 > /sys/class/gpio/export
      echo out > /sys/class/gpio/gpio27/direction

      echo 1 > /sys/class/gpio/gpio27/value
      echo 17 > /sys/class/gpio/export

      echo out > /sys/class/gpio/gpio17/direction
      echo 0 > /sys/class/gpio/gpio17/value

      cat /dev/ttyS0 > /tmp/rs485.txt &
      cat_pid=$!

      sleep 2

      echo "OK" > /dev/ttyS0
      RESULT=$(cat /tmp/rs485.txt | tr -d '\0')
      { kill -9 ${cat_pid} && wait ${cat_pid}; } &> /dev/null

      if [ -n "${RESULT}" ] ; then
              echo rs485 true "${RESULT}"
      else
              echo rs485 false "RS-485 cannot read from /dev/ttyS0"
      fi


      Exit the file with Ctrl + X > Yes > Enter.


      5. Execute the script and get the output as shown below:

      sudo ./rs485.sh


      Execute the script
      How to test RS-485 of 7" Industrial Panel PC
      Boot & Work Corp. S.L., Fernandez Queralt Martinez
      20 May, 2021
      Share this post
      Archive

      Looking for your ideal PLC?

      Take a look at this product comparison with other industrial controllers Arduino-based.

      We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


      Industrial PLC comparison >>

      Do you want more information?

      Just fill the form!

      Tell me more!