Ocean Controls Modbus IO Module 8 Relay Outputs 4 Opto-Isolated Inputs 2 Analog Inputs (10 bit) 1 PWM Output (10 bit) 4 Input Counters Connections via Pluggable Screw Terminals 0-5V or 0-20mA Analog Inputs, Jumper Selectable 5A Relay Switching Power Indicator LED All enclosed in Professional looking plastic case 300-115200 Baud Modbus Slave Device Half Duplex 2-wire RS-485 The KT-5220 is a Modbus Slave IO module for interfacing to any PLC or PC using the Modbus protocol. It behaves as a Modbus Slave and Relays, Inputs and Outputs are controlled by writing to and reading from the Coils and Holding Registers. It can be used for many applications such as controlling lights and sprinkler systems, reading sensors and monitoring switches and other digital signals, or even for industrial control. The Relays are capable of switching up to 7A at 240VAC but the PCB tracks will only handle up to about 5A. Connections: Table 1 - Connections Label Description + Opto-Isolated Input Positive - Opto-Isolated Input Negative AN1 Analog Input 1 AN2 Analog Input 2 PWM PWM Output D+ RS-485 Data+ Connection D- RS-485 Data- Connection V+ 12V Power Supply Positive Input USB Unused NO Relay Normally Open Contact C Relay Common Contact NC Relay Normally Closed Contact Jumper Settings: The Analog inputs of the can be set for 0-5V or 0-20mA operation. Opening the case and inserting jumper shunts in the positions J1 and J2 will set the analog inputs to 0-20mA operation. Removing the shunts will set the analog inputs to 0-5V operation. Care must be taken to ensure that the inputs do not go above 5V or 20mA as damage to the microcontroller could occur. Using a jumper shunt in position J3 will enable a 120 Ohm termination resistor between the D+ and D- data lines. Using a jumper shunt to connect the SCL and COM pins of the I 2 C header pins will place the unit in default communications mode of Address 1, 9600 Baud, No Parity. 1 of 7
Using the Controller: The requires 12VDC to operate, this can come from a plug-pack, but you will need to remove any plug and connect the wires directly to the terminals. Connect the 12VDC positive to the V+ terminal and negative to the COM terminal next to it. Connect the to a PC using a RS-232 to RS485 or USB to RS-485 converter. Run the setup program to set the Modbus Address, Baud Rate and Parity. It can also be used to test the. Figure 1 - Test Program The main window of the software is shown in Figure 1. Enter the COM port number of the RS-485 port, which will be used to communicate with the unit in the COM text box. The address of the unit that is to be communicated with is entered in the address text box, the baud and parity can be selected from the menus. Clicking Use will open the specified COM port with the settings. Data transmitted to the unit is shown in the TX text box, data received from the unit is shown in the RX text box. If the settings of the unit need to be changed this can be done by adjusting the parameters and Relays can be turned on or off by checking or un-checking the check-boxes in the Relays group. Clicking the Check button in the Inputs group will make the program check the state of the s inputs. When an input is active the related box will change from red to green. The slider in the PWM group sets an output PWM percentage on the PWM output and the Check button in the Analogs group retrieves the value of the analog inputs and displays them on the bar graphs and in the text boxes. 2 of 7
Coils and Holding Registers: The Coils hold the status of the Digital Inputs and Relays. The Holding registers hold the counts for the Digital Inputs, the Analog Input readings and the PWM Output value. Tables 1 and 2 outline the Coils and Holding Registers. Table 1 - Coils Table 2 - Holding Registers Coil Use Value Register Use Value 1 Input 1 1=ON 0=OFF 1 Count 1 0-65535 2 Input 2 1=ON 0=OFF 2 Count 2 0-65535 3 Input 3 1=ON 0=OFF 3 Count 3 0-65535 4 Input 4 1=ON 0=OFF 4 Count 4 0-65535 5 Relay 1 1=ON 0=OFF 5 Analog In 1 0-1023 for 0-5V 6 Relay 2 1=ON 0=OFF 6 Analog In 2 0-1023 for 0-5V 7 Relay 3 1=ON 0=OFF 7 PWM output 0-1023 for 0-100% Duty 8 Relay 4 1=ON 0=OFF 9 Relay 5 1=ON 0=OFF 9990 Address 1-243 10 Relay 6 1=ON 0=OFF 9991 Baudrate See Table 3 11 Relay 7 1=ON 0=OFF 9992 Parity See Table 4 12 Relay 8 1=ON 0=OFF Settings: The Address, Baud Rate and Parity are stored in the units EEPROM by writing to Holding Registers 9990 to 9992. Valid Slave Addresses are 1-243, the Baud Rate and Parity are set according to Tables 3 and 4. By default the unit will have Address = 1, Baud Rate = 9600 and Parity = None. New Address, Baud Rate and Parity parameters are loaded when the unit is powered up. If the unit does not respond, or an incorrect Address, Baud or Parity has been set the unit can be placed in default mode to enable a user to set correct parameters. This is done by inserting a jumper link between the SCL and COM pins of the I 2 C header pins inside the unit. With the jumper in this position parameters will be Address 1, 9600 Baud, No Parity. The unit can only operate with 8 data bits and 1 stop bit, However using Parity = Mark will behave the same way as no parity and 2 stop bits. Table 3 - Register 9991 - Baud Rate Table 4 - Register 9992 - Parity Value Baud Rate Value Parity Default / 0 9600 Default / 0 No Parity 1 300 1 Odd 2 1200 2 Even 3 2400 3 Mark 4 4800 4 Space 5 9600 6 19200 7 38400 8 57600 9 115200 3 of 7
Circuit Page 1/3 - : Modbus IO Module 4 of 7
Circuit Page 2/3 - Inputs and Outputs: Modbus IO Module 5 of 7
Circuit Page 3/3 - Connecting to the : Connections 6 of 7
Parts List: 6-pin DIP socket U1-U4 4 8-pin DIP socket U7 1 18-pin DIP socket U5 1 28-pin DIP socket U8 1 4N35 Optocoupler U1-U4 4 ULN2803A Darlington Array U5 1 LTC485 Transceiver IC U7 1 PIC 18F2550 Microcontroller U8 1 7805 Regulator VR1 1 1N4004 Diode D1-D5 5 120 Ohm Resistor R14, R16 2 240 Ohm Resistor R7, R8 2 680 Ohm Resistor R19 1 1k 1W Resistor R1-R4 4 4k7 Resistor R5, R6, R9-R13, R15, R17, R18 10 8MHz Low Profile Crystal CR2 1 5mm LED in panel clip L1 1 22pF Capacitor C1, C2 2 0.1uF Capacitor C3-C9 7 1000uF 25V Capacitor C10 1 Small Heatsink VR1 1 12V Relays RL1-RL8 8 Pluggable Terminal Socket 12 way X1-X14 3 Pluggable Terminal Socket 5 way X15-X16 1 Pluggable Terminal Socket 2 way X17 1 Pluggable Terminals 2 way X9-X15, X17 8 Pluggable Terminals 3 way X1-X8, X16 9 Case 1 M3 Screw 10mm 1 M3 Nut 1 Self Tapping Screws 4 PCB with Side Panels 1 Header pins (2pins) J1-J3 3 Header pins (3pins) I 2 C 1 Jumper Shunts J1-J3, SCL 4 2 Wire Ribbon 100mm 1 Not Used U6, CR1, BAT1, USB-B 7 of 7