IMDTouchKnowledge BaseShop main store

How-to

Sending SMS from an HMI through an HTTP GET modem

Industrial networks Published 8 min read

Short answer

Tag-based HMI runtimes have no HTTP client, so a relay — a controller HTTP block, an industrial PC script or a gateway — sits between the HMI and the modem. The HMI sets a trigger tag, the relay fires the documented HTTP GET at the modem's SMS feature, and a send-busy-done-error handshake guarantees exactly one SMS per button press. Prove the request in a PC browser before writing any HMI logic.

On this page
  1. Can a tag-based HMI send SMS through an HTTP GET modem?
  2. What hardware can act as the relay between HMI and modem?
  3. What must the modem have running before any HMI work?
  4. How do you prove the GET works before the HMI gets involved?
  5. How does the HMI trigger exactly one SMS per button press?
  6. How long can the message text be, and what breaks the request?
  7. How do you receive SMS back into the HMI?
  8. What tests sign off the whole HMI-to-handset chain?
  9. Questions asked

A tag-based HMI runtime such as Vijeo Designer talks to controllers through device drivers and tags, and most versions expose no HTTP client call in their script function lists, so the HMI cannot fire the Teltonika TRB245's documented HTTP GET by itself. The working design puts a relay between the two: the HMI writes a trigger tag over its existing driver, the relay issues the GET, and a send-busy-done-error handshake guarantees exactly one SMS per button press. Build the path from the modem outward, prove the request in a PC browser before you write any HMI logic, and sign off with an end-to-end test that includes a deliberate cable pull.

Can a tag-based HMI send SMS through an HTTP GET modem? #

Rarely by itself: the runtime is built around controller drivers and tags rather than HTTP calls, so the dependable design is a relay between the HMI and the modem — the HMI sets a trigger tag and the relay, not the HMI, fires the GET.

The TRB245 accepts an HTTP GET request on its LAN port and turns it into an SMS, so the whole question is what generates that request. Before designing anything, open the script function list in your installed Vijeo Designer version and search it for an HTTP or raw TCP socket call. If the call exists on your version, HMI script code can fire the GET directly. If it does not — the common case — you need a relay, which is the rest of this article. Check the function list in the editor you actually have: script function sets change between releases, and a call named in a manual for another version proves nothing.

What hardware can act as the relay between HMI and modem? #

Three options cover every case: a controller that already has an HTTP client block, a small industrial PC or gateway box running a script that watches the HMI's registers, or — only after your version's function list proves it — the HMI itself.

Relay How it works Use when
Controller with an HTTP client block HMI writes the trigger bit and message index over the existing driver; controller logic issues the GET and returns a done or error word The controller already has an Ethernet port and a documented HTTP client instruction
Industrial PC or gateway script The script polls a Modbus TCP register block on the HMI or controller, sends the GET, and writes status back No controller HTTP support, and you want a real HTTP client with timeouts you control
HMI script HMI code calls the HTTP or socket function directly Your installed version's function list contains the call

When only the script route is left, the relay needs a box in the cabinet, and industrial mini PCs are built for exactly this gateway duty beside the HMI.

What must the modem have running before any HMI work? #

Four things on the TRB245, in this order: an active SIM with the PIN lock cleared, network registration with signal shown on the status page, a static IP on the machine network recorded for the relay to target, and the SMS-over-HTTP feature enabled with its own user name and password.

The SMS-over-HTTP function is the modem's SMS Utilities feature, and it needs credentials the request will authenticate with. Copy the exact request syntax from the documentation for your firmware generation, not from memory and not from a different model: parameter names differ between firmware generations, and a hand-rebuilt string with a wrong parameter name fails without an error you can see.

How do you prove the GET works before the HMI gets involved? #

Paste the request URL into a PC browser on the same subnet, with your own mobile number as the recipient, and do not write one line of HMI or relay code until that SMS lands on the handset.

If the browser test fails, the HMI was never the problem: work down this table before anything else.

Check Command or location Pass condition
Layer 3 reachability ping the TRB245 IP from the relay host Replies, no loss
HTTP service reachable The same request URL opened from the relay host The same success response as the PC test
Subnet and addressing IP address and mask on relay and TRB245 One network, unique addresses

Also confirm the firewall allows the relay's address to reach the modem's HTTP port, and that the recipient number is in international format with the country code first and no spaces. The gate is simple: the SMS arrives on the handset and the browser shows the modem's success response.

How does the HMI trigger exactly one SMS per button press? #

An edge handshake of four tags does it: the HMI sets a send bit, the relay answers with a busy bit and then done or error, and the HMI may not clear anything until it has seen done or error, which locks the design to one message per press.

The tag names below are illustrative choices for this example, not vendor names — define your own equivalents in the tag table:

Tag Type Writer Meaning
SMS_Send BOOL HMI Request one send
SMS_Busy BOOL Relay GET in flight
SMS_Done BOOL Relay Documented success response received
SMS_Error BOOL Relay Any other response or timeout
SMS_Message_Index INT HMI Selects a predefined recipient and text
  1. The operator presses the send control; the HMI writes the message index, then sets SMS_Send.
  2. The relay executes once on the rising edge of SMS_Send and sets SMS_Busy.
  3. The relay issues the HTTP GET and waits for the modem's response or its own timeout.
  4. On the documented success response the relay sets SMS_Done; on any other response it sets SMS_Error.
  5. The HMI clears SMS_Send only after it sees SMS_Done or SMS_Error, and the relay returns its bits to idle.

The HMI side is an ordinary tag write over the driver it already runs — the same push-one-value pattern as sending HMI RTC time to a PCB over Modbus, where the HMI writes one value and the far end acts on it. Treat a timeout as unknown rather than failure, because the SMS may still be moving on the cellular side, and retry at most once after a fixed delay; anything more aggressive turns a slow network into a burst of duplicate messages.

How long can the message text be, and what breaks the request? #

Keep every alarm text inside one SMS segment — 160 characters in the GSM 7-bit alphabet — and URL-encode the text, because the first unescaped reserved character such as an ampersand ends the query string and truncates the message at exactly that character.

The arithmetic decides the split: a 200-character text gives 200 ÷ 153 = 1.31, so 2 concatenated segments in the 7-bit alphabet, because each segment of a multi-part message carries 153 characters after the segmentation header takes its share. If even one character falls outside that alphabet, the whole text moves to UCS-2 at 67 characters per segment, and 200 ÷ 67 = 2.99, so 3 segments. Splitting costs more and can reorder delivery, so short fixed texts win.

Encode spaces as %20, or as + where your firmware documents it, and escape the ampersand, the hash sign and the percent sign wherever they appear in the text. Keep the recipient list on the relay as fixed entries and let the HMI select an index, which also pins down who the machine can message. The GET carries its credentials in the URL as clear text, so keep the modem's LAN port on an isolated machine network.

How do you receive SMS back into the HMI? #

The send-side GET gives you nothing on the receive side: configure the modem's SMS Utilities rules so an authorized sender's keyword triggers an action the relay can observe, and let the relay write the resulting command into a register block the HMI reads.

Two patterns cover it. Command by keyword: a rule on the modem maps an authorized sender's keyword to a state change the relay can see, and the relay turns that into a command word in the HMI or controller tag table. Message retrieval: where your firmware offers a way to list received messages over a local interface, the relay polls it, parses the message, and writes the command or text into a register block the HMI reads.

Restrict accepted commands to the authorized sender list on the modem, validate the command value in the relay as well, and require an operator confirm step on the HMI for any command that moves equipment.

What tests sign off the whole HMI-to-handset chain? #

The chain is signed off when one press produces exactly one SMS, a pulled LAN cable produces an error instead of silence, and only the authorized handset moves a receive-side tag.

  1. Press the send control once; watch SMS_Busy and then SMS_Done in the tag monitor, and confirm one SMS on the handset with the right number and text.
  2. Send a text containing a space, a comma and an ampersand; confirm it arrives intact, which proves the URL encoding.
  3. Unplug the TRB245's LAN cable, press send again; confirm SMS_Error appears within the relay timeout and no repeated sends follow.
  4. Restore the cable, send an SMS from the authorized handset; confirm the intended HMI tag changes.
  5. Repeat from any other handset; confirm no tag changes and no response leaves the modem.

If the relay is a controller HTTP block and its done bit never sets after a send, suspect a lost handshake edge or an incomplete request before the network — the diagnosis runs the same way as for a PUT instruction whose Done bit never sets. Clear that fault and the five checks above are the whole acceptance test.

Questions asked

Does any Vijeo Designer version have a script function that sends HTTP directly?

Versions differ, and the script editor's function list is the only authority. Open it in your installed version and search for an HTTP or socket call before designing anything: if the call exists, the HMI can fire the GET itself with the same handshake, and if it does not, the relay design in this article stands. Never assume a function exists because an example on the internet uses it.

What response from the modem counts as a successful send?

Whatever the browser test showed. Capture the modem's success response during the PC test and make the relay match that response before it writes the done bit; treat every other response, including a timeout, as unknown rather than failure, because the SMS may still be in flight on the cellular network. Matching a response you have actually seen beats parsing a status code you have not.

How do you stop a network outage from flooding phones with duplicate alarm SMS?

Cap the retry at one attempt after a fixed delay, then collapse: keep the newest event text and add a counter tag the relay includes in the message, so a shift with forty repeats sends one text saying forty occurred instead of forty texts. A dead cellular link must end in the error bit after the relay timeout, never in an open-ended retry loop.

Does this design work with SMS gateways other than the Teltonika modem?

Yes, provided the gateway accepts an HTTP GET with the recipient and text as parameters, which is what the SMS-over-HTTP feature class does. Take the exact request syntax from that gateway's own documentation for its firmware generation, because parameter names differ, and keep the HMI-side handshake unchanged; only the relay's request-building step changes when the modem changes.

Can two HMIs share one SMS modem through the same relay?

Yes. Give each HMI its own trigger bit into the relay and let the relay serialize the work: only one GET is ever in flight, and a second request waits until the first returns done or error. Serialize rather than parallelize, because overlapping requests on one cellular modem produce responses the handshake cannot attribute to the right button press.

Keep reading

  • Troubleshooting

    Building the RS-232 Modbus cable between an HMI and a controller

    Map the pins by signal name, not by number: the HMI's transmit on 25-pin pin 2 goes to the controller's receive, the HMI's receive on pin 3 comes from the controller's transmit, and signal common runs end to end. The jumper between pins 8 and 12 stays at the HMI connector. Generic straight-through and null-modem cables cause silence because the 25-pin and 9-pin standards number the data lines differently.

    Industrial networks

  • How-to

    How to Send HMI RTC Time to a PCB Over Modbus

    Modbus never broadcasts the panel clock. Configure the HMI as a Modbus client and let it write six holding registers — year, month, day, hour, minute, second — with function code 16 about once per minute, capturing all six values as one snapshot so a rollover never mixes an old date with a new time.

    Industrial networks

  • How-to

    Connecting Multiple HMIs to One PLC Over 200 ft Serial

    RS-232 on good cable can reach 200 ft at 9600 baud, but RS-232 connects exactly two devices, so three HMIs cannot share one PLC port. Put an RS-232-to-RS-485 adapter at the PLC and at each panel, daisy-chain one twisted pair, and terminate only the two ends. Confirm the PLC port's protocol accepts more than one master before ordering adapters.

    Industrial networks