Selec’s Flexys is a modular family of Programmable Logic Controllers (PLCs) and associated plug-in modules. The Flexys family also features the RS-485 Modbus remote expansion module featured in this article. The Selec EXP FLEX 3M V3 along with a FL-SC-AI03-U-AO02-U are shown in Figure 1. Together they add analog functionality to a Modbus-equipped PLC with three 14-bit analog inputs and two analog outputs.
This engineering brief provides a general introduction to the Selec EXP FLEX remote base as outfitted in Figure 1. The result is a freestanding, general purpose Modbus analog module. Additional modules may be grouped together to expand the remote I/O capabilities.
Figure 1: Image of the Selec EXP FLEX 3M V3 remote Modbus base hosting an FL-SC-AI03-U-AO02-U analog card. It is ready to be programmed via the AC-USB-RS485-02 USB to RS-485 cable.
** Tech Tip**: This article provides a general outline describing the necessary steps to prepare the featured Selec analog card remote operation via Modbus. The procedure is generally applicable to all of the Selec Flexys cards.
Be sure to consult the Selec literature for related information describing how to interface modules with their Flexys line of PLCs.
Steps to prepare the Selec components for general-purpose Modbus use:
This section provides a general outline used to prepare the Selec equipment. Be sure to consult the appropriate instruction manuals for detailed information. For example, we focus on the Modbus interface but gloss over the 0-10 V vs 4-20 mA input and output configuration. Note that related cards such as a digital I/O will have similar Modbus requirements but unique hardware configurations.
The steps are summarized as:
-
Set the Modbus baud rate and address for the EXP FLEX 2M V3 remote base.
-
Configure the FL-SC-AI03-AO02-U card jumpers.
-
Power the EXP FLEX 2M V3 remote base via a 24 VDC supply.
-
Program the EXP FLEX 2M V3 expansion module.
-
Connect the Modbus wires and termination resistors as necessary.
-
Map the FL-SC-AI03-AO02-U card’s internal registers to their Modbus addresses
-
Program the PLC
Setting the baud rate and Modbus address
The EXP FLEX 2M V3 base has four DIP switches that must be set. They are seen in the module’s lower right-hand corner as shown in Figure 1. The switches are “programmed” for a 19200 baud rate and a physical Modbus address of 1.
Set the Internal Jumpers
Selec Flexys cards such as the featured FL-SC-AI03-AO02-U must be configured for proper operation using header jumpers as shown in Figure 2. This card may be configured to interface will many common analog industrial devices. This includes 0-10 VDC, 4-20 mA, and a variety of thermal sensors included RTD sand thermocouples such as types J and K.
Please refer to the Selec instruction manual for additional information on configuring the card.
Figure 2: Image of the FL-SC-AI03-AO02-U card’s internal jumpers. Note that all channels are configured for voltage.
Tech Tip: Modbus uses a differential signal transmission to minimize noise for long distance communication. The polarity of the twin wires is critical as the system will not function if the wires are reversed.
This little DIY LED logic probe is a good tool to check for communication activity.
Powering the EXP FLEX 2M V3
The EXP FLEX 2M V3 is powered via a 24 VDC source.
Presumably, the module will be installed in a remote cabinet some distance from the primary PLC. A twisted pair wire is then installed for Modbus communication. It is possible to run power wires from the primary equipment cabinet to the remote. However, it may be prudent to install a dedicated 24 VDC power supply in the remote enclosure.
Program the EXP FLEX 2M V3 expansion module.
The EXP FLEX 2M V3 remote base must be programmed to recognize the host card. Selec provides a EXP FLEX 2M V3 Utility to accomplish this task. A screenshot of the running program is included as Figure 3.
Programming requires a USB to RS-485 adapter such as the Selec AC-USB-RS485-02 as shown in Figure 1.
When complete, the previously illuminated red error lamp on the EXP FLEX 2M V3 will be extinguished.
Figure 3 Screen capture of the EXP FLEX 2M V3 Utility. The lower section presents the “View Modbus Table” information for the selected card.
Connect the Modbus wires and termination resistors as necessary
The system is now ready to respond appropriately to Modbus communication. Consult your PCL documentation as well as the Selec literature to determine the most appropriate setup for your system.
As a general statement, use Beldon 9841 shielded twisted pair wire for reliable communication over long distances. Also, you may need to add 120 Ω termination resistors to reduce line reflections.
Mapping the Modbus addresses
Modbus is an address-based protocol. To use the hardware, we must obtain a map that crosses the register names with the Modbus addresses. An example is provided in the code listing below.
It does take a bit of work to discover the Modbus addresses for the Selec cards. The most convenient location appears to be the EXP FLEX 2M V3 Utility “View Modbus Table” as shown in Figure 3.
Tech Tip: With respect to analog signals, Modbus identifies read only input registers and read/write output registers. For the analog card, the analog inputs (measured temperature, voltage, and current) are associated with input registers. Device configuration registers (holding registers) are written to modify the hardware operation.
/*
* Modbus Register Map for Selec FL-SC-AI03-U-AO02-U
*
* - The module is part of the Selec Flexys Series. It features:
* 3 Channel Analog Input
* 2 Channel Analog Output
*
* Reminder: Set the programming headers for J1 to J5 before use.
*
* Note:
* - Modbus Input Registers (Read-Only) begin at addresses 30000.
* - Modbus Holding Registers (Read/Write) begin at addresses 40000.
*
**************************
* Input Resister Mapping *
**************************
* Register Name Modbus Address Description
* Mod_ID 30000
* HW_VerNo 30001
* SWVerNo 30002
* SlotStatus 30003
* SlotErrorCnt 30004
*
* AI3_U_PV0 30005 Input value channel 0 e.g., when set to voltage, 9.5 VDC in yields 9500
* AI3_U_PV1 30006 Input value channel 1
* AI3_U_PV2 30007 Input value channel 2
*
* AI3_U_PVS0 30008 Channel 0 status e.g., 2 is overrange
* AI3_U_PVS1 30009 Channel 1 status
* AI3_U_PVS2 30010 Channel 2 status
*
***************************
* Output Resister Mapping *
***************************
* Register Name Modbus Address Description
* REG_AI3_U_SEN0 40000 Input channel 0 configuration value e.g., set to 15 to read voltage
* REG_AI3_U_SEN1 40001 Input channel 1 configuration value
* REG_AI3_U_SEN2 40002 Input channel 2 configuration value
*
* REG_AO2_U_OPT0 40003 Set Output % (0-100%) where 950 yields a physical 9.5 VDC output
* REG_AO2_U_OPT1 40004 Set Output % (0-100%)
*
* REG_AO2_U_TYP0 40005 Output 0 (module channel 3) configuration value e.g., 0 for voltage
* REG_AO2_U_TYP1 40006 Output 1 (module channel 4)
Program your PLC
We are now ready to integrate the Selec remote Modbus base into a larger industrial control system. Follow your PLC’s documentation to configure the Modbus. From there, read and write to the appropriate registers.
Tech Tip: Modbus addresses present a tripping hazard for programmers. For example, I’ve seen functions read the input registers. Instead of using the address of 30005 to read the channel 0 input register, the function takes a value of 5. This abstracted function then appropriately handles the Modbus protocol.
Parting thoughts
I’m excited to integrate this Selec product into my next PLC project. Without too much effort, we have constructed a Modbus-based RS-485 remote I/O with potentially up to 1000 feet distance between the main PLC and the remote enclosure.
As we depart, remember this document is a general guide for using the Selec components. Your assistance in expanding this topic to encompass other modules would be greatly appreciated.
Did I mention that a several remote FLEX 2M bases may be placed side by side to expand your remote Modbus based remote I/O.
Best wishes,
APDahlen
Related Information
Please follow these links to related and useful information:
About this author
Aaron Dahlen, LCDR USCG (Ret.), serves as an application engineer at DigiKey. He has a unique electronics and automation foundation built over a 27-year military career as a technician and engineer which was further enhanced by 12 years of teaching (interwoven). With an MSEE degree from Minnesota State University, Mankato, Dahlen has taught in an ABET-accredited EE program, served as the program coordinator for an EET program, and taught component-level repair to military electronics technicians. Dahlen has returned to his Northern Minnesota home and thoroughly enjoys researching and writing articles such as this.