Configuring a LOGO! 0BA6 Analog Ramp with Deadband and Polarity Reversal for a Hydraulic Proportional Valve
This technical reference describes how to program a Siemens LOGO! 0BA6 (part number 6ED1052-1CC00-0BA6 in the LOGO! 24 variant) to drive a single-solenoid dual-direction hydraulic proportional valve from a 0–10 V command signal. The application requires:
- A 0–10 V analog command.
- A 2.5 V deadband (5 V midpoint on a 0–10 V scale, i.e. 500 on the LOGO! internal 0–1000 normalized scale) below which the valve is closed and the output is zero.
- A 0–10 V analog output in both directions of travel, produced from a unipolar analog output module and a polarity-reversing relay contactor outside the LOGO!.
- A digital output that energizes the changeover contactor only when the command is in the reverse half-plane (5–0 V), and only after the analog output has been driven to zero, to prevent shoot-through of the polarity contactor.
- A configurable ramp time on the analog output, so the hydraulic actuator accelerates and decelerates smoothly.
The architecture is implemented with the LOGO! base module's built-in analog inputs, the Analog Ramp special function (B341), an Analog Amplifier (B112), two Analog Threshold Triggers (B009) and a pair of Analog Comparators (B014) for direction detection and zero-output confirmation. The polarity relay is driven through a standard digital output with an AND-gated interlock to prevent changeover while the ramped output is non-zero.
1. Required Hardware
| Item | Specification | Notes |
|---|---|---|
| LOGO! base module | 6ED1052-1CC00-0BA6 (LOGO! 24, 8 DI/4 DO, 200 blocks) | Has 4 onboard analog inputs (AI1–AI4 on I7/I8) |
| Analog output module | LOGO! AM2 (6ED1055-1MM00-0BA6) or AM2 AQ (6ED1055-1MD00-0BA6) | Provides 0–10 V or 4–20 mA output; the AQ variant supports voltage output |
| Polarity contactor | 24 V DC coil, 2-pole changeover, ≥10 A contact rating | Mechanical interlock or cross-wired auxiliary contacts recommended |
| Proportional valve | Single-solenoid, dual-direction, 0–10 V command | Verify minimum dither; consult the valve datasheet |
| Power supply | 24 V DC, ≥2.5 A | Size for LOGO! + analog module + contactor + valve command |
The base 0BA6 module is sufficient for a 200-block program; the LOGO! 0BA7 (6ED1052-1CC01-0BA6) adds Ethernet and is recommended if remote HMI or Modbus TCP integration is required. See the LOGO! 0BA7 System Manual for details.
2. Prerequisites
- Install LOGO!Soft Comfort version 8.0 or later on a Windows PC. Earlier LOGO!Soft Comfort V6.x does not recognize B341 on 0BA6 firmware.
- Update the LOGO! base module firmware to the latest 0BA6 release (ES 9 or later as of this writing). The minimum firmware that supports the B341 ramp is ES 5; later revisions add ramp hold and level parameter options used in this article.
- Confirm that the analog command source is a true 0–10 V signal with <50 mV noise. The LOGO! AI has a 10-bit converter (0–1000 normalized = 0–10 V), so 1 LSB ≈ 9.8 mV. A potentiometer wiper with a 5 kΩ source impedance and a 4.7 µF filter capacitor is recommended.
- Wire the analog output module's AQ channel to the polarity contactor's common pole; wire the two contactor throws to the valve's "+" and "–" command inputs.
- Verify that the LOGO! AI terminal is configured as analog in the program (the 0BA6 auto-detects analog usage on I7/I8 if it appears as an analog input block in the program). When I7 is used as an analog input, it cannot simultaneously be used as a digital input.
3. Signal Flow Architecture
The complete signal flow is:
The forward (5–10 V) and reverse (5–0 V) halves of the command produce a 0–10 V ramped output on the same analog channel. The digital output Q1 drives the changeover contactor and is only allowed to release or engage when the ramped analog output is below a small threshold (typically 20 on the 0–1000 scale ≈ 0.2 V). This guarantees that the polarity reversal cannot occur while current is flowing through the valve, eliminating inrush transients on the contactor and reverse EMF on the analog output amplifier.
4. Step-by-Step Implementation in LOGO!Soft Comfort
4.1 Input scaling and deadband (B112 + B009)
The 0BA6 base module presents analog inputs on I7 and I8 as a value from 0 to 1000 (normalized). For this application the command is divided into two halves around the midpoint of 500:
| Command (V) | AI1 normalized | Desired direction | Desired |valve| (normalized) |
|---|---|---|---|
| 0.0 | 0 | Reverse | 1000 (full reverse) |
| 2.5 | 250 | Reverse | 500 |
| 4.9 | 490 | Reverse | 20 (≈ closed) |
| 5.0 | 500 | Neutral | 0 |
| 5.1 | 510 | Forward | 20 (≈ closed) |
| 7.5 | 750 | Forward | 500 |
| 10.0 | 1000 | Forward | 1000 (full forward) |
Insert an Analog Amplifier (B112) with Gain = 2 and Offset = –1000, then an Analog Threshold Trigger (B009) at threshold 0 with hysteresis +20 to clip negative values to 0. This produces the magnitude signal M.
For a piecewise expression the equivalent code is:
M = max(0, |(2 × AI1) – 1000|)
M is clamped to 0..1000
The Analog Amplifier in LOGO!Soft Comfort is configured as follows:
| Parameter | Value | Meaning |
|---|---|---|
| Sensor | 0–10 V | Matches the AI hardware range |
| Gain | 2.00 | 1000/500 doubling of the half-range |
| Offset | –1000 | Shifts the midpoint to zero |
| Output range | 0–1000 | Magnitude presented to the ramp |
4.2 Direction detection (B014)
Insert an Analog Comparator (B014) with reference value = 500, hysteresis = ±20. The comparator output is logic 1 when AI1 > 520 (forward) and 0 when AI1 < 480 (reverse). In the deadband 480–520 the comparator holds its previous state, which prevents dithering at the contactor.
| AI1 (V) | AI1 (norm.) | Comparator Q (DIR_FWD) |
|---|---|---|
| 0.0 – 4.79 | 0 – 479 | 0 (reverse) |
| 4.80 – 5.19 | 480 – 519 | holds last |
| 5.20 – 10.0 | 520 – 1000 | 1 (forward) |
The DIR_FWD bit is used to (a) drive the polarity contactor through the interlock, and (b) optionally invert the analog output if the valve's polarity convention differs from the application.
4.3 Analog ramp (B341)
Insert the Analog Ramp (B341) block. Connect the magnitude M to its input. The ramp output drives the analog output channel of the AM2 AQ module.
| Parameter | Value (typical) | Effect |
|---|---|---|
| Ramp up time | 2.0 s | Time to go from 0 to 1000 (0 to 10 V) |
| Ramp down time | 2.0 s | Time to go from 1000 to 0 (10 V to 0 V) |
| Start value | 0 | Initial output on power-up |
| Stop value | 0 | Output on STOP transition |
| Hold behaviour | "Retain at last value" on RUN→STOP | Prevents sudden re-stroke on power cycle |
| Resolution | 1000 steps (10-bit) | Matches AQ resolution |
Internal update time of the B341 block on a 0BA6 is 50 ms; the ramp slope therefore has a minimum usable resolution of 1 LSB per 50 ms = 20 LSB/s. For very long ramps (>100 s) the resolution is acceptable; for very short ramps (<100 ms) the discrete step character of the ramp is visible and a dedicated PWM block (B103) on a faster controller should be considered.
4.4 Polarity interlock
The contactor is driven by Q1. To prevent the polarity from switching while the ramped output is non-zero, gate Q1 through an AND that requires both:
- DIR_FWD = 0 (reverse command is active), AND
- The ramped output AQ < 20 (a "valve is at zero" flag).
The second condition is implemented with another Analog Threshold Trigger (B009) with threshold = 20 (gain 1, offset 0), hysteresis = +10, and its Q output inverted (passing through a NOT B003) so the AND is enabled when AQ ≤ 20.
ZERO_OK = NOT (AQ > 20)
DIR_REV = NOT (DIR_FWD) ; B003 inverter
Q1 = ZERO_OK AND DIR_REV
This means the contactor can only release or re-engage when the ramped analog value has reached (or is below) 0.2 V. In practice the LOGO! will sequence a direction reversal as follows:
4.5 Hold/latch logic for command at zero
The user reported that, in simulation, the contactor "switches off" when the command goes to zero and will not reset until the command rises to 500 again. This is the expected behaviour of a polarity reverser: when the command is exactly at zero (which is, on the normalized scale, also the deadband edge), the comparator output is undefined and the contactor may toggle. The fix is to add an explicit neutral latch:
NEUTRAL = (AI1 > 480) AND (AI1 < 520) ; B014 plus B009 combined with B001 AND
DIR_FWD_HOLD = Latch(B034) of NEUTRAL on rising edge of AI1 > 520
DIR_REV_HOLD = Latch(B034) of NEUTRAL on rising edge of AI1 < 480
Use a Latching Relay (B012) keyed on the comparator state, with the latch reset by an explicit Off-Delay (B022) of 250 ms so the polarity output does not chatter against a noisy command near 5 V.
5. Block-by-Block Parameter Table
| # | Block | Type | Parameters | Purpose |
|---|---|---|---|---|
| 1 | B112 | Analog Amplifier | Sensor 0–10V, Gain 2.0, Offset –1000, Range 0–1000 | Centres the command on 5V; produces magnitude |AI1–500|×2 |
| 2 | B009 #1 | Analog Threshold Trigger | On = 510, Off = 490, Gain 1, Output AQ | Forward direction flag (DIR_FWD) |
| 3 | B009 #2 | Analog Threshold Trigger | On = 490, Off = 510, Gain 1, Output AQ | Reverse direction flag (DIR_REV) |
| 4 | B014 | Analog Comparator | Ref = 500, Hys = ±20 | Decision at the deadband edge |
| 5 | B001 | AND | Inputs: DIR_REV, ZERO_OK | Polarity interlock |
| 6 | B003 | NOT | Input: ZERO_OK | Enables Q1 only when AQ < 20 |
| 7 | B341 | Analog Ramp | Up 2.0s, Down 2.0s, Start 0, Stop 0 | Smooths analog output |
| 8 | B009 #3 | Analog Threshold Trigger | On = 20, Off = 10, Gain 1 | Confirms the ramped output is at zero |
| 9 | B012 | Latching Relay | Set: NEUTRAL pulse, Reset: end-of-stop | Freezes contactor state inside the deadband |
| 10 | B022 | Off-Delay | Time = 0.25s | Debounce direction transitions |
| 11 | Q1 | Digital Output | — | Drives the changeover contactor coil |
| 12 | AQ1 | Analog Output | 0–10V, sourced from B341 output | Drives the valve command |
6. Wiring
Use shielded twisted pair for the analog command and the AQ output; ground the shield at the panel side only. The contactor coil must be fitted with a free-wheeling diode (e.g. 1N4007) directly across the coil, reverse-biased. If the valve has its own command common, bond it to the LOGO! 24V common at a single star point.
7. Verification and Commissioning
- Power up the LOGO! and verify that the program is in RUN. Press ESC on the LOGO! display to confirm there are no open blocks.
- Apply 0.0 V, 2.5 V, 5.0 V, 7.5 V, 10.0 V to AI1 in turn. Record the AQ value at each step. Expected AQ values: 0, 0, 0, 500, 1000 (using the mapping from §4.1).
- Verify the direction bit transitions:
- At 0.0 V: DIR_REV = 1, DIR_FWD = 0.
- At 5.0 V: both flags hold the previous state.
- At 10.0 V: DIR_FWD = 1, DIR_REV = 0.
- With the ramp set to 2 s, command a transition from 10 V to 0 V. Confirm with a voltmeter on AQ1 that the output ramps from 10 V to 0 V over 2.0 ± 0.1 s. Confirm that the contactor (Q1) opens after the AQ value falls below 0.2 V.
- Issue a fast command reversal: command 10 V → 0 V → 10 V. The contactor should chatter at most once per 250 ms (the off-delay), and never while AQ > 0.2 V.
- Cycle power 50 times. Confirm that the contactor remains de-energized while AQ is at 0 within 1 s of power-up.
8. Troubleshooting Matrix
| Symptom | Likely cause | Diagnostic | Remedy |
|---|---|---|---|
| AQ does not respond to AI1 changes | AI configured as digital input in the program | Inspect I7 wiring; check that AI1 is referenced as analog in the program | Re-wire or move AI1 to I8 (the 0BA6 has two analog-capable inputs) |
| LOGO! will not enter RUN | Open block (Q output not connected) | Press F2 in LOGO!Soft Comfort | Insert an Analog Flag (B034) at any unused analog output |
| Contactor chatters rapidly near 5 V | Comparator hysteresis too small, or off-delay missing | Monitor AI1 with a DMM; check the off-delay parameter | Increase B014 hysteresis to ±50, add B022 off-delay 250 ms |
| Contactor switches while AQ is high | ZERO_OK interlock missing or wired to wrong comparator | Watch AQ and Q1 with a scope | Add B009 threshold trigger at 20 with Q inverted through B003 |
| AQ jumps in 1 V steps | B341 update rate too slow for the chosen ramp time | Compute slope = range/time vs. 20 LSB/s floor | Lengthen ramp time to ≥ 50 ms × 1000 / range; or use B103 PWM on a faster controller |
| Output does not reset to 0 when command goes to 0 | Ramp latch retains last value on power-up | Check B341 start value parameter | Set start value = 0; verify STOP value = 0 |
| Valve does not respond to AQ | Contactor not energizing or contact welded | Measure contactor coil voltage; listen for click | Replace contactor; verify coil voltage is 24 V ±10% |
| Hunting oscillation around the deadband | AI noise on the command potentiometer | Scope AI1 to GND | Add 4.7 µF filter on AI1 to GND; use shielded cable |
9. Field-Proven Caveats
- Direction reversal at high output. Even with the ZERO_OK interlock, the contactor opening while AQ is at exactly 0 is not instantaneous. Most mechanical contactors take 8–15 ms to fully open. If the ramp is set to 100 ms the valve will see a small reverse command for a few milliseconds; this is normally acceptable, but for sub-50 ms ramps a solid-state relay (SSR) is recommended.
- Hydraulic dither. Proportional valves typically require a 100–200 Hz dither signal superimposed on the DC command. The LOGO! 0BA6 does not generate dither natively; if the valve requires it, use a dedicated dither board on the AM2 AQ output, or select a valve with on-board dither.
- Valve deadband. The 0.2 V threshold used for ZERO_OK must be set above the valve's own deadband (typically 5–10% of the rated signal) to avoid hunting the contactor against the valve's spool springs.
- Power-up sequencing. On cold start, the LOGO! asserts the B341 output to 0 within 50 ms of program start; combined with the 0.2 V threshold this is well within the contactor pickup time. A 0.5 s interlock after RUN is still recommended to ride out inrush of the LOGO! power supply.
- Block count budget. The 0BA6 supports 200 blocks; the program above uses 12. A 0BA7 also supports 400 blocks if additional features (text display, softkeys, network comms) are added.
10. Alternative Controllers
If the application requires faster ramps, on-board dither, or direct Ethernet commissioning, the following are drop-in alternatives to the 0BA6:
| Alternative | Advantage | Trade-off |
|---|---|---|
| LOGO! 0BA7 (6ED1052-1CC01-0BA6) | Ethernet, onboard web server, TDE display support | Slightly higher cost |
| S7-1200 + SM 1232 AQ | Faster scan (1 ms), direct PID blocks | Programming in TIA Portal; larger footprint |
| LOGO! 8.FS4 (6ED1052-2MD00-0BA6) with AM2 AQ | Same form factor, newer firmware, fast ramping | Verify B341 parameter mapping if migrating from 0BA6 |
11. Quick-Reference Checklist
- ☐ AI1 wired to I7, with 4.7 µF filter to GND
- ☐ AM2 AQ module on the right of the base; AQ1 address assigned in LOGO!Soft Comfort
- ☐ B112 gain = 2, offset = –1000, range 0–1000
- ☐ B014 comparator with hysteresis ±20 centred on 500
- ☐ B341 ramp with up/down times matching the hydraulic cycle time
- ☐ B009 zero-output threshold set to 20 with inverted output
- ☐ B012 latching relay with off-delay debounce
- ☐ Q1 wired through mechanical interlock contacts of K1 (safety)
- ☐ Press F2 in LOGO!Soft Comfort to clear all open blocks before download
Can a LOGO! 0BA6 produce a true 0–10 V analog output?
Yes, by adding an AM2 AQ (6ED1055-1MD00-0BA6) analog output module, which provides 0–10 V at 10-bit resolution (1 LSB = 9.8 mV) with a sourcing capability of 10 mA. The base module alone has no analog output.
What is the minimum LOGO! firmware for an analog ramp?
The Analog Ramp special function (B341) requires 0BA6 firmware at ES 5 or later. For full ramp-hold and stop-value behaviour described in this article, ES 7 or later is recommended. The latest firmware is published on the Siemens Industry Online Support portal.
How do I prevent the contactor from switching while the analog output is still ramping?
Insert an Analog Threshold Trigger (B009) with threshold 20 (≈ 0.2 V) on the ramped output, invert its Q through a NOT block (B003), and AND it with the direction flag. The contactor is then only allowed to change state when the ramped analog value is at zero.
Why does the analog output stay at zero when the command is at 0 V?
That is the correct deadband behaviour. With the gain 2 / offset –1000 mapping, a 0 V command corresponds to a magnitude of 1000 (full reverse), so the contactor will reverse polarity and the ramp will drive the output to 10 V. If you need true zero output at 0 V command, add a second deadband window (e.g. ±10 on the normalized scale) around the centrepoint of the magnitude so that 0–4.9 V and 5.1–10 V are both inactive, with a separate logic path for the reverse case.
Can I add a configurable ramp time without changing the program?
Yes. Connect a potentiometer to AI2 (I8) and route it through an Analog Amplifier (B112) with gain 0.1 (0–10 s range) into the ramp-up and ramp-down parameters of the B341 block (use the "Parameter View" of the block in LOGO!Soft Comfort). Note that 0BA6 does not allow run-time changes to the ramp parameters without a re-start; the values are written on each RUN transition.
My LOGO! will not enter RUN — what is the cause?
Open block detection: in LOGO!Soft Comfort, press F2 ("Determine LOGO!") to highlight blocks whose outputs are not wired. On the real controller, the RUN LED will blink to indicate the same fault. The most common cause is a numeric output or analog output flag not connected — place an Analog Flag (B034) at the unused output to resolve it.