logicbus TCG140-4 GSM-GPRS Remote IO Module User Manual
- June 9, 2024
- Logicbus
Table of Contents
- Short description
- Features
- Applications
- Specifications
- Installation
- LED indicators
- Initial setup via USB
- Setup via SMS
- Protocols and API
- Data Logger
- Firmware update
- Factory default settings
- Environment information
- Safety
- Maintenance
- Package content
- References
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
TCG140-4 GSM-GPRS Remote IO Module
User Manual
Short description
TCG140-4 is a 4G LTE Cat.1 universal I/O module. It supports also 3G and 2G
wireless communication and provides data connectivity on LTE-FDD, DC-HSDPA,
HSPA+, HSDPA, HSUPA, WCDMA, EDGE, and GPRS networks.
The device has 2 digital inputs, 4 analog inputs, digital interfaces for
external sensors, and 4 relays.
Two of the analog inputs can be switched either in a current loop (0-20mA) or
voltage modes. The relays can be activated either remotely (via SMS or HTTP
API command) or locally – from the status of the monitored parameters.
TCG140-4 supports all digital sensors of Teracom.
All monitored parameters and the status of relays can be periodically saved in
the embedded data logger. It is also possible to arrange records on any alarm
condition.
The universal I/O module supports HTTP API for easy M2M communication. The
device sends periodically an HTTP/HTTPS Post to a remote server with an
XML/JSON status file. As an answer, the server can send commands for relay
activation or settings change.
Features
- Multi-band connectivity;
- Data logger with up to 70000 records;
- Setup via USB, SMS, and HTTP API;
- 2 digital “dry contact” inputs;
- Up to 4 analog inputs with 0 to 10VDC range;
- Up to 2 current loop (4-20mA) inputs;
- Settable multiplier, offset, and dimension for analog inputs;
- 4 relays with NO and NC contacts;
- 1-Wire support for all Teracom sensors;
- MODBUS RTU sensors support;
- MQTT 3.1.1 support;
- SMS alarm alerts for up to 5 numbers;
- Email alarm alerts for up to 5 email recipients;
- Periodical HTTP/HTTPS Post with current status in XML or JSON file to a remote server;
- Periodical HTTP/HTTPS Post with logger data in CSV format to a remote server;
- HTTP API commands;
- Firmware update over USB or Internet.
Applications
TCG140-4 is suitable for industrial automation, data acquisition systems, environmental monitoring, local control of an electrical and non-electrical parameter, building automation, etc.:
-
SCADA systems
TCG140-4 be easily integrated into SCADA systems. The periodical HTTP/HTTPS Post is suitable for client-server platforms. -
Stand-alone data logger
The device can be used as a standard data logger with a minimum record time as low as 1 minute. The logged data can be periodically uploaded to a dedicated server as a CSV file. -
Environmental monitoring and control
Specifications
-
Physical characteristics
Dimensions: 158 x 119 x 34 mm
Weight: 470 g
Mounting: wall and DIN rail -
Environmental limits
Operating temperature: -20 to 55°C
Operating temperature for USB setup: 0 to 40°C
Storage temperature: -25 to 60°C
Ambient Relative Humidity: 5 to 85% (non-condensing) -
Standards and Certifications
Safety: EN 62368-1:2014 + EN 62368-1:2014/AC1-3:2015 + EN 62368-1:2014/A11:2017 +
EN 62368-1:2014/AC:2017-03:2017, EN 62311:2008
EMC: EN 55032: 2015 + EN 55032: 2015/AC:2016-07 + EN 55032: 2015/A11:2020
EN 55024: 2010 + EN 55024: 2010/A1:2015
EN 61000-3-2: 2014
EN 61000-3-3: 2013 + EN 61000-3-3: 2013/A1:2019
RFU: EN 301 489-19 V2.1.1, EN 301511 V12.5.1, EN 301 908-1 V11.1.1,
EN 301 908-13 V11.1.2, EN 301 908-2 V11.1.2, EN 303 413 V1.1.1
Green: RoHS
• Warranty
Warranty period: 3 years
• Power supply
Operating voltage range (including -15/+20% according to IEC 62368-1): 10 to 28 VDC
Current consumption: 0.37A @ 12VDC -
Cellular interface
Standards: LTE-FDD, DC-HSDPA, HSPA+, HSDPA, HSUPA, WCDMA, EDGE and GPRS
Bands (TCG140-4e variant):
4G LTE: B1/B3/B7/B8/B20/B28
3G: B1/B8
2G: B3/B8
Bands (TCG140-4n variant):
4G LTE: B2/B4/B5/B12/B13/B25/B26
3G: B2/B4/B5
2G: Not supported
Bands (TCG140-4a variant):
4G LTE: B1/B2/B3/B4/B5/B7/B8/B28/B66
3G: B1/B2/B5/B8
2G: B2/B3/B5/B8
Bands (TCG140-4g variant):
4G LTE: B1/B2/B3/B4/B5/B7/B8/B12/B13/B18/B19/B20/B25/B26/B28/ B38/B39/B40/B41
3G: B1/B2/B5/B8
2G: B2/B3/B5/B8
SIM card size: Micro
Antenna connector: SMA-F -
Analog inputs
Isolation: Non-isolated
Type: Single-ended
Resolution: 10 bits
Mode (Analog inputs 1 and 2): Voltage
Mode (Analog inputs 3 and 4): Voltage / Current (WEB interface selectable)
Input Range: 0 to 10 VDC, 0 to 20 mA
Accuracy: ±1%
Sampling Rate: 500ms per channel (averaged value of 250 samples)
Input Impedance: 1 mega-ohm (min.)
Built-in resistor for current mode: 410 ohms -
Digital inputs
Isolation: Non-isolated
Type: Dry contact
Sampling rate: 10ms
Digital filtering time period: 30ms -
Relay outputs
Type: Form C (N.O. and N.C. contacts)
Contact current rating: 3 A @ 24 VDC, 30 VAC (resistive load)
Initial insulation resistance: 100 mega-ohms (min.) @ 500 VDC
Mechanical endurance: 10 000 000 operations
Electrical endurance: 100 000 operations @ 3 A resistive load
Contact resistance: 50 milli-ohms max. (initial value)
Minimum pulse output: 0.1 Hz at rated load
CAUTION: The device does not contain any internal overcurrent protection facilities on the relays’ contact lines.
External fuses or short circuit current limiting circuit breakers, rated to 3 Amps, are to be used for overcurrent protection of the connecting lines. -
Digital sensor interfaces (1-Wire and RS-485)
Output voltage: 5.0 ± 0.3 VDC
Maximum output current (for both interfaces): 0.2A -
Internal FLASH memory
Endurance: 100 000 cycles (any save command or full scroll (70000 records) of the logger) -
Lithium battery
Type: CR1220
Caution! Risk of explosion if the battery is replaced by an incorrect type.
Installation
This device must be installed by qualified personnel. The installation
consists of mounting the device, connecting the antenna, connecting inputs and
outputs, providing power, and configuring via a web browser. This device must
not be installed directly outdoors.
Attention! Before installing the SIM card in the card slot, please ensure that
the PIN code is disabled.
5.1. Mounting
TCG140-4 should be mounted in a clean and dry location on a non-flammable
surface. Ventilation is recommended for installations where the ambient air
temperature is expected to be high.
Mount the device to a wall by using two plastic dowels 8x60mm (example Würth
GmbH 0912 802 002) and two dowel screws 6x70mm (example Würth GmbH 0157 06
70). See Appendix C, fig. 1 for mechanical details.
Maintain spacing from adjacent equipment. Allow 50 mm of space on all sides,
as shown in fig.2 in Appendix C, this provides ventilation and electrical
isolation.
For DIN rail mounting, a DIN-RAIL-MOUNT-KIT should be used.
5.2. Connectors
Attention! Disconnect the power supply before wiring.
The correct wiring procedure is as follows:
- Make sure power is turned off;
- Make wiring connections to the terminals;
- Apply power.
It is recommended to test and configure TCG140-4 without any controlled
device.
Make sure that wires are properly attached to the terminals and that the
terminals are tightened.
Not proper wiring and configuration can cause permanent damage to the module
or the equipment to which it is connected or both.
Inputs and outputs locations are shown below:
Connector 1 Power – 2.1×5.5, central positive
Connector 2 1-Wire interface
Connector 3 RS-485 interface
Connector 4 mini USB
Connector 5 Pin1 – Digital In 1
Pin2 – Ground
Pin3 – Digital In 2
Pin4 – Analog In 1
Pin5 – Ground
Pin6 – Analog In 2
Pin7 – Analog In 3
Pin8 – Ground
Pin9 – Analog In 4| Connector 6
Pin1 – NC Relay 1
Pin2 – COM Relay 1
Pin3 – NO Relay 1
Pin4 – NC Relay 2
Pin5 – COM Relay 2
Pin6 – NO Relay 2
Pin7 – NC Relay 3
Pin8 – COM Relay 3
Pin9 – NO Relay 3
Pin10 – NC Relay 4
Pin11 – COM Relay 4
Pin12 – NO Relay 4
Connector 7 GSM Antenna
Connector 8 SIM card
---|---
Connector 2
| Pin| Description| Corresponding UTP wires
color
---|---|---|---
1| 1-Wire GND (most left)| White/Brown
2| 1-Wire GND| White/Green
3| 1-Wire Data| Green
4| 1-Wire GND| White/Orange
Connector 3
| Pin| Description| Corresponding UTP wires
color
---|---|---|---
1| not connected (most left)| Orange/White Tracer
2| not connected| Orange
3| not connected| Green/White Tracer
4| Line B-| Blue
5| Line A+| Blue/White Tracer
6| not connected| Green
7| +VDD| Brown/White Tracer
8| GND| Brown
5.2.1. Power supply connection
TCG140-4 is designed to be supplied by adapter SYS1308-2412-W2E or similar,
intended for use in the conditions of overvoltage category II. The power
supply equipment shall be resistant to short circuits and overload in a
secondary circuit.
When in use, do not position the equipment so that it is difficult to
disconnect the device from the power supply.
5.2.2. 1-Wire interface
1-Wire is a registered trademark of Maxim integrated products, Inc. It is
designed to connect several sensors over short wiring. It is not suitable for
long distances or noisy environments.
The maximum number of sensors (1-Wire or RS-485) connected to TCG140-4 is
eight.
The device supports all Teracom 1-Wire sensors. Connected sensors are
automatically detected and the appropriate dimension is assigned.
It is strongly recommended to use “daisy-chained” (linear topology) for multi-
sensor systems:
It is strongly recommended to use only UTP/FTP cables and keep the total cable
length up to 30m. Although functionality has been achieved in the longer
distance, we cannot guarantee error-free operation over mentioned wiring
length. We recommend reading Maxim’s 1-Wire tips at
https://www.maximintegrated.com/en/design/technical-
documents/tutorials/1/148.html.
We guarantee proper operation only with Teracom 1-Wire sensors.
5.2.3. RS-485 interface
RS-485 is a standard for serial communications systems defined by
Telecommunications Industry Association (TIA) and Electronic Industries
Alliance (EIA). Implementing the standard, communication systems can be used
effectively over long distances and in electrically noisy (industrial)
environments.
The maximum number of sensors (1-Wire or RS-485) connected to TCG140-4 is
eight.
MODBUS RTU protocol specifies that the address of the device should be between
1 and 247.
The user should take care of appropriate address settings.
For multi-sensor systems “daisy-chained” (linear topology) should be used:
Interconnections are realized by UTP/FTP cables with RJ-45 connectors. The
popular Ethernet wiring standard ANSI/TIA/EIA T568B is used.
It is recommended to use standard patch cables for LAN networks.
Attention! Special care should be paid on termination of the bus. The last
sensor in the chain should have a 120-ohm terminator installed on the free
RJ-45 socket. The terminator is delivered with the module.
We recommend keeping the total cable length up to 30 m, although the RS-485
interface works over a much longer distance.
5.2.4. Digital inputs connection
Attention! Digital inputs are NOT galvanic isolated.
The TCG140-4 digital inputs can be used as “dry contact” only.
The term “dry contact” means that to this input can be connected devices with
an open drain or
relay outputs – door contact switch, push-button, PIR detector, etc.
The following picture illustrates how an alarm button can be connected to a
digital input of TCG140-4. One side of the contact is connected to “Digital
In” while the other side is connected to the “GND” terminal.
The maximum cable length for a digital input should be up to 30 meters.
5.2.5. Analog inputs connection
Attention! Analog inputs are NOT galvanic isolated.
Analog inputs of TCG140-4 can be used for monitoring DC voltage up to 10VDC.
They can be connected directly to sensors and transmitters with such analog
output.
The “Multiplier”, “Offset” and “Dimension” for every analog input gives a
possibility to monitor sensors with analog outputs and see directly the
measured parameter.
It is possible to monitor voltages bigger than 10VDC by adding an external
resistor in series. For every 1 mega-ohm, the voltage will be extended by
5.893V. The external resistor should be with 1% or better accuracy.
To analog inputs 3 and 4 internally can be assigned 410-ohm resistor in
parallel of the input. In this case, the input can accept directly 0-20mA
current loop sensors and transmitters.
The switching of the resistor is done by the user interface.
The following picture illustrates how а 0-10V analog sensor is connected to
the analog input 1 and 0-20mA current loop transmitter is connected to analog
input 3. The analog input 3 is in current mode.
The maximum cable length for an analog input should be up to 30 meters.
5.2.6. Relays connection
The relay contacts are internally connected directly to the terminal
connectors.
Attention! There isn’t any internal overcurrent protection on the relays’
contact lines.
For all relays normally open, normally closed and common contacts are
available. For loads with higher switchable current/voltage than specified, an
external relay should be used.
When mechanical relays switch inductive loads such as motors, transformers,
relays, etc., the current will arc across the relay contacts each time the
contacts open. Over time, this cause wears on the relay contacts which shorten
their life. When switching an inductive load, it is recommended that relay
contact protection devices are used.
LED indicators
LED indicators show the status of the module:
-
REL1 – REL4 (green) – the LED is ON when the corresponding relay is activated (the NO contact is connected to COM);
-
SIG (red) – indicates the status of the device together with STA
-
STA (yellow) – indicates the status of the device together with SIG.
The following states are displayed: -
Module initialization – after power-on SIG and STA turn ON for a second, after this turn OFF for another second.
-
Searching for a network – after initialization, SIG is OFF, STA flashes (flash period of 200ms)
-
Connected to a network – after a successful connection to a mobile network, STA shows the type of connection, while SIG shows the signal strength.
STA flashes ones for 200ms in a period of 2s – there is GSM connection only;STA flashes twice for 200mS in a period of 2s – there are GSM and 4G/3G/2G connections.At the same time SIG has 5 states:
SIG flashes 1 time in a period of 2s – signal strength is between 0 and 20%;
SIG flashes 2 times in a period of 2s – signal strength is between 21 and 40%;
SIG flashes 3 times in a period of 2s – signal strength is between 41 and 60 %;
SIG flashes 4 times in a period of 2s – signal strength is between 61 and 80%;
SIG is solid ON – signal strength is between 81 and 100%; -
Error message – in case of error after initialization, SIG will stay solid OFF, STA will flash showing the type of error.
STA flashes ones for 1s – master phone number is not set;
STA flashes permanently for 1s in a period of 2s – permanent hardware error.
Initial setup via USB
The initial setup of TCG140-4 is done with a computer running Windows 7 or a newer Microsoft Windows operating system. After power-up, the module should be connected to the computer with a USB cable. Once the USB cable is connected, the operating system automatically starts to install the drivers for the communication with the device. The following message appears:
The following drivers will be installed:
– Microchip composite device
– USB serial port driver
If for some reason the USB serial port driver cannot be installed
automatically, it must be installed manually.
The driver can be downloaded from the TCG140-4 product page at
www.teracomsystems.com. After successful
driver installation, the device will be recognized as Mass storage, the
following window appears on the screen:
The only file stored on the mass storage is a tool called “TConfig”. This tool enables communication between the TCG140-4 and PC. After starting the TConfig tool, the following program will appear:
Pressing the “Start” button will start the browser and display the Monitoring
page of your TCG140-4.
7.1. Monitoring page
The monitoring page displays the current inputs/outputs status of TCG140-4.
The page has 5 sections – “1-Wire sensors”, “Modbus sensors”, “Digital
inputs”, “Analog inputs” and “Relays”.
For every parameter (sensor, input, relay) there is a description of up to 15
characters. The descriptions can be changed on the “Setup-Input/Output” page.
7.1.1. Sensors section
There are two sensors sub-sections on the page – оne for 1-Wire sensors and
another one for MODBUS RTU sensors.
TCG140-4 supports up to eight sensors. They can be connected to both
interfaces in a random ratio, settable in section “Sensors ratio setup” on the
Setup->Sensors page. By default, the number of MODBUS RTU sensors is 4.
All detected 1-Wire sensors are shown in the “1-Wire sensors” sub-section. The
sensors should be set up in section “1-Wire sensors setup” on the
Setup->Sensors page.
All MODBUS RTU sensors are shown in the “Modbus sensors” sub-section. The
sensors should be added and set up in section “Modbus RTU sensors” on the
Setup->Sensors page.
For every sensor, there is a description, value, ID, or address information.
The description length is up to 15 characters. The descriptions can be changed
on the Setup->Conditions page.
Dual sensors (humidity-temperature) have two parameters.
7.1.2. Digital inputs section
Digital inputs can be used for monitoring the state of discrete devices –
motion sensor, door contact, relay contact, alarm output, etc.
Digital inputs are sampled every 10ms. The change of input status is
considered valid if the same value is read in 3 consecutive samples (30ms).
The status of every input is shown by text and by color.
The descriptions and status texts can be changed in “Setup-Input/Output”.
7.1.3. Analog inputs section
Analog inputs can be used for monitoring DC voltage sources – analog sensors,
batteries, power supplies, solar panels, etc.
Analog inputs 3 and 4 can be also used for monitoring of 0-20mA current loop
sensors/transmitters. The mode can be changed on the “Setup-> Input/Output”
section.
Analog inputs are sampled faster, but the new actual value is changed in 0.5
seconds. All 250 readings between the value changes are averaged.
For every analog input “Unit”, “Multiplier” and “Offset” can be set in the
“Setup-> Input/Output” section.
7.1.4. Relay section
The section displays the current state of relays. Each relay can be activated
either remotely or locally from the status of a monitored parameter. For
locally activated relays a text describing the controlling parameter is
displayed rather than buttons.
Pulse duration and parameters for local relay activation can be set separately
for each relay in “Setup->Input/Output->Relay outputs”.
7.2. Setup
7.2.1. SMS
SMS alarm recipients can be set in this section.
The “Master” has special rights to change the device settings using SMS
commands. This number always receives SMS alarm messages.
The remaining 4 recipients can receive SMS messages if any of the parameters
are in an alarm state. To receive the SMS messages for every number should be
enabled with the checkbox “Alarm Notification”. These 4 recipients can also
ask by SMS for parameter state/value.
By pressing the “Send test SMS” button all SMS recipients will receive a test
SMS.
All commands, their syntax, and answers are described in “Setup via SMS”.
SMS is not a reliable communication and it is not recommended as a monitoring
technology.
7.2.2. Sensors
7.2.2.1. Sensors ratio setup
The ratio between 1-Wire and MODBUS RTU sensors can be set here. By default, it is 4:4.
7.2.2.2. 1-Wire sensors setup
Detection of connected 1-Wire sensors is made either after power on or by the
button “Scan”.
All found sensors are shown in ascending order refer to their unique ID
number.
It is possible to lock a 1-Wire sensor in a specific position. To do this all
sensors should be added one by one. After every addition, a new scan should be
made and a newly found sensor should be locked in its position. If all sensors
are locked, removing one “in the middle” will not change the positions of
other sensors after reset. This option is very useful when TCG140-4 is used as
a part of а monitoring and control system managed by HTTP API commands.
7.2.2.3. MODBUS RTU communication setup
TCG140-4 supports MODBUS RTU over the RS-485 interface. All sensors connected
to this interface should work with the same communication settings.
By default, TCG140-4 works with the standard for MODBUS RTU settings – 19200,
E, 1.
In the right part of the section, there is a tool for scan the MODBUS RTU
interface. To optimize scan time, the appropriate sensor time-out and address
segment should be set up, after this, the button “Save” on the bottom of the
page should be pressed.
7.2.2.4. MODBUS RTU sensors
TCG140-4 supports Teracom and third-party MODBUS RTU sensors.
For every sensor, the appropriate MODBUS RTU address, register address, data
order, and data type should be set. All changes should be saved. If the
settings are OK in the columns “Raw value” the right data will be shown.
TCG140-4 supports MODBUS RTU sensors with response time-out between 10 and
500ms.
The default response time-out for a new sensor is 100ms. It is recommended to
use the minimum response time guaranteed by the sensor’s manufacturer. The sum
of chosen
response time-out for every sensor forms the maximum response time-out for the
system.
The polling time is the time between two sequential readings of the same
sensor. The chosen polling time determines the system’s time of reaction. By
default, it is 1 second.
Important: The maximum response time-out can’t be lower than the polling
time.
All further processing of the raw data is in the following formats:
-
Float-point for data types float, 16-bit unsigned integer and 16-bit signed integer.
The float-point format is with 24-bit mantissa. -
Float-point or integer for data types 32-bit unsigned integer and 32-bit signed integer.
The float-point format is with 24-bit mantissa.
For the integer format, the calculations with multiplier and offset are
truncated.
7.2.2.5. Sensor setup tool
The link for the tool is available at the bottom of the Modbus RTU sensors
paragraph. It can be used for sensor communication setup changes or just to
read information from a register.
7.2.2.5.1. Communication setup
The section is similar to the general MODBUS RTU communication setup. The only
new field is the sensor address.
The changes of settings in this section are not memorized and don’t change the
general settings of TCG140-4.
7.2.2.5.2. Sensor communication register setup
This part of the tool is used to check and change the status of the
communication registers of the sensor.
7.2.2.5.3. Sensor register check
This part of the tool is used for general sensor register check.
7.2.3. Input/Output
7.2.3.1. Sensors
For every sensor, a description, up to 15 symbols can be set. These
descriptions will appear in the monitoring page, conditions page, XML/JSON
data, SMS, and e-mail alerts.
For some sensors, fields “Unit”, “Multiplier” and “Offset” are available to
convert the raw values into meaningful units. The scaled value is calculated
by:
SV[Un] = RV * MU + OF
Where:
SV – scaled (displayed) value;
Un – unit;
RV – raw value from the sensor;
MU – multiplier;
OF – offset.
7.2.3.2. Digital inputs
For every digital input, a description, up to 15 symbols and states up to 15
symbols can be set.
These descriptions will appear in the monitoring page, conditions page,
XML/JSON data, SMS, and e-mail alerts.
7.2.3.3. Analog inputs
For every analog input, a description, up to 15 symbols can be set. These
descriptions will appear in the monitoring page, conditions page, XML/JSON
data, SMS, and e-mail alerts.
For every analog input, fields “Unit”, “Multiplier” and “Offset” are available
to convert the raw voltage/current into meaningful engineering units. The
scaled value is calculated by:
SV[Un] = RV * MU + OF
Where:
SV – scaled (displayed) value;
Un – unit;
RV – raw voltage from the source;
MU – multiplier;
OF – offset.
Example:
For humidity sensor HIH-4000-003 following data (from the datasheet) is
available:
VOUT = 0.826 at 0% RH
VOUT = 3.198 at 75.3% RH
The raw values are voltages on the sensor’s output. Actually, we need to know
relative humidity (scaled value) not voltages. The two relations are enough to
calculate multiplier and offset. When we know them, we can calculate what
relative humidity corresponds to every voltage in the working range.
The multiplier (MU) is calculated as ΔY/ΔX, for this sensor ΔRH%/ΔV:
MU = (75.3 – 0)/(3.198-0.826) = 75.3/2.372 = 31.745 %RH/V
The offset is calculated from the already known multiplier and relation for
one of the points: OF = MU (0 – VOUT1) + RH1 = 31.745(0-0.826) + 0 =
31.745(-0.826) = -26.22
The same result can be calculated for the second point: OF = MU (0 – VOUT2)
- RH2 = 31.745(0-3.198) + 75.3 = -101.52 + 75.3 = -26.22
For this sensor, the formula will look like this: SV = RV 31.745 – 26.22
Check for VOUT = 0.826 V (0%RH): SV = 0.826 * 31.745 – 26.22 = 26.22 – 26.22 = 0 %RH
The same value is written in the datasheet.
7.2.3.4. Relay outputs
For every relay, a description, up to 15 characters can be set. These
descriptions will appear in the monitoring page, XML/JSON data, SMS and e-mail
alerts.
The pulse duration can be different for every relay. The resolution is 0.1
second, the maximum pulse value is 3600 seconds.
All relays can be activated either remotely by SMS/HTTP API or locally from
the status of a monitored parameter. This setting is made from the “Activated
from” drop-down menu, the possible options are:
-
SMS/HTTP – by selecting this option the relay outputs can be activated by SMS from an authorized number or by sending HTTP API commands;
-
Local activation.
For local activation, alarm conditions for different sources are used. They are set up in section “Setup->Conditions”. To assign a parameter to the relay, the following choices are possible: -
S? – “S” stands for “Sensor 1-Wire”. The relay is activated from the value measured from the specified 1-Wire sensor and rules for ranges specified in “Setup>Conditions”.
Question mark masks a number from 1 to 8; -
Analog input?. The relay is activated from the value measured by specified analog input and rules for ranges specified in “Setup->Conditions”. Question mark masks a number from 1 to 4;
-
Digital input?. The relay follows the state of the specified digital input. Question mark masks a number from 1 to 2;
-
Any alarm. The relay is activated on any alarm condition.
All changes in the above sections are saved by pressing the “Save” button.
7.2.4. Conditions
This section is used for parameterization of trigger and alert conditions for
sensors, analog, and digital inputs.
7.2.4.1. Sensors and analog inputs
For every sensor two types of fields are presented – one for the trigger
conditions (“Min”, “Max”, and “Hys.”) and another one for the wanted action.
“Min” and “Max” indicate the border of the working range for the monitored
parameter. The “Max” trigger condition occurs when the value exceeds the
trigger set point. The “Min” trigger condition occurs when the value is lower
than the trigger set point. In both cases, the monitored parameter goes out of
range.
Coming back in range for the observed parameter is considered when the value
goes higher than (Min + Hys) or lower than (Max – Hys). Hysteresis (“Hys”) is
used to prevent excessively triggering when the value fluctuates around the
trigger point.
Example:
TCG140-4, TST100, and an appropriate heater are used to control the room
temperature. The wanted minimum temperature is 19°C. The initial temperature
is 17°C.
TST100 is assigned on the first position for 1-Wire sensors.
For Relay1 local activation from Sensor1 is set.
Following parameters are set for Sensor1: Min=19, Max=100 and Hys=0.5.
When the module is switched on, Relay1 is immediately activated because the
monitored temperature is out of range. This switches the heater on. The
temperature is going higher.
When temperature reaches 19.5°C (19.0 + 0.5) it goes in range (trigger
condition) and Relay1 is deactivated. The heater is switched off.
The temperature falls and when it reached 19°C it goes out of range (trigger
and alert conditions). The relay is activated (heater is switched on) and
e-mail is sent.
The “Max” value is set far enough from the wanted temperature to avoid
trigger/alert conditions around it.
For every sensor or analog input, there are 3 independent ways of alert when
there is an alarm condition – email, SMS, and post (HTTP Post with XML/JSON
file). Each alarm notification method is activated by a checkbox.
Globally for all sensors and for all analog inputs, there is a checkbox
“Return notification”. If this option is chosen there will be a notification
also when the parameter returns in range.
Globally for all sensors and for all analog inputs, there is a “Notification
delay” parameter. It is very useful as a filter for short alarm conditions.
7.2.4.2. Digital inputs
For every digital input, the alarm state should be chosen. The texts are
already set on the “Input/output” page.
When the input goes in alarm state 4 independent way of the alert are possible
– email, SMS, post (HTTP Post with XML/JSON file) and MQTT publish. Each alarm
notification method is activated by a checkbox.
Globally for all digital inputs, there is a checkbox “Return notification”. If
this option is chosen there will be a notification also when the parameter
returns in range.
Globally for all digital inputs, there is a “Notification delay” parameter. It
is useful as a filter for short alarm conditions.
In the time when the input is in an alarm state, on the „Monitoring page“, the
appropriate input will be colored in red.
There are two delays – low-to-high and high-to-low for digital input change.
These delays are added to the standard delay of 30ms. They have 0.1-second
resolution and by default are zero.
These options can be used for additional filtering.
On the picture above low-to-high and high-to-low delays are set to 0.1 seconds.
7.2.5. System
The page for some general settings.
7.2.5.1. System status
There is information about the general status of the module here.
The only possible setting here is the “Data in roaming” checkbox. By default,
it is disabled to avoid extra charges for data transfer in roaming.
If you are using another operator’s card, you must activate “Data in roaming”.
Otherwise, you will not be able to use all data services – emails, HTTP Post,
NTP, etc.
7.2.5.2. Data connection setup
This setting can be different for each mobile operator. By default, APN
(Access Point Name) is “internet”. Some mobile operators may require also a
username and password.
The network determines the mobile service type – 2G, 3G, or 4G LTE. By
default, it is AUTO – the highest possible generation service will be used in
the current position.
7.2.5.3. Mobile network connection reset
For areas with low signal strength or where the mobile network frequently
drops/blocks, automatic restarting of the network connection can be used. This
could prevent permanently losing the connection with the device.
The automatic restart will be done once per day.
By default, the automatic restart is disabled.
7.2.5.4. General setup
The section is for some general settings.
The temperature and pressure units can be changed with preferable ones.
Writing mode change the alignment in the WEB interface and SMS.
Hostname, System name, System location and System contact are sent in XML/JSON
files and can be used for flexible identification of the device. These
parameters can be also included in the body of the e-mails.
The checkboxes on the right define what to see on the “Monitoring page”. By
default, they all are enabled.
7.2.5.5. Device restart
In this section, there are buttons for device restart and reset to factory
default settings.
7.2.6. NTP
Internal RTC (real-time clock) of the module can be set either manually or
automatically.
For automatic clock synchronization, the module supports NTP (Network Time
Protocol) and all necessary parameters for automatic synchronization are
available in this section.
The clock synchronization is made on the set “Period”. If the attempt was not
successful, the next synchronization will be on “If not found” time.
Pressing the “Save and synchronize” button initiates time synchronization. The
information for “Status” in the blue box is very useful for the availability
of the time server and the Internet at all.
The current system time is sent in an XML/JSON file when HTTP Post is enabled.
By default, NTP synchronization is enabled, server – time.google.com:123, Time
zone 00.00 and period of 12 hours.
The settings and service at all can be checked with the available tools in the
NTP Test section.
7.3. Services
7.3.1. SMTP
This page is used to enter valid SMTP settings for email alerts and
recipients’ addresses.
7.3.1.1. SMTP setup
The mail server address can be set either by hostname (smtp.gmail.com) or by
IP address.
The e-mails can be sent with or without an encrypted connection.
The default SMTP port without encryption is 25. Almost all ISP’s block this
port to avoidhacker attacks. Ask your ISP for details.
The only supported method for encrypted connection from most of the public
email servers isTLS. TCG140-4 supports TLS 1.0, TLS 1.1, and TLS 1.2 with a
lot of cipher suites. This ensuressuccessful operation with almost all public
servers.
Be careful with the terms SSL, TLS, and STARTTLS used in email server
settings, supplied by theprovider. Some providers as Gmail uses SSL instead of
TLS and TLS instead of STARTTLS. Thiscan provoke mismatches with the port
number. For example, the right settings for Gmail are:
- TLS on port 465 or
- STARTTLS on port 587.
Sender e-mail, username, and password are standard authentication details. For
most SMTPservers, the sender’s e-mail and username are the same.
There is a button for server settings test with feedback. In this test sender
and recipient of thee-mail is the same.
7.3.1.2. Alarm destination
Up to 5 email recipients can be set. Every recipient can be activated independently by a checkbox.
7.3.1.3. E-mail details
The subject, body header, body, and body footer can be customized. For this customization, a set of keys is used. All they are described on the page.
7.3.2. Logger
The logger works in three modes – Time, Alarm, and Time&Alarm. The mode
specifies what initiates a record in the logger’s memory.
In Time mode, records are made periodically on the “Logging period”. In Alarm
mode, records are made on any alarm condition. In Time&Alarm mode, a mix of
both conditions for records is used.
The logging period determines the time between two records. It is good to
remember that by reducing the logging period, we increase the resolution, but
we also reduce the past period for which we have records.
The logger records can be synchronized with a specific minute in an hour.
Synchronization is very useful when monitoring electricity, water, gas meters,
etc. The logging period can be chosen from a drop-down menu between 1 and 60
minutes. The field „Sync to the minute“ determines which minute of every hour
is used for synchronization. Although any minute can be selected, it is better
to use the default value – 00.
Example:
The current settings are:
- Current time = 09:12
- Logger record sync = Enable;
- Sync to the minute = 00;
- Logging period = 15 minutes.
The settings determine 4 records per hour in HH:00, HH:15, HH:30, and HH:45.
The device is powered up.
The first record will be immediately after power-up – 09:12. The next records
will be in 09:15,09:30, 09:45, 10:00, 10:15, etc.
There are two ways to reach the logger records:
- download of the full log file, using “Download full log” in the WEB interface;
- periodical upload the last unsent records to the dedicated HTTP server.
The records can be uploaded in CSV file format with HTTP/HTTPS Post.
The period of the CSV Post can be chosen from the menu between 1 and 24 hours.
If you enable this service, take care of the real-time clock (NTP service).
The “Server” for CSV Post can be domain or IP address but take care of DNS
settings.
“Sync time” is a moment in the day when a period of CSV Post is synchronized.
Example:
The current time is 19:31, the CSV Post period is 3 hours and the Sync time is
9:00.
To synchronize the logger to 9:00 it means that time for uploads will be:
09:00, 12:00, 15:00, 18:00, 21:00, 24:00, 03:00 and 06:00. The first upload,
after enabling the logger in 19:31, will be at 21:00.
The button “Force CSV Post” initiates the upload of recorded information from
the previous periodical upload up to now.
Identification header adds Hostname, System name, System location, and System
contact at the
beginning of every CSV file. This option helps to identify reports in systems
that use CSV files only.
By default, the logger is disabled.
More about the logger can be found in the Data logger section.
7.3.3. XML/JSON file HTTP Post
HTTP Post is used for periodically upload of an XML/JSON file to a server by
HTTP/HTTPS requests (Post method). The file contains the current status of all
monitored parameters and extra system information. The file format is chosen
from the drop-down menu.
The HTTP servers can be addressed either by domain name or IP address.
The “Period” can be set between 1 min and 48 hours. This parameter can be
changed remotely by a command. The “Period” determines at what time the
control software receives up-to-date information from TCG140-4 and can,
therefore, make changes to some of the parameters. The shorter is “Period”,
the closer to the real-time operation is the system. On the other hand, as
shorter is the “Period” as higher is the data traffic through the mobile
network.
If the checkbox “Connect on any alarm” is selected, HTTP Post will be sent on
any alarm.
The “Key” field is user-defined. Its value is available in XML/JSON file and
can be used for device identification.
If “Process Answer” is enabled, TCG140-4 will execute the commands, sent by
the remote server as an answer of HTTP/HTTPS Post.
More about HTTP/HTTPS Post can be read in the HTTP API section.
7.4. MQTT
Device supports MQTT 3.1.1. This page is for the MQTT settings.
7.4.1. MQTT General setup
7.4.2. MQTT Sensors topic
7.4.3. MQTT Analog inputs topic
7.4.4. MQTT Digital inputs topic
7.5. GSM geolocation
GSM geolocation is a way to determine the position without the use of GPS.
Only information from the mobile network is used. The information is sent to a
third-party operator that returns the coordinates of the device with some
accuracy.
The positioning is more inaccurate compared to GPS, but it also works indoors.
It is especially suitable for tracking parcels, refrigerated display cases,
refrigerators, machines and equipment operating where there is no GPS signal.
TCG120-4 supports the following operators – Google, Quectel, and Unwired Labs.
The service needs registration with the operator.
7.6. Administration
7.6.1. Backup/Restore
TCG140-4 supports backup and restore of all user settings. All settings are
saved in an XML backup file.
This file can be used after this to restore the same settings on many devices.
This is very useful for multiplying similar settings to a batch of modules.
7.6.2. FW update
TCG140-4 supports firmware update over the WEB interface.
Download the latest firmware from
www.teracomsystems.com, choose the file, and
press the “upload” button.
Attention! Don’t turn off the power supply during the update. Turning off the
power supply will damage the device.
Setup via SMS
TCG140-4 supports SMS commands for parameter change, status reports, and
firmware update over the air. The commands will be executed only if they come
from the phone numbers available in the section “SMS setup”. The commands need
different rights (master/user).
Below is a list of the supported SMS commands. Note that the underscore
character “˽” must be replaced by one space character.
-
Set new master number
Rights: Master
Syntax:
set˽master˽
Whereis a mobile number in the international format **Example** Command: set master +359885885885 Answer: You are the new master! -
Set SMS users numbers – this message is used to add/delete SMS users
Rights: Master
Syntax:
set˽sms˽user˽:
Whereis a mobile number in the international format can be u1, u2, u3 or u4 **Example** Command: set sms user u1:+359885887766 Answer: u1:+359885887766,u2,u3,u4 Command: set sms user u2:+359885999888 Answer: u1:+359885887766, u2:+359885999888,u3,u4 Command: set sms user u1: Answer: u1, u2:+359885999888,u3,u4 -
Display SMS users numbers
Rights: Master, Users
Syntax:
display˽sms˽users
Example
Command: display sms users
Answer: m:+359885885885,u1:+359885887766,u2:+359885999888,u3,u4 -
Set email users – this message is used to add/delete email users
Rights: Master
Syntax: set˽email˽user˽:
Where– a valid email address can be e1, e2, e3, e4 or e5 **Example** Command: set email user e1: [mail1@teracomsystems.com](mailto:mail1@teracomsystems.com) Answer: e1: [mail@teracomsystems.com](mailto:mail@teracomsystems.com) Command: set email user e2: [mail2@teracomsystems.com](mailto:mail2@teracomsystems.com) Answer: e2: [mail2@teracomsystems.com](mailto:mail2@teracomsystems.com) Command: set email user e2: Answer: e2: -
Display email users – this message is used to request the email of a user
Rights: Master, Users
Syntax: display˽email˽
Wherecan be one of: e1, e2, e3, e4 or e5
Example
Command: display email e1
Answer: e1: mail1@teracomsystems.com
Command: display email e2
Answer: e2: mail2@teracomsystems.com -
Status of system – requests main parameters of the device
Rights: Master, Users
Syntax:
status˽system
Example
Command: status system
Answer: 06.01.2021,16:09:06,4G=y,ss=80%,fw=1.00 -
Status of parameter – requests status of digital input (di), analog input (ai), relay (r)
is one of: di1, di2, ai1, ai2, ai3, ai4, r1, r2, r3, r4, s11, s12, s21, s22, s31, s32, s41, s42, s51, s52, s61, s62, s71, s72, s81, s82 **Example** Command: status di1 Answer: di1(Garage_door)=CLOSED Command: status s22 Answer: s22(Office)=34.5%RH
and sensor(s)
Rights: Master, Users
Syntax:
status˽
Where -
Set a relay – this message is used to switch on/off the selected relay output
Rights: Master, Users
Syntax: set˽= ˽[option] Where is r1, r2, r3 or r4 is on, off [option] -w **Example** Command: set r1=on Answer: r1=on,r2=off,r3=off,r4=off Command: set r1=off Answer: r1=off,r2=off,r3=off,r4=off Command: set r1=off,r2=on,r3=on,r4=on Answer: r1=off,r2=on,r3=on,r4=on Command: set r1=on -w Answer: no answer Command: set r2=off,r4=off -w Answer: no answer -
Set pulse a relay – this message is used to pulse the selected relay output
< pulse relay > is pl1, pl2, pl3 or pl4
Rights: Master, Users
Syntax: set˽= ˽[option] Where is on [option] –w **Example** Command: set pl1=on Answer: r1=on,r2=off,r3=off,r4=on Command: set pl1=on,pl2=on,pl3=on,pl4=on Answer: r1=on,r2=on,r3=on,r4=on Command: set pl1=on -w Answer: no answer Command: set pl1=on,pl4=on -w Answer: no answer -
Post URL – sets URL for XML/JSON HTTP Post
is the address of remote server (domain or IP) Example Command: set purl=[www.teracomsystems.com:8801/posttest.php](http://www.teracomsystems.com:8801/posttest.php) Answer: purl=[www.teracomsystems.com:8801/posttest.php](http://www.teracomsystems.com:8801/posttest.php),post=on, period=00:01:00 Command: set purl2=[www.teracomsystems.com:8802/posttest.php](http://www.teracomsystems.com:8802/posttest.php) Answer: purl2=[www.teracomsystems.com:8802/posttest.php](http://www.teracomsystems.com:8802/posttest.php),post=on, period=00:01:00
Rights: Master
Syntax: set˽purl= or set˽purl2=
Where -
Status URL – status URL’s for XML/JSON HTTP Post
Rights: Master, User
Syntax: status˽purl or status˽purl2
Example
Command: status purl
Answer: purl=www.teracomsystems.com:8801/posttest.php, post=on,period=00:01:00
Command: status purl2
Answer: purl2=www.teracomsystems.com:8802/posttest.php, post=on,period=00:01:00 -
Post period in seconds – sets XML/JSON HTTP Post period in seconds
Rights: Master
Syntax: set˽pper=
Whereis a number between 60 and 172800 (seconds) **Example** Command: set pper=120 Answer: post=off,period=00:02:00 -
Post period in hh:mm:ss – sets XML/JSON HTTP Post period in hh:mm:ss
Rights: Master
Syntax: set˽pperh=
Whereis a number between 00:01:00 and 48:00:00 Example Command: set pper=00:05:00 Answer: post=off,period=00:05:00 -
Post on – sets XML/JSON HTTP Post on
Rights: Master
Syntax: set˽post=on
Example
Command: set post=on
Answer: post=on,period=00:02:00 -
Post off – sets XML/JSON HTTP Post off
Rights: Master
Syntax: set post=off
Example
Command: set post=off
Answer: post=off,period=00:02:00 -
MQTT on – sets MQTT on
Rights: Master
Syntax: set˽mqtt=on
Example
Command: set mqtt=on
Answer: mqtt=on,mdata=json,period=00:05:00 -
MQTT off – sets MQTT off
Rights: Master
Syntax: set˽mqtt=off
Example
Command: set mqtt=off
Answer: mqtt=off,mdata=json,period=00:05:00 -
MQTT period – sets MQTT publish period
Rights: Master
Syntax: set˽mper= -
MQTT data – sets MQTT data format
Rights: Master
Syntax: set˽mdata=
Whereis “json” or “plain” Example **Command:** set mdata=plain **Answer:** mqtt=on,mdata=plain,period=00:05:00 -
MQTT server – sets MQTT server
is the address of remote server (domain or IP) Example Command: set murl= [www.teracomsystems.com](http://www.teracomsystems.com) Answer: mqtt=on,murl= [www.teracomsystems.com](http://www.teracomsystems.com),port=1883
Rights: Master
Syntax: set˽murl=
Where -
MQTT port – sets MQTT port
Rights: Master
Syntax: set˽mport=
Whereis a MQTT port Example Command: set mport= 8883 Answer: mqtt=on,murl= [www.teracomsystems.com](http://www.teracomsystems.com),port=8883 -
Set a time zone
Rights: Master
Syntax: set˽tz=±hh:mm
Example
Command: set tz=+03:00
Answer: ts=time.google.com:123,tz=+03:00 -
Restart – restarts the device
Rights: Master
Syntax: restart
Example
Command: restart
Answer: Device is restarting! -
Send test email – a message for sending a test email to the email users
Rights: Master
Syntax: test˽email
Example
Command: test email
Answer: Emails are sending! -
Send test SMS – a message for sending a test SMS to the authorized users
Rights: Master
Syntax: test˽sms
Example
Command: test sms
Answer: This is a test SMS! -
Update – a message for update the device over the air (needs LTE/WCDMA/GPRS)
Rights: Master
Syntax: update˽
Whereis a valid URL to public server, pointing update (.cod) file Example Command: update [www.teracomsystems.com/docs/TCG140-4-v1.000-P-S.cod](http://www.teracomsystems.com/docs/TCG140-4-v1.000-P-S.cod) Answer 1: Downloading firmware… Answer 2: Firmware file downloaded. Updating… Following answers are also possible in different situations: Answer: File corrupt or wrong version! Answer: Can’t connect to server! Answer: Download time out! Answer: 4G/3G/2G is not connected! Answer: Connection lost! Answer: Response timeout! Answer: Socket error! -
Set Mobile network connection reset
Rights: Master
Syntax: set mncr=,hh:mm:ss
Where– “on” or “off” Example: enable mobile network connection reset and set time Command: set mncr=on,10:00:00 Answer: mncr=on,10:00:00 Example: disable mobile network connection reset Command: set mncr=off Answer: mncr=off,10:00:00 -
Set a sensor notification delay
Rights: Master
Syntax: set delsen=xxxx
where
xxxx – notification delay in seconds (0-3600)
Example: Command: set delsen=5
Answer: delsen=5 -
Set a sensor limits
Rights: Master
Syntax:
set lspt=naaaa,xbbbb,ycccc
where
p sensor number; valid values 1,2,3 or 4;
t parameter of the sensor; valid values 1 or 2;
n stands for “Min”
aaaa value for limit “Min”;
x stands for “Max”
bbbb value for limit “Max”
y stands for “Hys”
cccc value for “Hys”.
Example:
set of sensor 1 parameter 1 (temperature):
Command: set ls11=n25.0,x35.0,y1.0
Answer:
ls11=n25.0,x35.0,y1.0
Command: set ls11=n31.0
Answer:
ls11=n31.0,x35.0,y1.0
Example: set of sensor 1 parameter 2 (humidity):
Command: set ls12=n45.0,x60.0,y1.0
Answer: ls12=n45.0,x60.0,y1.0
Protocols and API
9.1. HTTP API
HTTP is a very popular protocol for the implementation of remote monitoring
and control SCADA systems. These systems are built on client-server
technology.
TCG140-4 supports client mode – HTTP/HTTPS Post. This makes the device
compatible with all SCADA software running HTTP protocol.
9.2. XML/JSON file HTTP Post
When this service is active, the module periodically sends the HTTP Post to a
server. The Post contains an XML or JSON file with the current status of
monitored parameters.
HTTP and HTTPS protocols are supported.
The Post can be sent also on an alarm condition – as an analogy of the SNMP
trap.
On every HTTP Post, the server returns a response in accordance with the HTTP
protocol. Only if “Process Answer” is enabled, TCG140-4 will execute the
commands, contained in the answer.
Otherwise, the device will terminate the connection immediately after the
response.
A very important parameter in this communication is the HTTP Post period. With
a shorter time period the device generates more data traffic, but this keeps
the information and possibility to control the device closer to “real-time”.
The HTTP Post period can be changed by the server with the appropriate HTTP
command. This makes communication very flexible.
9.2.1. Commands
The commands for TCG140-4 are sent in the answer’s body of HTTP Post request.
The structure of command is:
set yyy=xxx
Where: yyy is the command;
xxx is the parameter.
Example:
set r1=on – will turn on the relay 1.
set FIN – will terminate the session.
The full list of the commands is available on 9.4.
9.2.2. Typical communication session
Below is a typical communication session between TCG140-4 and a remote server,
with “Process Answer” enabled:
- The device sends HTTP Post request (1) with XML/JSON data to the remote server either on Post period or on alarm condition;
- The server returns HTTP response (2), which contains “set r1=on” command as a brief text in the message body;
- The device sends a new HTTP Post request (3) with updated XML/JSON data, which confirms the execution of “set r1=on” command;
- The server returns a new HTTP response (4), which includes “set FIN” in the message body. This indicates that there are no pending commands and the session can be closed;
- On next HTTP Post period, TCG140-4 sends a new HTTP Post request (5) to the server;
- The server answers with “set FIN” (6) – there are no pending commands and the session can be closed.
A typical monitoring application is shown below:
XML/JASON HTTP Post service can be tested following the steps below:
-
Save following code like post.php:
<?php
define(“FILENAME”, ‘status.xml’);
define(“FOLDER”, ”);
define(“SEPARATOR”, ”);
define(“STR_SUCCESS”, ‘set FIN’);
define(“STR_ERROR”, ‘error’);
if($_SERVER[‘REQUESTMETHOD’] == ‘POST’){
$datePrefix = date(‘YmdHis’, strtotime(‘now’));
$pathname = FOLDER.SEPARATOR.$datePrefix.’’.FILENAME;
$postdata = file_get_contents(“php://input”);
$handle = fopen($pathname, ‘w+’);
$content = var_export($postdata, true);
fwrite($handle, substr($content, 1, strlen($content)-2));
fclose($handle);
echo (($handle === false) ? STR_ERROR : STR_SUCCESS).”\r\n”;
}
else {
echo “The PHP script is working!”;
}
?> -
Copy the post.php file on a WEB server with PHP support. The server should have visibility from the Internet. The UniServer and XAMP are the most popular WEB servers for Windows.
-
To verify that the script is working properly, type the URL (for example www.yourserverURL.com/post.php) in the WEB browser. If all is OK, a WEB page with “The
PHP script is working!” will be shown. -
Activate XML/JSON HTTP Post service to www.yourserverURL.com/post.php.
-
Click on the “Test HTTP Post” button.
-
If the HTTP Post is received and processed, “OK” will be shown close to the button. Along with this, an XML/JSON file will be created in the same directory, where post.php is located. The file name will contain time information. For example – 20210601103318_status.xml.
9.3. List of HTTP API commands
TCG140-4 supports following HTTP commands (case sensitive):
Command | Description |
---|---|
rn=xxx | Turn relay n ON (xxx=on) or OFF (xxx=off) |
(n is 1,2,3 or 4 for the respective relay)
r2=on — will turn relay 2 ON
r4=off — will turn relay 4 OFF r1=on&r2=on&r3=on&r4=on — will turn all relays
ON rl=off&r2=off&r3=off&r4=off — will turn all relays OFF
rn=tg| Toggle relay n (n is 1,2,3 or 4 for the respective relay) r2= tg— will
toggle relay 2 r1=tg&r4=tg— will toggle relay 1 and 4
rn= pl| Pulse relay n (n is 1,2,3 or 4 for the respective relay) r3=pl — will
pulse relay 3 rl=pl&r2=pl&r3=pl&r4=p1
vnf=10.0| Set Min of analog input to 10.0 (f is 1,2,3 or 4 for the respective
input) vn1=10.0 will set Min for analog input 1
vxf=20.0| Set Max of analog input to 20.0 (f is 1,2,3 or 4 for the respective
input) vx2=20.0 will set Max for analog input 2
vyf=1.0| Set Hys of analog input to 1.0 (f is 1,2,3 or 4 for the respective
input) vy4=1.0 will set Hys for analog input 4
snpt=30.0| Set Min of sensor to 30.0 (p is 1,2,3,4,5,6,7 or 8 for the
respective sensor t is 1 or 2 for the respective parameter of sensor)
snl2=30.0 will set Min for sensor 1, parameter 2
sxpt=40.0| Set Max of sensor to 40.0 (p is 1,2,3,4,5,6,7 or 8 for the
respective sensor t is 1 or 2 for the respective parameter of sensor)
sx42=40.0 will set Min for sensor 4, parameter 2
sypt=2.0| Set Hys of sensor to 2.0 (p is 1,2,3,4,5,6,7 or 8 for the respective
sensor t is 1 or 2 for the respective parameter of sensor) sy81=2.0 will set
Hys for sensor 8, parameter 1
delse n=xxxx| Notification delay for sensors (xxxx is between 0 and 3600)
delanl=xxxx| Notification delay for analog inputs (xxxx is between 0 and 3600)
deldig=xxxx| Notification delay for digital inputs (xxxx is between 0 and
3600)
ddal=xxxx| Low to high delay for digital input 1 (xxxx is between 0 and 3600)
dddl=xxxx| High to low delay for digital input 1 (xxxx is between 0 and 3600)
dda2=xxxx| Low to high delay for digital input 2 (xxxx is between 0 and 3600)
ddd2=xxxx| High to low delay for digital input 2 (xxxx is between 0 and 3600)
dataf=x| Data format XML/JSON for HHTP Post — 0 XML, 1 JSON
purl=yyy| URL for XML/JSON HTTP Post to Server 1, where m is a full path to
php file
pur1=212.25.45.120:30181/xampp/test/pushtest.php
purl2=yyy| URL for XML/JSON HTTP Post to Server 2, where m is a full path to
php file
pur1=212.25.45.120:30181/xampp/test/pushtest.php
pper=x| XML/JSON HTTP Post period in seconds (x is between 60 and 172800)
pper=600 — will set Post period to 600 seconds
dk=xxx| XML/JSON HTTP Post key — xxx is up to 17 characters
mdata=x| Data format JSON/Plain text for MOTT Publish — 0 JSON, 1 Plain text
mmode=x| Publish protocol, where x is 0 for unsecure and 1 for TLS/SSL
muser=xx>c<| Username authentication for MATT, where xxxx is a username
mpass=xxxx| Password authentication for MQTT, where xxxx is a password
murl=yyy| URL for MATT publish, where yyy is a path mur1=212.25.45.120
mport=yyyy| Port for MATT publish, where yyyy is a port mport=1883
mper=x| MATT publish period in seconds (x is between 60 and 172800) mper=600 —
will set MATT publish period to 600 seconds
save| Save all previous changes (except relays’ one) in the FLASH memory.
As every save reflects the FLASH cycles (endurance), this command should be
used very carefully. pper=120&save — willset Post period to 120 seconds and
save it
FIN| Terminate the session
Multiply commands are sent concatenated with “&”.
The commands are sent in the answer on XML/JSON or CSV HTTP Posts. They are
executed if “Process Answer” is enabled.
9.4. File structures
For XML file structure please see Appendix A.
For JSON file structure please see Appendix B.
9.5. MODBUS RTU
9.5.1. Communication parameters
For MODBUS RTU, TCG140-4 supports the following communication parameters:
- Baud rate – 2400, 4800, 9600, 19200, 38400, or 57600;
- Data bits – 8;
- Stop bits – 1 or 2;
- Parity – Odd or Even;
As factory default communication parameters, the device uses standard ones for MODBUS RTU:
- Baud rate – 19200;
- Data bits – 8;
- Stop bits – 1;
- Parity – Even;
9.5.2. Teracom sensors update tool
TCG140-4 supports sensor FW update tool.
The tool is available at http://device.ip.address/teracom485.htm.
Attention! To make any changes to the MODBUS RTU sensor it should be alone on
the RS-485 bus.
9.5.2.1 Sensor settings
The tool works with the current MODBUS RTU communication parameters.
To avoid collisions the good practice is to set TCG140-4 and the sensor with
the factory default MODBUS RTU communication parameters. This will ensure a
smooth operation.
The default MODBUS RTU communication parameters for TCG140-4 are described in
8.5.1. Communication parameters.
Before making any changes, it is strongly recommended to scan for sensor
settings. This will inform about the current FW version of the sensor but also
will check if the sensor is alone on the bus.
9.5.2.2 Sensor FW update
To arrange the FW update, the appropriate file should be uploaded to the sensor first and after this, the button “Update” should be pressed.
9.6. MQTT
MQTT is a Client-Server publish/subscribe messaging transport protocol. It is
lightweight, open, simple, and designed so as to be easy to implement. MQTT is
used in a wide variety of industries, such as automotive, manufacturing,
telecommunications, oil, gas and etc.
More about MQTT can be read at www.mqtt.org.
Data Logger
The logger utilizes a circular buffer in FLASH memory. When the logger makes a
full scroll of the circular buffer, the new data overwrites the oldest one. In
this manner FLASH memory stores the full log all the time. A copy of the full
log is available for download.
The number of records depends on the length of descriptions and what kind of
characters are used.
In the worst case (15 bytes description with characters from the highest part
of UTF-8) the number of records is about 37000. This number is enough for 25
days with records on every 1 minute.
In most cases, the data logger can keep 53000 records, which is enough for 36
days with records on every 1 minute.
The new records can be periodically uploaded as SCV file to a dedicated HTTP
server in – 1, 2, 3, 4, 6, 8, 12, or 24 hours. A semicolon is used as a
delimiter.
The first row of the log file is always the header. All rows, including the
header, start with a record ID and time stamp.
The structure of one row (a record) of the log is as follows:
ID | Time | Type of record | Inputs value | Relays | Alarm conditions |
---|---|---|---|---|---|
ID | 32-bit unique number for every row (record). | ||||
--- | --- | ||||
Time | a time stamp of record, in format yyyy.mm.dd, hh:mm:ss. | ||||
Type of record | following types of records are available: |
“Time” for periodical record;
“Event” for record initiated by alarm condition;
“Type” for header record;
“Start” after power-up condition;
“Restart” after reset condition;
“Power Down” after power-down condition;
“Bad” for a problematic record.
Inputs value| in orders – sensors, analog inputs and digital inputs.
Relays| the relays conditions.
Alarm conditions| show conditions for every input, “1” means an active alarm.
An example of the log file:
1131901;06.01.2021,01:02:23;Type;S11/°C;S12;S21/°C;S22;S31/°C;S32;S41/°C;S42;S51/°C;S52;S61/°C;S62;S71/°C;S72;S81/°C;S82;A1/V;A2/V;D1;D2;R1;R2;S1
1/°C;S12;S21/°C;S22;S31/°C;S32;S41/°C;S42;S51/°C;S52;S61/°C;S62;S71/°C;S72;S81/°C;S82;A1/V;A2/V;D1;D2;
1131902;
06.01.2021,01:02:23;Time;18.250;;18.375;;18.125;;18.500;;18.188;;18.125;;18.375;;18.375;;11.352;0.065;1;0;1;0;1;;1;;1;;1;;1;;1;;1;;1;;1;0;1;0;
1131903;
06.01.2021,01:02:23;Event;18.250;;18.438;;18.125;;18.500;;18.188;;18.125;;18.313;;18.375;;11.352;0.066;0;1;0;1;1;;1;;1;;1;;1;;1;;1;;1;;1;0;0;1;
1131904;
06.01.2021,01:02:24;Time;18.250;;18.438;;18.125;;18.500;;18.188;;18.125;;18.313;;18.375;;11.352;0.066;0;1;0;1;1;;1;;1;;1;;1;;1;;1;;1;;1;0;0;1;
1131905;
06.01.2021,01:02:25;Time;18.250;;18.375;;18.125;;18.500;;18.188;;18.125;;18.313;;18.375;;11.352;0.066;0;1;0;1;1;;1;;1;;1;;1;;1;;1;;1;;1;0;0;1;
1131906;
06.01.2021,01:02:26;Time;18.250;;18.375;;18.125;;18.500;;18.188;;18.125;;18.313;;18.313;;11.352;0.066;0;1;0;1;1;;1;;1;;1;;1;;1;;1;;1;;1;0;0;1;
1131907;
06.01.2021,01:02:27;Time;18.250;;18.375;;18.125;;18.438;;18.188;;18.125;;18.313;;18.313;;11.352;0.066;0;1;0;1;1;;1;;1;;1;;1;;1;;1;;1;;1;0;0;1;
1131908;
06.01.2021,01:02:27;Event;18.250;;18.375;;18.125;;18.438;;18.188;;18.125;;18.313;;18.313;;2.198;9.092;0;1;0;1;1;;1;;1;;1;;1;;1;;1;;1;;0;0;0;1;
Firmware update
TCG140-4 supports firmware update over the WEB interface and over the air.
For firmware update over the WEB interface please see 7.4.2. FW update.
For firmware update over the air (needs 4GLTE/3G/2G connection) please follow
the steps below:
- Upload the update file (.cod extension) on public HTTP server ;
- Send firmware update command (the syntax of the SMS message is described in 8. Setup via SMS).
Attention! Only the Master can send this message.
The firmware will be downloaded and verified. The download takes about 3
minutes. If the file is correct, the Master will receive a confirmation SMS
message. The update procedure takes about 2 minutes. Once the firmware update
is complete (about 5 minutes), TCG140-4 will restart.
Attention! Don’t turn off the power supply during the update. Turning off the
power supply will damage the device.
Factory default settings
TCG140-4 can be restored to its factory default settings by the following steps:
- Turn off the power supply;
- Press and hold the RESET button then turn on the power supply;
- STA and SIG LEDs will turn ON;
- Release the RESET button.
The module will restore its default settings.
Environment information
This equipment is intended for use in a Pollution Degree 2 environment, at altitudes up to 2000 meters. When the module is a part of a system, the other elements of the system shall comply with the EMC requirements and shall be intended for use in the same ambient conditions.
Safety
This device must not be used for medical, life-saving purposes or for any
purpose where its failure could cause serious injury or the loss of life.
This product contains a coin/button cell battery. Do not ingest battery,
Chemical Burn Hazard.
If the coin/button cell battery is swallowed, it can cause severe internal
burns in just 2 hours and can lead to death.
Keep new and used batteries away from children.
If the battery compartment does not close securely, stop using the product and
keep it away from children.
If you think batteries might have been swallowed or placed inside any part of
the body, seek immediate medical attention.
To reduce the risk of fire, only flexible stranded wire, with cross-section
0.5mm² or larger for wiring of digital and analog inputs and relay output of
the device should be used.
To avoid electric shock and fire hazards, do not expose this product to
liquids, rain, or moisture.
Objects filled with liquids, such as vases, should not be placed on this
device.
There is a risk of overheating (damage) of the module, if recommended free
spaces to adjacent devices are not ensured. Joint part with external component
shall have space for attachment/removal of the cable after installation.
Teracom does not guarantee a successful operation of the product if the
product was used under conditions deviating from the product specifications.
Maintenance
Upon completion of any service or repairs to the device or once per year, a safety check must be performed to determine that this product is in proper operating condition. Clean the device only with a dry cloth. Do not use a liquid cleaner or an aerosol cleaner. Do not use a magnetic/static cleaning device (dust remover) or any kind of abrasive materials to clean the device.
Package content
The box contains:
- TCG140-4
- Multi-band antenna – 698 to 960 and 1710 to 2690MHz
- Four spacers/bumpers
- RS-485 terminator
- Quick start guide
The XML file (status.xml) structure:
Where:
The JSON file (status.json)structure:
{
“Monitor”: {
“DeviceInfo”: {
“DeviceName”: “TCG140-4”,
“HostName”: “TCG140-4”,
“ID”: “862632040544279”,
“FwVer”: “TCG140-4-v1.000”,
“MnfInfo”: “www.teracomsystems.com“,
“SysContact”: “info@teracomsystems.com“,
“SysName”: “TCG140-4”,
“SysLocation”: “Location”
},
“S”: {
“S1”: {
“description”: “S1:TST1xx”,
“id”: “2867895F07000058”,
“type”: “1W”,
“addr”: “1Wire”,
“item1”: {
“value”: “24.0”,
“unit”: “°C”,
“alarm”: “0”,
“min”: “19.0”,
“max”: “100.0”,
“hys”: “0.5”
},
“item2”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
}
},
“S2”: {
“description”: “S2”,
“id”: “0000000000000000”,
“type”: “1W”,
“addr”: “1Wire”,
“item1”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
},
“item2”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
}
},
“S3”: {
“description”: “S3”,
“id”: “0000000000000000”,
“type”: “1W”,
“addr”: “1Wire”,
“item1”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
},
“item2”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
}
},
“S4”: {
“description”: “S4”,
“id”: “0000000000000000”,
“type”: “1W”,
“addr”: “1Wire”,
“item1”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
},
“item2”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
}
},
“S5”: {
“description”: “S5”,
“id”: “3300000000000000”,
“type”: “MB”,
“addr”: “3”,
“item1”: {
“value”: “25.1”,
“unit”: “°C”,
“alarm”: “0”,
“min”: “-40.0”,
“max”: “85.0”,
“hys”: “8.5”
},
“item2”: {
“value”: “34.6”,
“unit”: “%RH”,
“alarm”: “0”,
“min”: “0.0”,
“max”: “100.0”,
“hys”: “10.0”
}
},
“S6”: {
“description”: “S6”,
“id”: “0000000000000000”,
“type”: “MB”,
“addr”: “0”,
“item1”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
},
“item2”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
}
},
“S7”: {
“description”: “S7”,
“id”: “0000000000000000”,
“type”: “MB”,
“addr”: “0”,
“item1”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
},
“item2”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
}
},
“S8”: {
“description”: “S8”,
“id”: “0000000000000000”,
“type”: “MB”,
“addr”: “0”,
“item1”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
},
“item2”: {
“value”: “—“,
“unit”: “—“,
“alarm”: “0”,
“min”: “—“,
“max”: “—“,
“hys”: “—”
}
}
},
“AI”: {
“AI1”: {
“description”: “Analog Input 1”,
“value”: “0.000”,
“unit”: “V”,
“multiplier”: “1.000”,
“offset”: “0.0000”,
“alarm”: “0”,
“min”: “0.000”,
“max”: “2.000”,
“hys”: “0.010”
},
“AI2”: {
“description”: “Analog Input 2”,
“value”: “0.000”,
“unit”: “V”,
“multiplier”: “1.000”,
“offset”: “0.0000”,
“alarm”: “0”,
“min”: “0.000”,
“max”: “2.000”,
“hys”: “0.010”
},
“AI3”: {
“description”: “Analog Input 3”,
“value”: “0.000”,
“unit”: “V”,
“multiplier”: “1.000”,
“offset”: “0.0000”,
“alarm”: “0”,
“min”: “0.000”,
“max”: “2.000”,
“hys”: “0.010”
},
“AI4”: {
“description”: “Analog Input 4”,
“value”: “0.000”,
“unit”: “V”,
“multiplier”: “1.000”,
“offset”: “0.0000”,
“alarm”: “0”,
“min”: “0.000”,
“max”: “10.000”,
“hys”: “1.000”
}
},
“DI”: {
“DI1”: {
“description”: “Digital Input 1”,
“value”: “OPEN”,
“valuebin”: “1”,
“alarmState”: “CLOSED”,
“alarm”: “0”
},
“DI2”: {
“description”: “Digital Input 2”,
“value”: “OPEN”,
“valuebin”: “1”,
“alarmState”: “CLOSED”,
“alarm”: “0”
}
},
“R”: {
“R1”: {
“description”: “Relay 1”,
“value”: “OFF”,
“valuebin”: “0”,
“pulseWidth”: “0.1”,
“control”: “0”
},
“R2”: {
“description”: “Relay 2”,
“value”: “OFF”,
“valuebin”: “0”,
“pulseWidth”: “0.2”,
“control”: “0”
},
“R3”: {
“description”: “Relay 3”,
“value”: “OFF”,
“valuebin”: “0”,
“pulseWidth”: “0.3”,
“control”: “0”
},
“R4”: {
“description”: “Relay 4”,
“value”: “OFF”,
“valuebin”: “0”,
“pulseWidth”: “0.4”,
“control”: “0”
}
},
“HTTPPush”: {
“Key”: “”,
“PushPeriod”: “300”
},
“MQTT”: {
“Period”: “300”
},
“signalpercent”: “67”,
“hwerr”: “”,
“Alarmed”: “0”,
“Scannig”: “Scan”,
“Time”: {
“Date”: “16.02.2021”,
“Time”: “14:39:55”
},
“NetworkInfo”: {
“Name”: “A1 BG A1 BG”,
“SC”: {
“MCC”: “284”,
“MNC”: “01”,
“LAC”: “28201”,
“CID”: “46596”,
“SQ”: “-71”
},
“Latitude”: 43.835283,
“Longitude”: 25.965967
}
}
}
}
Av. Fray Antonio Alcalde 1822, Miraflores,
44270
Guadalajara, Jalisco, Mexico. Tel. 33-3854-5975
www.logicbus.com.mx
References
- MQTT - The Standard for IoT Messaging
- Remote monitoring and control solution for your automation challenges
- Guidelines for Reliable Long Line 1-Wire Networks | Analog Devices
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>