1. Application Overview
The Siemens LOGO! 8 (0BA8) logic module with the LOGO! TDE (Text Display) is commonly deployed in lift stations, sewage sumps, and water reservoirs where a 4-20 mA hydrostatic level sensor must drive a two-pump alternating control. The field requirement discussed in the source exchange is straightforward: a single standard program must accept sensors of different physical ranges (0-4 m, 0-6 m, 0-10 m) and let the end customer re-range the analog input on-site through the TDE cursor keys, without a laptop running LOGO!Soft Comfort.
The native LOGO! Analog Amplifier block lets the engineer enter a hard-coded Min and Max for each scaling, but those values are baked into the program and cannot be re-assigned at runtime from the TDE. The supported path is therefore to expose the Analog Amplifier's Gain and Offset parameters (or, more flexibly, an Arithmetic block performing the scaling) as Variable Memory (VM) values that the TDE writes to via editable message text.
This article documents the hardware, scaling math, TDE menu configuration, pump alternation logic, commissioning procedure, and field verification for a standard, re-rangeable pump controller built on LOGO! 8 with a TDE.
2. Prerequisites and Hardware
| Item | Specification | Notes |
|---|---|---|
| LOGO! 8 base module | 6ED1052-1xxx08-0BA1 or higher FS | 0BA8 Standard; 0BA8.FS4 = LOGO! 8.3, 0BA8.FS5 = LOGO! 8.4 |
| LOGO! TDE | 6ED1055-4MH08-0BA1 | Backlit text display, 6 keys, Ethernet to base |
| Analog input module | LOGO! AM2 (6ED1055-1MA00-0BA2) or AM2 RTD | Provides AI1/AI2; configured for 4-20 mA mode |
| Hydrostatic sensor | 2-wire loop-powered, 4-20 mA output | Common ranges: 0-3 m, 0-4 m, 0-6 m, 0-10 m H2O |
| Power supply | 24 VDC, ≥ 1.5 A | Loop current + LOGO! + 2 pump contactor coils |
| Programming tool | LOGO!Soft Comfort V8.x (V8.4.1 or newer recommended) | Free download from Siemens Industry Online Support |
| Ethernet cable | Cat5e or better, ≤ 100 m | LOGO! TDE ↔ LOGO! base |
The 4-20 mA hydrostatic sensor must be wired so that 4 mA corresponds to the empty-tank (0 m head) and 20 mA to the maximum head. The parameter set in this article assumes a 2-wire loop-powered probe (e.g., Vega, Siemens SITRANS LH100, Endress+Hauser Waterpilot FMX21, IFM, or similar) drawing 3.6-22 mA over the 24 VDC loop.
3. LOGO! 4-20 mA Analog Input Wiring
For a 2-wire loop-powered 4-20 mA sensor to the LOGO! AM2 module:
Connect the sensor's red lead to the AM2 AI1+ terminal, and the sensor's black lead to the AM2 AI1- terminal. The AM2's onboard 24 V supply rail (terminals U+ and U-) can power the loop directly if the sensor's current draw does not exceed the AM2 budget. For higher-current sensors, use an external 24 VDC PSU and connect the sensor's loop return to the AM2 AI1- terminal.
For 3-wire sensors, supply 24 VDC to the sensor's power pins and route the 4-20 mA signal output to AM2 AI1+ with AI1- tied to the PSU 0 V common.
Configure the AM2 input type in LOGO!Soft Comfort: open the AM2 in the project tree, double-click, and select 4-20 mA for the channel. The internal scaling then maps 4 mA to 0 and 20 mA to 1000 in the raw analog value, which the Analog Amplifier and Arithmetic blocks then manipulate. Refer to the LOGO! 8 System Manual for the AM2 DIP switch and software configuration procedure.
4. Why Direct Min/Max Adjustment of the Analog Amplifier is Limited
The LOGO! Analog Amplifier (block B13) presents the following fixed parameters at programming time:
- Sensor: 0-10 V, 0-20 mA, 4-20 mA, PT100, PT1000, Ni1000
- Min/Max of the input raw value (clipping)
- Min/Max of the output (engineering range)
- Gain: multiplication factor
- Offset: additive offset
In LOGO!Soft Comfort V8.0 through V8.4.1, the Gain and Offset are constants. They are written into the program memory at download time and are not directly writable from the LOGO! display, the TDE, or any remote HMI. The only way to change Min/Max at runtime is via the PI Controller's Setpoint reference, which is not applicable here.
What can be made variable at runtime:
- The analog input itself (AI1-AI8) - read-only, comes from hardware
- Variable Memory (VM) words and bits - freely editable from the TDE
- Network inputs (NI) - editable from LOGO!'s internal HMI
- Setpoint parameters on specific blocks (PI Controller SP, Counter SV, etc.)
So the engineering solution is: route the raw 4-20 mA value to a VM word or directly into an Arithmetic block, and use VM words for the Gain/Offset constants. The TDE then edits the VM words through a Message Text block flagged as editable.
5. Analog Amplifier Block: Sensor, Min, Max, Gain, Offset Explained
The Analog Amplifier applies the following transformation:
Output = ( (Raw - SensorMin) / (SensorMax - SensorMin) ) × (OutMax - OutMin) + OutMin + Offset
With the LOGO! default of 4-20 mA sensor type, SensorMin=0 and SensorMax=1000, so the formula reduces to:
Output = (Raw / 1000) × (OutMax - OutMin) + OutMin + Offset
The internal raw value comes from the AM2 module. In 4-20 mA mode the LOGO! applies the live-zero shift: 4 mA = 0 and 20 mA = 1000. Below 4 mA (e.g., a broken loop) the raw value will be negative, and a properly configured Min parameter clamps the output to indicate a sensor fault.
For our three sensor ranges with output in cm:
| Sensor range | Raw span (4-20 mA) | Output range (cm) | Gain (Raw × Gain) | Offset |
|---|---|---|---|---|
| 0-4 m | 0-1000 | 0-400 | 0.4 | 0 |
| 0-6 m | 0-1000 | 0-600 | 0.6 | 0 |
| 0-10 m | 0-1000 | 0-1000 | 1.0 | 0 |
If the engineer prefers the output in millimetres (0-4000, 0-6000, 0-10000), multiply each Gain by 10. Note that LOGO! values are integer, so output resolution is 1 cm or 10 mm in this configuration.
6. Method 1: Adjustable Gain and Offset via TDE Cursor Keys
The most flexible approach is to bypass the Analog Amplifier's hard-coded Gain and Offset and do the scaling with an Arithmetic block driven by editable VM words.
Implementation steps in LOGO!Soft Comfort:
- Insert an Analog Amplifier (block B13). Set Sensor = 4-20 mA, leave Gain=1.0, Offset=0. The block output is the raw 0-1000 value.
- Insert an Arithmetic block (B15). Set Operator = ×, Priority = High. The A input is the raw analog value, the B input is the VM word containing the Gain.
- Insert a second Arithmetic block (B16) chained to the first, configured as + to add the Offset VM word.
- The output of the second Arithmetic block is the scaled engineering value (e.g., 0-400 cm for a 0-4 m sensor).
- The downstream comparator thresholds (pump start, pump stop) reference this scaled value.
TDE-editable VM mapping:
VW0 = Gain (default 1000; set to 400 / 600 / 1000 for 0.4 / 0.6 / 1.0)
VW2 = Offset (default 0; rarely needed for hydrostatic)
VW4 = Pump1_ON (cm)
VW6 = Pump1_OFF (cm)
VW8 = Pump2_ON (cm)
VW10 = Pump2_OFF (cm)
VW12 = Manual Gain display (read-only echo)
7. Method 2: Arithmetic Block with TDE-Selectable Constants
To avoid the floating-point limitation, the standard LOGO! pattern is to pre-scale Gain × 1000 inside the VM word and divide the result by 1000 using a second Arithmetic block.
// LOGO! 0BA8 internal representation
GainScaled = 400 // corresponds to 0.400 (cm/cm)
GainScaled = 600 // corresponds to 0.600
GainScaled = 1000 // corresponds to 1.000
ScaledLevel = (Raw * GainScaled) / 1000 // integer math
// Example: Raw=500, GainScaled=400
// 500 * 400 = 200000 / 1000 = 200 cm
Block sequence:
- Arithmetic 1:
A = Raw (0-1000), B = GainScaled (VW0), Operator = ×→ Intermediate = Raw × GainScaled - Arithmetic 2:
A = Intermediate, B = 1000, Operator = /→ Scaled level (cm) - The final Scaled level is 0-400, 0-600, or 0-1000 cm depending on which GainScaled value is active.
The integer range must be watched: Raw=1000, GainScaled=1000 → Intermediate = 1,000,000, which exceeds the 16-bit signed range (max 32,767). Use a 32-bit intermediate or limit GainScaled.
Solution: divide Raw by 10 first, or cap the maximum GainScaled. A practical compromise is to use GainScaled values of 40, 60, 100 and divide by 100:
// Practical integer-only scaling
GainScaled = 40 // 0.40 (cm/cm)
GainScaled = 60 // 0.60
GainScaled = 100 // 1.00
Step1 = Raw / 10 // 0-100
Step2 = Step1 × GainScaled // 0-100 × 100 = 10,000, fits in 16-bit
ScaledLevel = Step2 / 10 // 0-1000 cm
This three-Arithmetic-block sequence (divide by 10, multiply by GainScaled, divide by 10) keeps all intermediates within ±32,767 and yields the correct engineering range.
8. Scaling Calculations for 0-4 m, 0-6 m, and 0-10 m Sensors
Output units decision: choose centimeters for 0-4 m and 0-6 m ranges (sufficient resolution for 0.5 m hysteresis), and millimeters for 0-10 m if the application requires sub-decimeter accuracy. For pump control with 0.5 m hysteresis, centimeters are sufficient in all three cases.
Calculation table for output in centimeters:
| Sensor head range | 4 mA → Raw | 20 mA → Raw | GainScaled (×100) | Scaled output | Pump ON (50%) | Pump OFF (20%) |
|---|---|---|---|---|---|---|
| 0-4 m | 0 | 1000 | 40 | 0-400 cm | 200 cm | 80 cm |
| 0-6 m | 0 | 1000 | 60 | 0-600 cm | 300 cm | 120 cm |
| 0-10 m | 0 | 1000 | 100 | 0-1000 cm | 500 cm | 200 cm |
For the integer-scaling pipeline:
-
Step1 = Raw / 10(0 to 100) -
Step2 = Step1 × GainScaled(0 to 10,000) -
ScaledLevel = Step2 / 10(0 to 1000 cm)
The pump ON and OFF thresholds should also be stored in VM words and made editable on the TDE. The default values (50% and 20% of range) are a starting point; site-specific conditions (inflow rate, pump capacity, storage volume) usually require adjustment.
9. Configuring TDE Softkey and Cursor Key Selection
The TDE is connected via Ethernet to the LOGO! base. The Message Text block on the LOGO! side drives the TDE display. To make a value editable on the TDE, the engineer must check the Editable property on each VM word embedded in the Message Text.
Example Message Text (TDE display, three lines):
Sensor range select
> 0-4 m Gain = 0.40
0-6 m Gain = 0.60
0-10 m Gain = 1.00
Implementation:
- In LOGO!Soft Comfort, add a Message Text block (B16). Set Message = "Sensor range select".
- Add three Message Text lines, each with the corresponding Gain value (40, 60, or 100 as the GainScaled integer).
- Tick Editable on the Gain VM word (VW0).
- The TDE will show this message. The customer navigates with ▲▼ to highlight a line and presses OK to edit. The cursor moves to the Gain value, and ▲▼ increment/decrement by 1 (or by 10 if held). Press OK to save.
- Repeat for Offset (VW2), Pump1 ON/OFF (VW4, VW6), Pump2 ON/OFF (VW8, VW10), and an additional editable field for sensor type code (1, 2, or 3) used to choose among pre-stored start/stop levels.
Menu navigation on the TDE:
- Press ESC to enter the main menu.
- Use ▲▼ to highlight Sensor setup → press OK.
- The current Gain is shown. Press OK to edit, then ▲▼ to step the value, then OK to save or ESC to cancel.
- Use ▲▼ to step through Offset, Pump1 ON, Pump1 OFF, Pump2 ON, Pump2 OFF, returning to the home screen on the last ESC.
Refer to the LOGO! 8 System Manual for the keymap and menu hierarchy of the LOGO! TDE (6ED1055-4MH08-0BA1). The TDE is parameter-mirrored to the LOGO!'s onboard display, so edits appear in both places.
10. Alternating Two-Pump Control Program Structure
For two-pump alternation, use an SR (Set-Reset) latch with a priority that swaps on each cycle. The source exchange describes a hydrostatic sewage pump station, so the typical sequence is:
Logic:
- Pump1 ON: ScaledLevel > Pump1_ON (e.g., 200 cm for 0-4 m sensor)
- Pump1 OFF: ScaledLevel < Pump1_OFF (e.g., 80 cm)
- Pump2 ON: ScaledLevel > Pump2_ON
- Pump2 OFF: ScaledLevel < Pump2_OFF
- Alternation: A flip-flop toggles which pump is "lead" each time both are off and the level rises above Pump1_ON. The first pump to start is the lead pump; the other is the lag pump. The lag pump starts only if the lead pump cannot keep the level below Pump2_ON.
In LOGO!Soft Comfort:
- Use a hysteresis comparator (block B05) for Pump1_ON, Pump1_OFF, Pump2_ON, Pump2_OFF.
- Use an SR latch (block B01) for each pump output (Q1 and Q2).
- Use a counter or RS flip-flop to alternate the lead pump on every start cycle.
For sewage applications, include dry-running protection: a second analog input or a float switch must disable the pump output if the level falls below a critical minimum (e.g., 5 cm above the pump inlet).
11. Step-by-Step Commissioning
- Wire the sensor: connect the 4-20 mA hydrostatic probe to AM2 AI1+ and AI1- terminals. Power the loop from AM2 24 V or an external PSU.
- Configure AM2 input type: in LOGO!Soft Comfort, double-click the AM2 module, set channel 1 to 4-20 mA, channel 2 to 0-10 V (or disabled) as needed.
- Build the program: insert Analog Amplifier (raw), three Arithmetic blocks (divide-by-10, multiply-by-GainScaled, divide-by-10), four Hysteresis Comparators (Pump1_ON, Pump1_OFF, Pump2_ON, Pump2_OFF), two SR latches (Pump1, Pump2), and a Message Text block with editable Gain/Offset/threshold VM words.
- Download: connect the LOGO! base via Ethernet, click PC → LOGO!, transfer the program.
- Set the sensor range on the TDE: navigate to the Sensor setup message, edit the Gain value to 40 (for 0-4 m), 60 (for 0-6 m), or 100 (for 0-10 m).
- Adjust pump thresholds: edit Pump1_ON, Pump1_OFF, Pump2_ON, Pump2_OFF in the same menu.
- Calibrate zero: with the tank empty (or the sensor at its zero reference), confirm the raw value is 0. If the sensor has a slight negative offset, set the Offset VM word to compensate.
- Calibrate span: fill the tank to a known level (e.g., 50% of range) and read the ScaledLevel on the TDE. If it deviates, fine-tune the GainScaled by ±1 step.
- Test pump alternation: raise the level above Pump1_ON; verify only the lead pump starts. Lower the level below Pump1_OFF; verify the pump stops. Raise again; verify the lag pump starts. Lower below Pump2_OFF; verify both pumps stop. Repeat to confirm alternation.
- Document the values: record the final Gain, Offset, and threshold values on a label inside the panel door for future reference.
12. Verification Procedure
Functional checks before returning the panel to service:
| Test | Expected | Method |
|---|---|---|
| Sensor current at empty tank | 4.0 mA ± 0.1 | Clamp meter on loop |
| Sensor current at full tank | 20.0 mA ± 0.1 | Clamp meter at maximum level |
| Raw LOGO! value at empty | 0 ± 5 | TDE message "Raw AI1" |
| Raw LOGO! value at full | 1000 ± 5 | TDE message "Raw AI1" |
| Scaled level at 50% head | Sensor range × 0.5 ± 1 cm | TDE message "Level cm" |
| Pump1 starts at Pump1_ON | Output Q1 high | Indicator LED or multimeter on contactor coil |
| Pump1 stops at Pump1_OFF | Output Q1 low | Indicator LED |
| Pump2 starts at Pump2_ON | Output Q2 high | Indicator LED |
| Alternation | Lead pump swaps each cycle | Cycle twice, confirm opposite lead pump first |
| Dry-run protection | Both pumps off below min level | Drain below minimum, confirm outputs off |
13. Troubleshooting Matrix
| Symptom | Likely cause | Diagnostic step | Fix |
|---|---|---|---|
| Scaled level reads 0 with water in tank | Sensor wiring reversed (4 mA on AI1-) | Measure voltage across AI1+/AI1- | Swap sensor leads |
| Scaled level reads -1 or unstable negative | Loop current below 4 mA (broken loop) | Measure loop current with clamp meter | Repair cable, check sensor power |
| Scaled level pegs at maximum | Sensor shorted, current at 20+ mA | Measure current, check for water ingress | Replace sensor |
| Scaled level is half of expected | GainScaled is double the correct value | Check TDE GainScaled value | Halve GainScaled via TDE |
| Scaled level jumps in 2 cm steps | Integer scaling resolution | Verify divide-by-10 stage | Acceptable; or use 32-bit intermediate |
| Pump1 runs continuously | Pump1_OFF threshold set above current level | Compare threshold to current level on TDE | Edit Pump1_OFF via TDE |
| Pumps alternate but no lead change | Alternation counter not incrementing | Check counter input in monitor mode | Wire alternation counter to Pump1_OFF |
| TDE shows "—" instead of value | VM address conflict or program error | Check VM map in LOGO!Soft Comfort | Reassign VM words to non-overlapping addresses |
| Edits on TDE do not persist | Program re-downloaded after edit | Verify program is in RUN, not transfer mode | Re-enter edit, ensure OK to save |
| GainScaled value not editable | Editable property not ticked in Message Text | Open Message Text in LOGO!Soft Comfort | Tick Editable on the Gain word |
14. Notes on Hysteresis, Filter, and Dead Band
For sewage applications with frequent level changes, the analog filter time on the AM2 input should be set to a moderate value (default 50 ms is usually adequate). A long filter time smooths noise but introduces lag during rapid level changes. For a pump station with a 1-2 m tank and a 1-2 kW pump, the 50 ms filter is sufficient.
Hysteresis in the comparator blocks should be at least 0.5 m to prevent short-cycling. The dead band prevents the pump from starting and stopping within seconds when the level hovers near the threshold. For each of the three sensor ranges, the dead band in cm is:
| Sensor range | Pump1_ON (cm) | Pump1_OFF (cm) | Dead band (cm) |
|---|---|---|---|
| 0-4 m | 200 | 80 | 120 |
| 0-6 m | 300 | 120 | 180 |
| 0-10 m | 500 | 200 | 300 |
Adjust these defaults to match the actual inflow rate and pump capacity. The dead band should be at least 1.5 times the level change per pump cycle to prevent rapid cycling.
For the level sensor itself, check the manufacturer's specified accuracy, long-term stability, and temperature coefficient. Hydrostatic probes are sensitive to temperature changes in the water column; a 4 °C swing can shift the reading by 0.1-0.3% of full scale on uncompensated probes. For a 0-10 m sensor, this is 10-30 mm, which is acceptable for pump control.
For a software-level implementation, the dead band is set as the gap between ON and OFF comparator thresholds. In the Analog Threshold Trigger or Hysteresis Comparator blocks, configure the ON threshold via VM word VW4 and the OFF threshold via VM word VW6. Both should reference the scaled engineering value (cm) from the Arithmetic pipeline, not the raw 0-1000 value.
FAQ
Can the LOGO! Analog Amplifier's Min and Max be edited directly on the TDE?
No. The Min, Max, Gain, and Offset in the Analog Amplifier block are constants baked into the program. The only way to change scaling at runtime from the TDE is to drive the scaling math from VM words (e.g., via an Arithmetic block) and make those VM words editable on the TDE through a Message Text with the Editable property enabled.
What Gain value should I enter on the TDE for a 0-6 m sensor with output in cm?
Enter 60 if you use the GainScaled × 100 scheme. The pipeline divides the raw 0-1000 value by 10 (yielding 0-100), multiplies by 60 (yielding 0-6000), and divides by 10 (yielding 0-600 cm). The full formula is ScaledLevel = (Raw / 10) × GainScaled / 10, with GainScaled = 100 × gain.
How do I keep GainScaled and thresholds from being reset when I re-download the program?
LOGO! VM values are retained across power cycles but are reset when a new program is downloaded. To preserve field-tuned values across a re-download, write them down before downloading and re-enter them on the TDE after the new program is in RUN mode. Alternatively, use a Retain VM area (if supported in your LOGO! 8 firmware version) by marking the relevant VM addresses as retentive in the project setup.
Why does my LOGO! 0BA8 Analog Amplifier show a negative value when the sensor is disconnected?
A 4-20 mA input with the loop open reads below 4 mA. The LOGO! 0BA8 maps this to a negative raw value (down to -200 or lower depending on the fault current). The Analog Amplifier's Min parameter clamps the output, but if Min is set to 0, the output goes negative, which the comparator may interpret as "empty tank" instead of "sensor fault". Add a dedicated "Sensor fault" comparator that triggers if the raw value drops below 0 or rises above 1000.
Can I use the LOGO! 8 onboard display instead of the TDE for editing Gain and threshold values?
Yes, the LOGO! 8 onboard display and the TDE share the same menu. Any VM word made editable in a Message Text block is reachable from both. The TDE provides a larger 3-line display and is easier to use in a panel door, but the onboard display works for quick adjustments during commissioning.