Problem Statement: Node-RED Cannot Drive LOGO! 8 Outputs via S7
When integrating a Siemens LOGO! 8 (order code 6ED1052-1xxx08-0BA8, including the 1FB08 Ethernet variant) with Node-RED over the S7 protocol (ISO-on-TCP, port 102), the controller appears to accept write commands from the SCADA/HMI side, but the physical output relays do not change state. Writing to addresses such as DB data blocks, QX.X (Q0.0, Q0.1, Q0.2), or even unused outputs like Q20 with the correct TSAP combination produces no electrical action at the terminals.
The Node-RED flow reports a successful S7 write, the LOGO! 0BA8 acknowledges the telegram, but the output stays at its program-driven state. Voice-command pipelines built on Android Tasker → MQTT → Node-RED therefore appear to "work" at the data layer yet fail at the actuator layer.
payload: true and the node-red-contrib-s7 write node reports status "ok", but the LOGO! output relay does not energize. The same flow can successfully read the current output state, confirming that S7 communication itself is healthy.
Root Cause: Cyclic Overwrite of Physical Outputs by the LOGO! Program
The Siemens LOGO! executes its user program cyclically, typically every 20–50 ms depending on program length and 0BA8 firmware. On every cycle, the LOGO!Soft Comfort (LSC) FBD/LD program writes the result of its logic network directly to the left side of the Q (output) operand.
When an external S7 client attempts to write to a Q bit, that write is valid only for the very brief window before the next LOGO! cycle overwrites it. The user program has higher priority than the S7 write image. This is by design: outputs are the result of the program, not an independent memory area that the program samples.
Q1..Q20) are the result of the user program and may be used only on the right side (as inputs) in LSC, or as coil targets. They cannot be persistently driven from an external bus master because the PLC program is the sole owner of the output coil.
The same logic applies to the four cursor/display flags (M25..M28) and special flags. Any memory cell that is assigned to the left side of a coil in the LSC diagram will be reset by the next cycle.
Solution Architecture: Virtual Memory Bit + OR Block
The correct integration pattern is:
- Reserve one or more flag bits (
M1..M64) or network inputs (NI1..NI64, exposed in S7 as theVarea) as a command channel. - Have Node-RED write to that M bit over S7. Flag bits are not owned by the user program unless explicitly assigned, so the write persists until the program clears them.
- In the LOGO! program, OR the flag bit with the local logic that would otherwise drive the output. The output coil (
Q1) is then energized whenever either the local logic or the external Node-RED command is true.
This pattern respects the LOGO! 0BA8 ownership model: the program still owns the output coil, but it now also listens to an external "virtual input".
Step 1 — Configure the LOGO!Soft Comfort Program
Open the existing program in LOGO!Soft Comfort (LSC) V8.x or later, which is the official Siemens engineering tool for the 0BA8 series (download via the LOGO! 8 System Manual entry in the Siemens Industry Online Support).
For each output that should be externally controllable:
- Insert an OR block (function block B01 in the LSC toolbox).
- Connect the existing program branch to input 1 of the OR block.
- Connect a flag bit — for example
M1forQ1,M2forQ2,M3forQ3— to input 2 of the OR block. - Wire the OR output to the
Q1,Q2,Q3coils as before.
The resulting FBD rung should look conceptually like this:
+-------+
[Local I1]-+ |
| OR +----[ Q1 ]
[Flag M1 ]--+ |
+-------+
Repeat for each output. The flag bit Mx is now the "command register" for that output. The local program logic can still force the output low by simply not energizing input 1 of the OR — useful for safety interlocks.
NI1..NI64 instead of M flags. These are surfaced in S7 as the V area (variable memory) and are semantically clearer in the LSC diagram. See the LOGO! 0BA8 System Manual, section on Ethernet communication and network variables.
Step 2 — Configure the Node-RED S7 Connection
Install the node-red-contrib-s7 package (v2.x for current Node-RED LTS). This node implements the S7 client role using the nodes7 library and supports the ISO-on-TCP transport the LOGO! 0BA8 expects.
Drag an s7 endpoint configuration node onto the flow and configure it as follows for a typical LOGO! 8 on a /24 private LAN:
| Parameter | Value | Notes |
|---|---|---|
| Name | LOGO8_OB08 | Free-form label |
| Address | 192.168.0.10 |
Match the LOGO! IP (set in LSC under Tools → Ethernet Connections or on the device menu) |
| Port | 102 |
Default ISO-on-TCP port; do not change unless the LOGO! has been reconfigured |
| Rack | 0 |
LOGO! 0BA8 occupies rack 0 |
| Slot | 1 |
LOGO! 8 logical slot |
| Local TSAP | 01.00 |
Any un-used local TSAP is valid for the client |
| Remote TSAP | 02.00 |
Default LOGO! 0BA8 server TSAP; this is the most common cause of "connects but no data" issues |
| Cycle Time (ms) | 2000 |
Read poll interval — set to a value greater than the LOGO! cycle (≈50–200 ms) |
| Timeout (ms) | 3000 |
Fail-fast value for diagnostics |
The remote TSAP 02.00 corresponds to the LOGO!'s S7 server slot 2, which is the default S7 connection for the 0BA8. If the LOGO! project defines additional server connections, the TSAP pair becomes 03.00, 04.00, and so on. Refer to the LOGO! 0BA8 System Manual chapter on Ethernet connections for the full table.
Step 3 — Define Variable Addressing in the s7 Node
Open the s7 in and out configuration node (double-click the s7 endpoint to reveal the variable table) and enter the items below. The address format follows S7 conventions: area letter + byte.bit.
| Direction | Name | Address | LOGO! Mapping | Datatype |
|---|---|---|---|---|
| Read | Q1_state | Q0.0 |
Output Q1 | Bool |
| Read | Q2_state | Q0.1 |
Output Q2 | Bool |
| Read | Q3_state | Q0.2 |
Output Q3 | Bool |
| Read | I_inputs | IB0 |
Digital inputs I1..I8 | Byte |
| Read | M_flags | MB0 |
Flags M1..M8 | Byte |
| Read | V_netinputs | VB0 |
Network inputs NI1..NI8 | Byte |
| Write | M1_cmd | M0.0 |
Flag M1 (controls Q1 via OR block) | Bool |
| Write | M2_cmd | M0.1 |
Flag M2 (controls Q2 via OR block) | Bool |
| Write | M3_cmd | M0.2 |
Flag M3 (controls Q3 via OR block) | Bool |
The mapping Q0.0 → Q1 through Q0.7 → Q8 and Q1.0 → Q9 through Q1.3 → Q12 is documented in the LOGO! 0BA8 System Manual, section "Address areas in S7 communication". The 0BA8 base unit supports up to 20 outputs depending on the model variant (e.g., LOGO! 8.3 with relay outputs 6ED1052-1MD08-0BA8 = 4 outputs; 6ED1052-1CC08-0BA8 = 8 outputs; 6ED1052-2MD08-0BA8 = 4 outputs, etc.). The Q2.x byte covers Q17..Q20 on 20-output models.
Step 4 — Build the Node-RED Flow
A minimal control flow uses an MQTT input (from the voice pipeline) and a function node that maps topic names to M flag writes. A complete example flow exists at flows.nodered.org — Siemens Logo8 + Node-RED Q1..Q10 read, M1 write and an adapter example at flows.nodered.org — Adapt s7 node to LOGO.
A reference flow skeleton that performs the M-flag write is:
[{"id":"mqtt_in","type":"mqtt in","z":"flow1","name":"Voice Cmd","topic":"logo/cmd/#","broker":"broker1","x":140,"y":120,"wires":[["parse_cmd"]]},
{"id":"parse_cmd","type":"function","z":"flow1","name":"Map topic to M flag","func":"var t = msg.topic;\nvar v = (msg.payload == 'on' || msg.payload === true);\nvar out = {};\nif (t === 'logo/cmd/q1') out.M1_cmd = v;\nelse if (t === 'logo/cmd/q2') out.M2_cmd = v;\nelse if (t === 'logo/cmd/q3') out.M3_cmd = v;\nelse return null;\nmsg.payload = out;\nreturn msg;","x":340,"y":120,"wires":[["s7_out"]]},
{"id":"s7_out","type":"s7 out","z":"flow1","endpoint":"LOGO8_OB08","variable":"M1_cmd","x":540,"y":120,"wires":[]}]
When MQTT receives logo/cmd/q1 = on, the function emits {M1_cmd:true}, and the s7-out node writes true to M0.0 in the LOGO!. Because the LSC program ORs M1 with the local logic, Q1 energizes.
For debouncing voice commands (Tasker can fire the same intent twice within ~300 ms), place a delay node or a distinct node in front of the s7-out node.
Step 5 — Verification Procedure
- Confirm S7 connectivity. Deploy the flow and open the s7 endpoint node. The status indicator should be solid green. A yellow/gray indicator means the TCP socket or TSAP is wrong — re-check the values in Step 2.
-
Confirm payload delivery. Connect a
debugnode to the s7-out node's input. Thedebugsidebar should show{M1_cmd:true}when the MQTT topic fires. -
Confirm flag write. Inject a Boolean value into the s7-out node and then read back
MB0on the s7-in node. IfMB0reflects the write, the addressing is correct. -
Confirm output energization. Physically observe the relay LED for
Q1on the LOGO! 0BA8 housing. If it does not light, the LSC program is not actually OR-ing the flag. Re-check the rung wiring. -
Confirm local logic still wins. Toggle a local input (I1) that drives
Q1in the original program. The output should still respond. If the output now ignores local input, the OR block has been wired backwards. -
Confirm no cyclic flicker. With Node-RED writing
M1 = truecontinuously, monitorQ0.0on the s7-in node. The value must be a stabletrue, not a 1-Hz blink. A blink indicates the LSC program is clearing the flag at the end of each cycle — move the flag into a "latch" or OR-pattern as described.
LOGO! 0BA8 S7 Memory Map Reference
| S7 Area | Address Range | LOGO! Symbol | Description |
|---|---|---|---|
| Inputs |
I0.0..I0.7 (IB0) |
I1..I8 (base), I9..I24 (expansion) | Physical digital inputs |
| Outputs |
Q0.0..Q0.7 (QB0), Q1.0..Q1.3 (QB1), Q2.0..Q2.3 (QB2) |
Q1..Q20 | Physical digital outputs (read-only from S7; writable but immediately overwritten by LSC) |
| Flags |
M0.0..M7.7 (MB0..MB7) |
M1..M64 | Remanent and non-remanent flag bits. Safe to write from S7 if not used as coil on left side of LSC. |
| Network inputs |
V0.0..V7.7 (VB0..VB7) |
NI1..NI64 | Inputs received from S7 master. Reserved for S7 writes — ideal command channel. |
| Network outputs |
V8.0..V15.7 (VB8..VB15) |
NQ1..NQ64 | Outputs sent to S7 master. Use to publish LOGO! state to Node-RED. |
| Analog inputs |
AI0..AI7 (word) |
AI1..AI8 | 10-bit analog values from I7/I8 or expansion modules |
| Analog outputs |
AQ0..AQ1 (word) |
AQ1..AQ2 | Analog output values |
V0..V7) are designed to be written by the S7 client and read by the LOGO! program. Using V bits for external commands removes any ambiguity about M-flag ownership and produces a clean LSC diagram.
Troubleshooting Matrix
| Symptom | Probable Cause | Diagnostic Step | Fix |
|---|---|---|---|
| s7 endpoint stays yellow | Wrong IP, port, or TSAP |
ping LOGO! IP; telnet 192.168.0.10 102
|
Verify IP in LOGO! menu; set Remote TSAP to 02.00 or the value configured in LSC Ethernet connections |
| Write succeeds, output does not change | LSC program overwrites Q coil | Inspect rung in LSC; check for direct coil on Q | Insert OR block: [local logic] OR [M-flag] → Q coil |
| Output toggles at 1–5 Hz instead of latching | LSC program resets the flag every cycle | Search LSC for any rung that writes to Mx with NEG/NOT | Use a network input (V bit) as the command channel; the LOGO! never resets V bits by default |
| Reads work, writes fail with timeout | LOGO! has no S7 server connection enabled | In LSC: Tools → Ethernet Connections → Server Connection must be active | Add a server connection with TSAP 02.00 for "S7" protocol |
| Node-RED error "ENOTFOUND" / "ECONNREFUSED" | Firewall or wrong subnet | Check Node-RED host network; try nc -vz 192.168.0.10 102
|
Adjust firewall rules; route Node-RED host into LOGO! subnet |
| Tasker intent fires but Node-RED receives no message | MQTT broker or topic mismatch | Subscribe with mosquitto_sub -t '#' -v on the broker |
Match broker host/port in Tasker MQTT plugin to Node-RED broker config |
| Multiple writes in quick succession flicker the output | Voice pipeline debouncing missing | Inject a rapid burst into the function node | Add a distinct or rbe (report-by-exception) node upstream of s7-out |
| Output energizes but does not release | Node-RED writes only ON, never OFF | Inspect MQTT payloads for both 'on' and 'off' | Ensure Tasker sends an 'off' intent on completion; the function must map 'off' → false
|
Advanced: Bi-Directional State Feedback and Latching
For installations that require the LOGO! to know the actual state of each output (useful when the output is wired to a latching contactor), publish the read-back Q0.0..Q0.2 bytes to MQTT in a 2-second cycle. The state can then be consumed by Home Assistant, a Node-RED dashboard, or a Tasker variable.
To implement a software latch in the LOGO!, use the SR (Set/Reset) flip-flop block (B03 in LSC) with the M-flag as the Set input and a separate "release" flag as the Reset input. This pattern is preferred over relying on Node-RED to maintain the ON state across reboots of the Node-RED host — the LOGO! remains the authority even if Node-RED restarts.
Security and Hardening Notes
The 0BA8 S7 server does not support TLS or user authentication. Restrict S7 access at the network layer:
- Place the LOGO! on an isolated VLAN with the Node-RED host and any other authorized clients only.
- Disable the LOGO!'s web server and remote S7 access from the WAN side of any router.
- Configure the LOGO!'s built-in firewall (Tools → Security → Firewall) to block all inbound connections not originating from the Node-RED host's IP.
- If exposing Node-RED via MQTT to the internet (for Tasker from outside the LAN), require TLS and a username/password on the broker, and never expose the LOGO! S7 port (102/TCP) to the internet.
Reference Field-Tested Patterns
For projects that go beyond three outputs, the same OR-block pattern scales: a single MB0 byte gives eight M-flag command channels, mapped to M0.0..M0.7 in S7, corresponding to LOGO! M1..M8. For voice pipelines that need natural-language mapping ("turn on the kitchen lights"), add a Node-RED function node with a synonym dictionary before the s7-out node. The function translates textual intents into the appropriate M-flag write.
Industrial practitioners integrating LOGO! 8 with higher-level systems such as MQTT brokers, Node-RED dashboards, or third-party SCADA packages should always model the LOGO! as a "command-receiving actuator" and never as a "directly writeable output". The OR-block + flag-bit pattern is the only architecturally sound way to achieve external control without breaking the PLC program's logic authority.
Why does writing to Q0.0 from Node-RED not change my LOGO! 8 output?
The LOGO! 0BA8 executes its user program cyclically and owns the left side of every Q coil. Any S7 write to a Q bit is overwritten within one cycle. Insert an OR block in LOGO!Soft Comfort that combines the original logic with an M-flag or V-bit (network input), and have Node-RED write to that flag instead of directly to Q.
What TSAP should I use to connect Node-RED to a LOGO! 8?
Use Local TSAP 01.00 on the Node-RED s7 endpoint and Remote TSAP 02.00 for the LOGO! 0BA8 default S7 server. If you defined additional server connections in LOGO!Soft Comfort under Tools → Ethernet Connections, use the matching remote TSAP (03.00, 04.00, etc.).
Should I use M flags or V (network input) bits for external commands?
Use V bits (NI1..NI64 in LOGO! notation, mapped to V0.0..V7.7 in S7) whenever possible. V bits are explicitly designed for S7-to-LOGO! writes, are not accidentally overwritten by the local program, and produce clearer LSC diagrams. Use M flags only when you need a memory cell that the LOGO! program also manipulates internally.
How many flags and network variables does the LOGO! 8 expose via S7?
The 0BA8 base unit exposes 64 M flags (M1..M64, mapped to M0.0..M7.7), 64 network inputs (NI1..NI64, V0.0..V7.7), 64 network outputs (NQ1..NQ64, V8.0..V15.7), and 8/20 digital outputs (Q1..Q8/Q20, Q0.0..Q2.3) depending on the hardware variant. See the LOGO! 0BA8 System Manual in Siemens Industry Online Support for the exact mapping per article number.
Can I read the actual output state from Node-RED to confirm a write worked?
Yes. Add a read item at address Q0.0 (for Q1) on the s7-in node and log the value to a debug node. After writing M0.0=true, the read-back Q0.0 should be true. If the read shows the old value, the OR block in LOGO!Soft Comfort is not wired correctly and the program is not listening to the M-flag.
Does the LOGO! 0BA8 support authentication or encryption on the S7 connection?
No. The 0BA8 S7 server uses plain ISO-on-TCP on port 102 with no authentication, integrity, or confidentiality. Restrict access with VLANs, firewall rules, and a dedicated management subnet. For encrypted transport, terminate S7 inside a VPN or tunnel the LOGO! connection through a protocol gateway.