RS485 to ProfibusDP Gateway for Laser Sensor Control
In modern industrial automation, integrating devices with different communication protocols is a common challenge. A typical scenario involves connecting a laser distance sensor that uses an RS485 serial interface to a Siemens PLC operating on a ProfibusDP network. Without a proper bridge, these two systems cannot exchange data. This is where an RS485 to ProfibusDP gateway becomes essential. It acts as a protocol converter, translating RS485 data into ProfibusDP telegrams and vice versa, enabling seamless control and monitoring.
This article provides a detailed technical guide on using such a gateway to control a laser sensor—specifically, sending commands to turn the laser on and off. We will cover the hardware setup, configuration steps in TIA Portal, and the exact message format required. Real-world application examples and key technical parameters are included to help engineers implement this solution efficiently.
Understanding the RS485 to ProfibusDP Gateway
An RS485 to ProfibusDP gateway is a specialized industrial communication device that bridges the gap between serial RS485 networks and ProfibusDP fieldbus systems. It functions similarly to a “language translator,” converting the data structure and electrical signals from one protocol to the other. On one side, it connects to the RS485 port of a sensor or actuator; on the other, it integrates into the ProfibusDP bus as a standard DP slave.
Key features of a typical gateway include:
- Support for baud rates from 9.6 kbps to 12 Mbps on the ProfibusDP side, and common RS485 rates like 9600, 19200, 38400, 115200 bps.
- Configurable data bits (7 or 8), stop bits (1 or 2), and parity (none, even, odd).
- Automatic baud rate detection on the ProfibusDP network.
- Galvanic isolation between RS485 and ProfibusDP interfaces to prevent ground loops.
- Easy configuration via GSD files and standard engineering tools like TIA Portal or STEP 7.
When selecting a gateway, always check the manufacturer’s compatibility list to ensure it supports the specific PLC model (e.g., Siemens S7-300, S7-400, S7-1200, S7-1500) and the sensor’s communication parameters. The gateway must be able to handle the required data throughput and any custom protocol framing.
Typical Application: Controlling a Laser Distance Sensor
Laser distance sensors are widely used in industrial measurement, positioning, and quality control. Many models offer an RS485 interface with a simple command set. For instance, to turn the laser on, you might send a specific hexadecimal string; to turn it off, another string. The sensor then returns measurement data continuously while the laser is active.
In a ProfibusDP environment, the PLC cannot directly send these RS485 commands. The gateway solves this by mapping the RS485 data to ProfibusDP I/O data. The PLC writes the command bytes to the gateway’s output area, and the gateway forwards them to the sensor via RS485. Conversely, the sensor’s response is placed in the gateway’s input area, which the PLC reads cyclically.
Consider a real-world example: an automotive welding line needed to integrate a new laser sensor for seam tracking. The existing Siemens S7-300 PLC only had a ProfibusDP interface. By installing an RS485 to ProfibusDP gateway, the integration was completed in just one week, avoiding the cost of replacing the entire control system—saving tens of thousands of dollars.
Step-by-Step Configuration Guide
The following steps outline how to set up the gateway to control a laser sensor using a Siemens PLC and TIA Portal. The example uses a generic RS485 to ProfibusDP gateway and a laser sensor that accepts hexadecimal commands.
1. Check Sensor Communication Parameters
Before configuration, obtain the sensor’s RS485 settings: baud rate, data bits, stop bits, parity, and the command format. For this example, the sensor uses 9600 bps, 8 data bits, 1 stop bit, no parity, and the laser ON command is AA 00 01 BE 00 01 00 01 (hex). The laser OFF command might be AA 00 01 BE 00 00 00 00.
2. Configure the Gateway in TIA Portal
Install the gateway’s GSD file in TIA Portal. Then, add the gateway as a DP slave on the Profibus network. Set the DP slave address (must match the hardware setting on the gateway). Configure the I/O data sizes: typically, you need enough output bytes to hold the command and enough input bytes for the sensor response. For this sensor, 8 bytes output and 8 bytes input are sufficient.
In the gateway’s parameter settings, configure the RS485 port to match the sensor: 9600 baud, 8 data bits, 1 stop bit, no parity. Some gateways allow you to set a timeout and a start/end delimiter for the serial frame.
3. Programming the PLC
In the PLC program, use move or transfer instructions to write the command bytes to the gateway’s output area. For example, in a Siemens S7-300, you can use the SFC15 (DPWR_DAT) to write consistent data to the DP slave. Alternatively, if the I/O is in the process image, you can directly address the output bytes (e.g., QB0 to QB7).
To turn the laser on, set the output bytes to 16#AA, 16#00, 16#01, 16#BE, 16#00, 16#01, 16#00, 16#01. The gateway will send these bytes over RS485. The sensor then activates the laser and starts sending measurement data, which appears in the gateway’s input area (e.g., IB0 to IB7). The PLC can read these bytes to obtain distance values.
4. Testing with a Watch Table
A convenient way to test is using TIA Portal’s watch table. Add the output bytes and input bytes to the watch table. Modify the output values to the laser ON command and observe the input values changing as the sensor returns data. This confirms successful communication.
Technical Parameters and Data Mapping
The table below summarizes typical configuration parameters for an RS485 to ProfibusDP gateway used in such an application.
| Parameter | Value | Notes |
|---|---|---|
| ProfibusDP Baud Rate | Up to 12 Mbps | Auto-detected from network |
| RS485 Baud Rate | 9600 bps (typical) | Configurable to match sensor |
| Data Bits | 8 | 7 or 8 selectable |
| Stop Bits | 1 | 1 or 2 |
| Parity | None | None, Even, Odd |
| I/O Data Size | 8 bytes In / 8 bytes Out | Configurable up to 244 bytes |
| Isolation | 1500 VDC | Between RS485 and ProfibusDP |
| Power Supply | 24 VDC (typically) | From control cabinet |
Benefits and Future Trends
Using an RS485 to ProfibusDP gateway offers several advantages:
- Cost-effective integration: Avoids replacing existing PLCs or sensors, preserving legacy investments.
- Quick deployment: Minimal wiring and configuration changes; often plug-and-play with GSD files.
- Flexibility: Supports a wide range of RS485 devices, from sensors to barcode scanners and drives.
- Reliability: Industrial-grade design with isolation and wide temperature range (-25°C to +70°C).
Looking ahead, protocol gateways are evolving to support IIoT standards like OPC UA and MQTT. This allows data from RS485 devices to be directly published to cloud platforms or SCADA systems, enabling predictive maintenance and advanced analytics. As industrial automation moves toward more interconnected systems, such gateways will play a crucial role in bridging legacy equipment with modern networks.
Pro Tip: When implementing this solution, always ensure proper termination resistors on the RS485 bus and use shielded twisted-pair cable. For the ProfibusDP side, adhere to standard installation guidelines with proper connectors and termination. Testing with a known good sensor and a simple PLC program first can save hours of troubleshooting.
Frequently Asked Questions
Q: Can I use this gateway with other PLC brands?
A: Yes, as long as the PLC supports ProfibusDP master functionality. The gateway appears as a standard DP slave, so it works with Siemens, ABB, and other Profibus masters.
Q: What if my sensor uses a different command format?
A: The gateway is transparent; it simply passes the bytes. You can adapt the PLC program to send any command sequence required by your sensor.
Q: How do I handle multiple sensors on one RS485 bus?
A: If the sensors have unique addresses and the gateway supports multi-drop, you can address them individually by including the sensor address in the command. However, careful timing and bus loading considerations apply.