Generating One-Shot Pulses from SMS Commands on LOGO! CMR2020

David Krause15 min read
Other TopicSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

Engineers who deploy a Siemens LOGO! CMR2020 (6GK7142-7BX00-0AX0) or LOGO! CMR2040 (6GK7142-7EX00-0AX0) for remote control frequently want the same behaviour they get from a hardware pushbutton: one SMS toggles a load briefly, the relay drops out, and no second message is required to clear the line. By default, however, the SMS command interpreter writes a static value into a variable memory (VM) byte or a network input (NI), and the receiving LOGO! program reads that bit as a continuous high level until a second message with value 0 arrives. The output therefore stays energised indefinitely.

The clean engineering fix is to keep the SMS interpreter unmodified and convert the static write inside the LOGO! ladder/FBD program into a fixed-width pulse using the built-in Pulse Generator (PG) block, or one of its equivalents (Wiping Relay, Pulse Relay). When the firmware on the CMR module is at V2.1.5 or later, you can also address individual bits directly with the BIT keyword, eliminating the need to manipulate whole bytes. This article walks through the full procedure: firmware update, syntax selection, program construction in LOGO! Soft Comfort, NI/VM mapping, on-site verification, and a troubleshooting matrix.

Safety notice. Remote control of energised equipment by SMS inherently bypasses the local HMI. Implement the LOGO! program so that a loss of GSM coverage or a stuck message cannot leave a coil, contactor, or motor starter permanently engaged. Use the pulse approach described below, or interlock the SMS-driven output with a watchdog (e.g., a Wiping Relay fed by the LOGO!'s own clock bit M1 or M8) so a stale high level cannot hold the load.

Prerequisites

  • LOGO! 8 base module (6ED1052-1MD08-0BA1, 6ED1052-1MD00-0BA2, or later) with the CMR2020 or CMR2040 clipped to its left side. See the LOGO! CMR2020 / LOGO! CMR2040 operating instructions for supported combinations.
  • LOGO! Soft Comfort V8.4 or later, installed on a Windows PC and connected to the LOGO! via Ethernet.
  • CMR module firmware V2.1.5 (released for both 6GK7142-7BX00-0AX0 and 6GK7142-7EX00-0AX0). Earlier firmware accepts only whole-byte writes; the bit-level syntax described below will be silently rejected.
  • An activated nano-SIM with SMS service provisioned (the CMR module does not use data for SMS commands).
  • A configured whitelist of authorised sender numbers inside the CMR WebConfig (Administration > SMS > Allowed Senders). Commands from unlisted numbers are dropped by the module.

Why the Output Latches After an SMS Write

The SMS command parser on the CMR module is a one-shot writer: when it receives a properly formatted message, it pushes the supplied value into a VM byte or a single bit and then stops. Nothing inside the CMR knows that the application expected a momentary action. The receiving LOGO! program therefore sees a high level on, for example, NI10 or VM10.0 for as long as the variable retains the value 1.

In a PLC application, latching is the expected behaviour for a Set instruction and is exactly what you want for a "lights on" command. It is the wrong behaviour for a "press to start" command that is expected to time out. The two solutions commonly used in the field are:

  1. Send a second SMS to reset. The operator texts LOGO=Q1,0,BYTE after the device has been activated. Simple, but operationally fragile: if the operator forgets, or if the second message is dropped by the network, the load stays on.
  2. Convert the static bit to a pulse inside the LOGO! program. The static level on the network input drives a Pulse Generator block. On its rising edge, the PG block produces a high pulse of fixed duration TH on its output Q. The receiving coil or output contactor sees a momentary energisation regardless of how long the SMS-driven bit stays high.

This article focuses on option 2, which is the only acceptable pattern for unattended equipment.

Firmware Update to V2.1.5

Open the CMR WebConfig from a browser (default address 192.168.0.10 on the LOGO! side, or the address assigned by DHCP on the WAN side). Navigate to System > Firmware Update, upload the V2.1.5 firmware file, and confirm the restart. The release notes state the following user-visible changes:

Change Behaviour before V2.1.5 Behaviour at V2.1.5
Bit-level writes Only BYTE writes accepted; partial writes were ignored and the full byte had to be reconstructed by the sender. The keyword BIT is accepted, e.g. LOGO=VM10.0,1,BIT writes a single bit without touching the other bits in VM10.
Confirmation reply No reply was sent when a write succeeded. Optional acknowledgement reply to the originating number when the write completes.
Stuck-bit watchdog None. Optional automatic clear of an SMS-driven bit if no follow-up message is received within a configurable time-out.
Always confirm the new firmware version under System > Device Information after the reboot. The CMR takes about 90 seconds to complete the restart and re-register on the GSM/LTE network; SMS commands sent during this window are dropped silently.

SMS Command Syntax (BYTE vs. BIT)

The CMR module parses the body of each incoming SMS as a single line. The grammar is:

LOGO=<target>,<value>,<type>

where <target> is a network input (NI), a network output (NO), a variable memory byte (VM<addr>), or (from V2.1.5 onward) a single bit (VM<addr>.<bit> or NI<number>.<bit>). <value> is a decimal 0 or 1 for a bit, or 0-255 for a byte. <type> is one of BIT, BYTE, or WORD depending on the size of the target.

Example message Effect on the LOGO! Notes
LOGO=NI10,1,BYTE Sets the entire NI10 byte to 0x01. NI10.0 = 1, NI10.1..NI10.7 = 0. Pre-V2.1.5 syntax; still supported.
LOGO=VM10,1,BYTE Writes 0x01 into VM10. Use this when the LOGO! program reads VM10.0 rather than NI10.
LOGO=VM10.0,1,BIT Sets VM10.0 to 1; the other seven bits of VM10 are untouched. Requires CMR firmware V2.1.5+.
LOGO=NI10.3,1,BIT Sets NI10.3 to 1; NI10.0..NI10.2 and NI10.4..NI10.7 unchanged. Useful when the same byte is used for multiple independent commands.
LOGO=NI10,0,BYTE Clears the entire NI10 byte. Not required if you use the pulse approach in the LOGO! program.

Note that the message LOGO=Q1,1,BYTE shown in some older discussions is not a valid syntax. The CMR cannot write directly to a physical output Qx. The output must be driven by the LOGO! base module after a network input or VM bit is set, which is precisely the layering used in the program described below.

Implementing the One-Shot Pulse in LOGO! Soft Comfort

The core of the fix is the Pulse Generator (PG) block. In the LOGO! function block library, PG is a special function that produces a pulse of fixed width TH on its Q output whenever its trigger input Trg sees a rising edge. The output goes back low automatically after the pulse time, regardless of the state of Trg. In other words, PG converts a static 1 into a momentary 1.

Available pulse-producing blocks in LOGO! Soft Comfort V8.x include:

Block Behaviour Best fit for SMS-driven triggers
Pulse Generator (PG) Q goes high on the rising edge of Trg, stays high for TH, then returns low. Re-triggerable while Q is high. Yes - default choice for the one-shot pattern.
Wiping Relay (WipR) Q goes high for a short, fixed time on the rising edge of Trg. Non-retriggerable while Q is high. Yes - good when repeated SMS messages must not extend the pulse.
Pulse Relay (PR) Q toggles on every rising edge of Trg. No - this is a flip-flop, not a pulse.
Edge-triggered wiping relay (WRE) Edge-triggered variant of the wiping relay with a configurable W parameter. Yes - equivalent to PG, sometimes more convenient when the trigger is a named edge flag.

All four blocks honour the parameter TH (pulse width), which is configurable in the block properties. Typical values used in the field are:

  • 0.5 s - 1 s: for a short beep, a courtesy light, or a gate-release pulse.
  • 2 s - 5 s: for a motor starter seal-in pulse, where the contactor's own auxiliary contact takes over sealing.
  • 10 s - 60 s: for irrigation valves or processes that need a defined run time regardless of how long the SMS-driven bit remains high.
LOGO!'s minimum time base is 0.01 s, but the resolution of TH is one tick of the LOGO! scan cycle. Set TH to at least 0.2 s if the downstream contactor is a small DC-operated relay with mechanical chatter, or you may miss the pulse entirely.

Step-by-Step Program Build

Use LOGO! Soft Comfort V8.4 or later. The example below creates a single NI-driven one-shot pulse on output Q1. Repeat the pattern for any additional outputs.

  1. Open LOGO! Soft Comfort, create a new diagram, and select the correct LOGO! hardware (8.BA1 or 8.BA2 family) in Tools > Select Hardware. This ensures the block library matches the target.
  2. From the Special Functions palette, drag a Pulse Generator (PG) block onto the workspace. Place it near the centre of the diagram so the wiring does not get crowded.
  3. Double-click the PG block and set TH = 2.00 s (adjust to taste). The minimum is 0.05 s; the maximum is 99:59 h. Leave the retrigger mode at its default (retriggerable) for now.
  4. Wire the PG trigger input Trg to the network input you intend to drive by SMS. In the example, this is NI10.0, which is the bit addressed by LOGO=NI10.0,1,BIT on V2.1.5+ firmware, or by the legacy LOGO=NI10,1,BYTE on earlier firmware.
  5. Wire the PG output Q to a Digital Output (Q1). Right-click the output pin and assign the physical output Q1 of the base module.
  6. Save the program, switch LOGO! Soft Comfort to Online mode, and click PC → LOGO! to download. Wait for the success prompt; the LOGO! will switch to RUN automatically.
  7. From a phone on the whitelist, send LOGO=NI10.0,1,BIT. The CMR writes the bit, NI10.0 transitions 0 → 1, the PG block fires, Q1 energises for 2.00 s, and then Q1 returns low even though the message-induced bit is still high.
  8. To clear the static bit without a follow-up SMS, either re-use the PG block to feed a one-shot into the application, or schedule an automatic LOGO=NI10.0,0,BIT from the CMR's built-in time-of-day scheduler (Tools > Schedules in WebConfig).

Inline SVG: Ladder-style program overview

|NI10.0|----[PG: TH=2.00s]----( Q1 ) ↑ ↑ ↑ Static Rising edge Coil Q1 SMS bit produces 2 s energises (NI10.0=1) pulse on Q for 2 s only Trigger : SMS LOGO=NI10.0,1,BIT (CMR FW 2.1.5+) Reset : automatic, after TH Output : Q1 (relay on base module)

Wiring the Network Input / VM Bit

There are two equally valid ways to bring the SMS into the LOGO! program.

Approach SMS syntax used How the LOGO! reads it When to pick it
Network input (NI) LOGO=NI10.0,1,BIT (V2.1.5+) or LOGO=NI10,1,BYTE (older) Reference the bit directly in the program, e.g., the Trg input of the PG block. Default choice. NI is the documented integration point between the CMR and the LOGO! base module.
Variable memory (VM) LOGO=VM10.0,1,BIT (V2.1.5+) or LOGO=VM10,1,BYTE (older) Reference the VM bit in the program. Useful if the same byte also has to be touched by a remote LOGO! Soft Comfort session for debugging. When you want a clean separation between the SMS-driven bits and the LOGO!-internal flags.

If you change from NI to VM (or vice versa) after the program is downloaded, you must re-download the program; LOGO! Soft Comfort does not migrate NI/VM bindings automatically.

Verification

After the download completes, validate end-to-end before walking away from the panel.

  1. Open Online > Online Test in LOGO! Soft Comfort. Confirm NI10.0 (or VM10.0) is shown in red (high) only briefly after each SMS arrives, then drops to grey when the PG block times out.
  2. Watch Q1 with a multimeter or a clip-on ammeter. It should pull in for exactly TH seconds, then drop out. Repeat the SMS three times in a row to make sure the PG block is retriggerable and that the timing is stable.
  3. Pull the SIM card from the CMR and send an SMS from an unlisted number. The CMR should drop both, and Q1 should not change state.
  4. Cycle power on the LOGO! base module. When the LOGO! restarts, Q1 must remain low. The PG block should not produce a phantom pulse on cold boot, because the network input defaults to 0 at startup.
  5. Power-cycle the CMR only. The base module retains its program, and a fresh SMS to LOGO=NI10.0,1,BIT should still produce exactly one 2 s pulse on Q1 after the CMR finishes re-registering on the cellular network (typically 30-90 s).

Troubleshooting Matrix

Symptom Likely root cause Fix
Q1 energises and never drops out. The PG block is missing, replaced by a self-holding contactor pattern, or its TH parameter is at the default of 99:59 h. Insert a PG block on the path between the network input and Q1, or shorten TH.
CMR replies with syntax error to a BIT write. Firmware older than V2.1.5. Update the CMR firmware to V2.1.5 via the WebConfig. After the restart, retry.
SMS is delivered to the CMR but NI10.0 stays low in Online Test. The whitelist is empty, the SIM has no SMS service, or the CMR is offline from the cellular network. Check System > Mobile Network in WebConfig. Verify the signal strength indicator and the registration state. Add the sender number to Administration > SMS > Allowed Senders.
Q1 fires once on power-up, then never again. The NI bit was already 1 when the program was downloaded, and the PG block's first scan produced the rising edge. Add a one-cycle-on-first-scan reset, or simply re-power the LOGO! after confirming NI10.0 = 0 in Online Test.
The pulse width is jittery (e.g., 1.7 s instead of 2.0 s). The LOGO! scan cycle is being stretched by a heavy program. Reduce the number of analogue blocks in the same cycle, or move the PG block to a higher-priority slot if your LOGO! supports it.
SMS messages are accepted but the LOGO! does not see any change. Wrong base module selected in Tools > Select Hardware; the NI index is out of range (NI1..NI64 only). Re-select the correct hardware. Keep NI numbers between NI1 and NI64 inclusive.

Variations and Field-Proven Patterns

Motor starter with seal-in auxiliary

For a three-phase motor driven by a contactor K1, the SMS pulse should be long enough for the contactor's own NO auxiliary contact to close and pick up the seal-in path. Set TH to 3 s; the PG output drives both K1 and a parallel seal-in branch through the NO auxiliary. When the operator sends a stop SMS (LOGO=NI10.1,1,BIT), an Off-Delay block in the stop path drops K1.

Run-with-time-limit pattern

For irrigation valves, use a PG with TH set to the desired run time (e.g., 30 minutes). The valve opens on the first SMS and closes automatically 30 minutes later, with no second SMS required. The LOGO!'s max TH is 99:59 h, which covers essentially every practical irrigation cycle.

Multi-output via the same byte

If you have eight valves that all need independent one-shot triggers, use the bit-level syntax: LOGO=VM10.0,1,BIT for valve 1, LOGO=VM10.1,1,BIT for valve 2, and so on up to LOGO=VM10.7,1,BIT for valve 8. Each bit drives its own PG block, so each valve has its own independent timing.

Password-protected messages

The CMR supports a 4-digit PIN prepended to the message body, e.g. 1234 LOGO=VM10.0,1,BIT. The PIN is checked by the CMR before the write is performed. Use it on any installation that is reachable from a public cellular network.

Related Tools in LOGO! Soft Comfort

LOGO! Soft Comfort V8.4 includes an SMS test tool under Tools > SMS Test that emulates an incoming message without using a real cellular connection. Use it during commissioning to validate the wiring between the CMR and the LOGO! base module before the SIM is provisioned. The on-screen indicator behaves exactly as it would for a real SMS, including the optional reply, and it does not count against the SIM's SMS quota.

FAQ

How do I make the LOGO! CMR2020 release its output automatically after a text message?

Do not change the CMR. Insert a Pulse Generator (PG) block in your LOGO! Soft Comfort program with the SMS-driven network input (e.g., NI10.0) on its Trg input and the actual output (e.g., Q1) on its Q output. Set TH to the desired pulse width, for example 2 s. The PG block produces exactly one 2 s pulse on the rising edge of the SMS, then returns low, so the operator does not have to send a second reset message.

Do I have to update the firmware on the CMR to V2.1.5?

For the bit-level BIT syntax, yes. Earlier firmware accepts only whole-byte writes, which is workable but less convenient because the sender has to compute the full byte value when several outputs share the same VM address. V2.1.5 is the official release for 6GK7142-7BX00-0AX0 and 6GK7142-7EX00-0AX0 and also adds the optional acknowledgement reply and the stuck-bit watchdog.

Can I write a single bit instead of a whole byte?

Yes, but only on CMR firmware V2.1.5 or later. Use the BIT keyword and a dotted address, for example LOGO=VM10.0,1,BIT or LOGO=NI10.3,1,BIT. Older firmware silently ignores the BIT keyword and will not modify the target.

How do I set the pulse width?

Open the PG block properties in LOGO! Soft Comfort and change the parameter TH. The minimum is 0.05 s and the maximum is 99:59 h. Use 0.5 s for a courtesy light, 2-3 s for a contactor with mechanical seal-in, and several minutes to hours for irrigation valves. Remember to set TH to at least 0.2 s when the downstream device is a small relay with mechanical chatter.

What happens if the GSM network is unavailable when the SMS arrives?

The CMR stores the SMS in its internal buffer and delivers it as soon as the network returns. There is no risk of a missed command, but the latency can reach several minutes. If the application is time-critical, consider adding a watchdog in the LOGO! program (e.g., an On-Delay block driven by NI10.0) so a stale high level cannot hold the load for more than a defined time.

Can I use a single SMS to start and a different SMS to stop the same output?

Yes. Map two different network-input bits (for example NI10.0 = start, NI10.1 = stop) and feed them into a Set-Reset (RS) block, with the start on S and the stop with reset-dominant logic on R1. The PG block is only required on the start path; the stop path is naturally static.

Back to blog