Scaling Analog Inputs on Siemens LOGO! 8: Division and Percentage Calculation
Siemens LOGO! 8 controllers (6ED1052-xxx08-0BA1 / 0BA2 / 0BA3 / 0BA4 hardware generations) provide an integrated analog signal chain built around two cooperating function blocks: the Analog Amplifier (block B036) and the Math Instruction (block B037). Both blocks are visible in the LOGO! Soft Comfort programming tree under Special Functions > Analog. The challenge most integrators encounter is that the numeric output of an Analog Amplifier cannot simply be wired to the operator input of a Math Instruction block in older LOGO! 8 firmware (≤ FS08). On 0BA8 base modules with firmware < V8.3, the connection types look superficially identical (a small arrow icon at the block terminal) but the block-to-block reference is not active until the correct reference attribute is enabled in the block properties dialog. This article walks through the full procedure: scaling a non-standard 2 V to 8 V potentiometer sweep into a 0-100 % value, and dividing two live analog signals using the LOGO! 8 reference mechanism rather than a temporary marker word.
1. Problem Definition
A linear 10 kΩ potentiometer wired between +10 V (AI1) and 0 V (M) on a LOGO! 8 base module normally returns 0-10 V across its wiper. When the knob is mechanically limited, the wiper may only sweep 2 V to 8 V, but the LOGO! 8 analog-to-digital converter still reports the full 0-10 V engineering range. The required conversion is:
percent = (V_actual - V_min) / (V_max - V_min) × 100
Using two Analog Amplifier blocks you can obtain V_actual - V_min (numerator) and V_max - V_min (denominator), but the controller must then perform a true division and a multiplication. Both operands are dynamic, so a fixed scaling factor inside the Analog Amplifier cannot solve the problem.
1.1 Why the Math Instruction Does Not "See" the Analog Amplifier Output
Internally, every LOGO! 8 function block exposes its result through one of three mechanisms:
| Mechanism | Block Examples | Accepts as Operator Input |
|---|---|---|
| Digital coil output (1 bit) | AND, OR, Counter, On-Delay | Yes — wired directly with a line |
| Marker word (16/32 bit analog) | Math Instruction, PI Controller, Analog Multiplexer, PWM | Yes — wired via a reference |
| Internal numeric result, not exposed | Analog Amplifier, Analog Filter, Average | Only via Reference; not a marker |
The Analog Amplifier (B036) is a result-producing block, but its output is exposed as a block reference, not as a standard analog marker. In LOGO! Soft Comfort V8.0 through V8.2, the wiring arrow at the operator input of a downstream block must be configured with the specific block number of the upstream block — this is what the Siemens FAQ entry "How can you configure references between blocks in LOGO! 8?" documents.
2. Prerequisites
- Siemens LOGO! 8 base module (order number 6ED1052-1MD00-0BA8 or later generation).
- LOGO! Soft Comfort V8.3 or newer (recommended). Earlier versions up to V8.2 also work but require the manual reference dialog described in §4.
- DM8 or AM2 expansion module if more than four analog inputs are needed (LOGO! 8 base provides AI1-AI4 = inputs I1-I7, I2-I8, I7-I17, I8-I18 with optional 0-10 V / 0/4-20 mA jumper settings).
- Potentiometer 1 kΩ to 10 kΩ connected between the +10 V sensor supply and M (LOGO! base supplies 10 V DC / 30 mA at terminal
U+, more than enough for a 10 kΩ pot). - Program with at least two Analog Amplifier blocks (B036) and one Math Instruction (B037).
U+) is rated at 30 mA. A 1 kΩ pot draws 10 mA, a 10 kΩ pot only 1 mA. Stay above 1 kΩ to keep the supply stable. If you need 4-20 mA inputs, switch the base to current mode via the on-board DIP switch and use the 0/4-20 mA input range (0 to 1000 raw counts in the Analog Amplifier).
3. Architecture of the Scaling Program
The required program consists of four function blocks. The block numbers are for clarity — LOGO! Soft Comfort auto-assigns them, but the order shown keeps the reference paths short.
3.1 Block-by-Block Description
B01 — Analog Amplifier (sensor amplifier). Gain = 1, Offset = 0, sensor type = 0-10 V (Type 0 in the LOGO! Soft Comfort parameter table). Output range is 0 to 1000 raw. This block normalises the input; the resulting engineering value is the true voltage in 0.01 V units when Type 0 is selected, because LOGO! 8 maps 0-10 V linearly to 0-1000. For example, 5 V becomes 500.
B02 — Analog Amplifier (subtract V_min). Gain = 1, Offset = 0, but configured as Subtraction in the block properties: operator input A = AI1, operator input B = constant 200. The output is therefore V_actual − 200 (i.e. V − V_min). This is the numerator.
B03 — Constant 200 (V_min raw count). 2 V on a 0-10 V input is 200/1000. Encoded in a Constant block or a digital potentiometer with marker block.
B04 — Constant 600 (V_max raw count). 8 V → 600/1000. The denominator is 600, the numerator is V_actual − 200.
B05 — Math Instruction (B037). Operator input V1 receives a reference to the output of B02, operator input V2 receives a reference to the output of B04, and the formula is:
Y = (V1 / V2) × 100 + Offset
with Priority = High, Gain = 1, Offset = 0. The result Y is the scaled percentage in 0-1000 engineering units and can be routed to the analog output AQ1 (if a 0-10 V AM2 AQ module is present) or to a network analog flag for an HMI.
4. Configuring Block-to-Block References
Two methods exist for wiring a Math Instruction to an Analog Amplifier output.
4.1 Method A — Drag-and-Drop Reference (LOGO! Soft Comfort V8.3+)
- Place the Analog Amplifier (B02) on the schematic first and confirm its block number in the tooltips.
- Place the Math Instruction (B05). Click the orange connector tab at the V1 operator input.
- From the drop-down list choose Reference > Block Output > B02. The connector label changes to
RefB02. - Repeat for V2: choose Reference > Block Output > B04.
- Compile the program. The status bar should show no errors.
4.2 Method B — Manual Reference Dialog (V8.0 to V8.2)
- Right-click the operator input of the Math Instruction.
- Select Properties > Reference.
- In the dialog, set Reference type =
BQ(block output) and enter the upstream block number, e.g.02. - Click Apply and close the dialog. The connector should now show a yellow dot indicating an active reference.
5. Parameter Reference Table
LOGO! Soft Comfort exposes the following user-relevant parameters on the three blocks used in this scaling application.
| Block | Parameter | Setting | Effect |
|---|---|---|---|
| B01 Analog Amplifier | Sensor Type | 0 = 0-10 V | Raw counts 0-1000 mapped to 0-10 V |
| B01 | Gain | 1.00 | Linear pass-through |
| B01 | Offset | 0 | No DC shift |
| B02 Analog Amplifier | Mode | Subtract | A − B operator |
| B02 | Sensor A Type | 0 = 0-10 V | AI1 mapped 0-1000 |
| B02 | Sensor B Type | 11 = Marker (constant) | Use Offset field for static 200 |
| B02 | Offset | 200 | Subtracts 200 raw counts (2.00 V) |
| B03 Constant | Value | 200 | Numerator zero point |
| B04 Constant | Value | 600 | Denominator (span) |
| B05 Math Instruction | Operator | V1 / V2 × Gain + Offset | Division with scaling |
| B05 | Gain | 1.00 (numerator) / 1.00 (denominator) | Pre-scale before division |
| B05 | Offset | 0 | No post-shift |
| B05 | Priority | High | 4 ms cycle, suitable for fast position feedback |
6. End-to-End Commissioning Procedure
-
Wire the potentiometer. Connect the wiper to AI1, the top of the track to terminal
U+(+10 V sensor supply), and the bottom of the track toM. Verify with a multimeter that the wiper produces 2.00 V at the minimum mechanical position and 8.00 V at the maximum. - Configure AI1 mode. On LOGO! 8 base modules set the on-board jumper for AI1 to Voltage. The input is interpreted as 0-10 V by default; no parameter is required.
- Create the program. Insert B01-B05 as described in §3. Compile.
- Online test. Connect via Ethernet (the base module has an integrated RJ45 port; default IP 192.168.0.10, subnet 255.255.255.0). In LOGO! Soft Comfort press Tools > Online > Start Online Test.
- Observe the diagnostic view. Right-click B05 and select Monitor. The output field should read 0 when the pot is at the 2 V stop and 1000 (i.e. 100.0 %) when the pot is at the 8 V stop. Mid-position (5 V) must read approximately 500.
- Verify the AQ1 output. With an AM2 output module, AQ1 will now drive 0-10 V proportional to 0-100 %. Connect a 24 V powered actuator or a 4-20 mA converter (e.g. Siemens 6EP1332) and confirm mechanical motion across the full sweep.
- Save the project to the LOGO! display. Drag the project from the PC into the LOGO! using Tools > Transfer > PC → LOGO!. Cycle power once to confirm the program boots cleanly from flash.
6.1 Verification Checklist
| Test | Expected Result | Pass Criterion |
|---|---|---|
| Pot at 2.00 V mechanical stop | B05 output = 0 ± 2 | Within ±0.2 % |
| Pot at 5.00 V midpoint | B05 output = 500 ± 2 | Within ±0.2 % |
| Pot at 8.00 V mechanical stop | B05 output = 1000 ± 2 | Within ±0.2 % |
| Pot wire break (input falls to 0 V) | B05 output = −333 (clamped to 0 by saturation) | Output saturates low without wrap-around |
| Cycle time in monitor | < 10 ms with Priority=High | Stable reading without flicker |
7. Alternative Implementation: Two-Stage Scaling Without Division
Some legacy projects need to avoid the Math Instruction entirely — for example on LOGO! 6 (0BA6) hardware that does not have block references. The alternative is to pre-bias the analog input with an external resistor network so that the Analog Amplifier sees 0 V at the low end and 6.00 V at the high end, then simply multiply by 16.67 inside a single Math Instruction:
Y = V_input × 1.667 × 10
Gain 1.667, offset 0, then ×10 inside the Math Instruction. This works but requires hardware modification and is not recommended for new installations.
7.1 When to Use the Analog Multiplexer Instead
If the controller must switch between two scaling laws (e.g. calibration mode vs. run mode), use the Analog Multiplexer (B037 in older firmware revisions) in front of the Math Instruction. The multiplexer acts as a 4-to-1 analog selector; the selector input is a digital marker that chooses between V1 and V2 inputs. The Math Instruction downstream sees only one operand, eliminating the per-channel reference wiring.
8. Troubleshooting Matrix
| Symptom | Most Likely Root Cause | Corrective Action |
|---|---|---|
| Math Instruction always shows 0 | Block reference not compiled; connector shows hollow outline | Recompile, re-assign the reference, then re-transfer to LOGO! |
| Output freezes at 32767 | Overflow — denominator became zero or negative | Clamp V_min with an On-Delay or use the Min/Max instruction to detect this condition |
| Output drifts by ±5 counts at standstill | Pot wiper noise or insufficient filtering | Insert an Analog Filter (B034) block before the amplifier with a time constant of 200 ms |
| Output is correct on bench but reversed in the field | Pot wiring inverted (U+ and M swapped) | Swap the U+ and M wires; the input is differential so this does not damage the module |
| Output reads negative percentage | V_actual < V_min — operator is below the calibrated zero | Add an Analog Threshold Trigger (B037 variant or B028) that latches the output to 0 % below 2 V |
| Cycle time exceeds 50 ms | Too many Math Instructions in series (more than 4) | Reduce scan load by using the Basic Mathematic Instruction (B030) with constant 100 as a pre-multiplier |
| Programming software reports "Reference invalid" | Firmware mismatch between PC project and base module | Upgrade base to firmware 8.3.x or downgrade project to match the on-board firmware |
9. Safety and EMC Considerations
Analog signal quality directly affects the percentage calculation. Two field-proven practices apply:
- Use shielded twisted pair (e.g. LiYCY 2 × 0.34 mm²) for the potentiometer wiring. Ground the shield at the cabinet entry only; leave the pot end floating to avoid ground loops. This typically reduces 50 Hz mains pickup from 30 mV peak to 3 mV peak, which is 0.03 % of full scale — well within the 0.2 % target accuracy.
- Add an input fuse. The AI1 input is protected internally to ±24 V, but an external 100 mA PTC fuse (e.g. Wickmann 1812L100) prevents field wiring mistakes from destroying the base module.
10. Firmware Compatibility Notes
The block-to-block reference feature was introduced in LOGO! Soft Comfort V8.0 (released 2014) and is present in every subsequent release. The on-board firmware requirement is:
| Base Module | MLFB | Min Firmware for References |
|---|---|---|
| LOGO! 8 0BA8 Standard | 6ED1052-1MD00-0BA8 | FS08 (V1.08.0) |
| LOGO! 8.1 0BA8 Standard | 6ED1052-1MD00-0BA8 + upgrade | FS08 |
| LOGO! 8.2 0BA8 Standard | 6ED1052-1MD00-0BA8 + upgrade | FS08 |
| LOGO! 8.3 0BA8 Standard | 6ED1052-1MD00-0BA8 + upgrade | FS08 |
| LOGO! 8 0BA7 (LOGO! 7) | 6ED1052-1MD00-0BA7 | Not supported — use analog flag |
| LOGO! 8 0BA6 (LOGO! 6) | 6ED1052-1MD00-0BA6 | Not supported |
To check the firmware on a connected device, open LOGO! Soft Comfort, select Online > Identify LOGO! and read the Device info panel.
11. Quick-Reference Wiring Diagram
12. Frequently Asked Questions
Why does the Math Instruction show a red exclamation mark on the operator input?
The operator input is not connected. In LOGO! Soft Comfort, open the Math Instruction properties and assign either a digital marker (Boolean enable) or an analog block reference at the V1, V2, and V3 inputs. The block will compile and run once every input has a valid source.
Can I divide by a live variable without using two Analog Amplifier blocks?
Yes. Use the Math Instruction (B037) with V1 connected to a reference of the first Analog Amplifier, and V2 connected to a reference of a second Analog Amplifier. The Math Instruction performs the live division in a single 4 ms cycle when the block priority is set to High.
What is the resolution of the LOGO! 8 analog input?
The integrated AI1-AI4 inputs are 10-bit converters, giving 1024 counts (0-1000 displayed). With the 0-10 V range, 1 count equals 9.77 mV. For higher resolution use an AM2 module, which provides 12-bit conversion over 0-10 V or 0/4-20 mA (0-1000 scaled engineering units).
How do I get a 0-100 % value out of the controller to an HMI?
Route the Math Instruction output to a network analog flag (NAI or NAQ in LOGO! 8) and expose it via the built-in web server or a Modbus TCP register. The value 0-1000 can be rescaled in the HMI by dividing by 10 to obtain 0.0-100.0 %.
Does the Analog Amplifier block work on LOGO! 7 (0BA7) hardware?
No. The Analog Amplifier (B036) and block-to-block reference feature were introduced with LOGO! 8 (0BA8). On 0BA7 use the older Analog Flag indirect addressing through a marker word, or upgrade the base module to 0BA8.