I am looking to generate a two-level pulse as follows, where the adjustable parameters are \$V_1\$ and \$V_2\$ between 0 and ~5V, and \$t\$, ~5 to ~50 ms:

two-level pulse

The trigger pulse length may be anywhere from a few milliseconds to tens of seconds. If its duration is less than \$t\$, then the generated pulse should be \$t\$ long with amplitude \$V_1\$. \$V_1\$ is always greater than \$V_2\$.

Of course, it can be done using two resettable monostable multivibrators (one as a one-shot timer to generate the \$t\$-long pulse, and another to produce a second pulse, starting after the end of first and continuing until the trigger goes low), plus buffers to scale the outputs from each of these. However, by my reckoning, this requires at least a dual opamp and a dual timer IC such as a 74HCT123, plus two potentiometers, miscellaneous resistors, and a timing capacitor (and, ideally, some Zener diodes to make it independent of the power supply).

Can the same be achieved more simply (fewer components; no microcontrollers), while still accommodating the adjustment of the three parameters? I don't think so, but I would be happy to be surprised.

  • \$\begingroup\$ Welp, I was gonna say an MCU and a 2-bit DAC, but I noticed the variable V1/V2 requirements. Hmm... why are you opposed to a microcontroller? \$\endgroup\$
    – uint128_t
    Commented Jun 17, 2016 at 1:53
  • \$\begingroup\$ What are the minimum and maximum values of t? \$\endgroup\$
    – The Photon
    Commented Jun 17, 2016 at 2:31
  • \$\begingroup\$ I'd like to point out that you are trying to generate a 3-level pulse, not a 2-level pulse. That distinction may help you find an approach (frequently used in Ultrasound I might add) for making multi level pulses \$\endgroup\$ Commented Jun 17, 2016 at 4:37
  • \$\begingroup\$ Looks like a pulse you'd want to switch a relay with moderate power consumption. If the aim is something like that, it's easy: a resistor in parallel with a capacitor. Is it something like that you want to do ? \$\endgroup\$
    – dim
    Commented Jun 17, 2016 at 5:16
  • \$\begingroup\$ @dim this is a current control signal for driving a solenoid. The R||C approach was the first thing I tried but doesn't work well because the solenoid has a large amount of travel (and a very weak force initially because the bolt is far out of the core), so needs a longer and larger initial push than one can get with any reasonable capacitor value. (Rise of inductance as the bolt enters the core may also contribute to its lack of success.) The current source circuit looks like this. Thanks for your answer; it's very helpful. \$\endgroup\$ Commented Jun 17, 2016 at 9:57

4 Answers 4


We don't really know what is after and what is before the circuit you request, so we can't simplify things as much as we want to. So I made assumptions:

  • I made the assumption the polarity of the input signal could be changed. So it accepts an input that is high-level (5V) when inactive, and 0V when active. If this is not possible, you can put an inverter before (eventually implemented with just a transistor and pullup).
  • I made the assumption that the output does not need to be buffered. So if the input impedance of the circuit after this one is significant, it will have an impact on tuning resistors, or you may even need to add a voltage follower. I don't know.
  • I made the assumption that you eventually want to be able to adjust the three parameters (high level, mid level, initial pulse timing) with potentiometers (you seem to talk about that in your question).
  • I made the assumption that the transition from high level to mid level does not need to be sharp.

Here is the circuit I thought about: enter image description here

The output mid-level is set by the ratio of R1/R3 (here 2.5V).

The output high level is set by the ratio of (R1||R2)/R3 (here 4.5V).

The initial high-pulse timing is set by C1 and R5, but also depends on R2+R3 (here about 10ms).

Here is how it works

  • When inactive, the input is at 5V. in this case, neither Q1 nor Q2 conduct (we assume voltage across C1 is 0V initially). so the output is simply pulled down through R3.
  • When the input goes down, Q1 base is pulled down through R4, so it starts to conduct. Also, C1 is pulled down and, because it's a capacitor, the sharp transition of the input is transmitted to R5 (C1 acts as a wire at the beginning), which turns Q2 on.
  • So both transistors are now turned on (hopefully saturated). The output is therefore VCC * R3 / (R2 || R1 + R3).
  • Now, C1 actually begins charging through R5 (and indirectly, R2 and R3). The actual time constant actually depends on all resistors (even R1, I think) - I'm too lazy to compute it (anybody, feel free to edit my post). As C1 charges, the current through Q2 base diminishes (C1 starts acting as an open wire).
  • At some point, Q2 stops conducting, so the output voltage becomes VCC * R3 / (R1 + R3).
  • When the input goes back to high level, Q1 stop conducting, output voltage goes back to zero. Note that if Q2 was still conducting, it also stops immediately. Also note that we need to discharge immediately C1, otherwise, the next cycle will lack the initial high-level pulse. This is the purpose of D1.

Here is how a sample pulse looks like (high-level: 10ms, total length: 200ms): enter image description here

To apply this to your solenoid application, I suggest actually removing R3 and putting directly the solenoid instead. Then choosing R2 and R1 depending on the solenoid resistance and the required voltage/current levels you need. Then set R5 depending of the requested timing (eventually adjusting C1 also). Make sure the transistors are well saturated (you may need to lower R4 and R5).

That's an 8-component solution (not counting R3). Simple. Cheap.

Pastebin of LTspice simulation: http://pastebin.com/qeTScYkZ


Can the same be achieved more simply (fewer components; no microcontrollers), while still accommodating the adjustment of the three parameters?

To adjust the 3 parameters independently you will need 3 variable components, eg. 3 potentiometers. Two pots will be used to set the voltage levels V1 and V2, and the other one will adjust the high level pulse time t.

Here is my idea for a circuit that uses no digital logic and has close to the minimum number of parts to do the job properly. It uses 3 sections of a quad rail-to-rail op-amp. R6 adjusts the peak pulse voltage from 0 to 5V (V1). R7 adjusts the base voltage from 0 to whatever is set on R6 (V2). R5 adjusts time t.

Op-amp IC1A interfaces to the TTL level trigger pulse. When the trigger input is high IC1A turns Q1 on, which connects +5V to R6 and R7 to create voltage V2.

Q2 is normally turned on to connect the bottom end of R7 to Ground. However on the leading edge of the trigger pulse C5 and R4+R5 create an RC discharge timing pulse. This is compared to 2/3 supply voltage by ICB, which then turns Q2 off preventing R7 from pulling the output voltage down. Thus during time t the full voltage from R6 is sent (through R7) to buffer amp IC1C. After time t finishes Q2 is turned back on and the output voltage drops back to V2.

D1 ensures that C1 will discharge quickly when the trigger pulse ends. It may not be needed if the gaps between trigger pulses are large.

This circuit is ratiometric so it should be relatively insensitive to minor power supply voltage variations. However if you want accurate output voltage levels then the supply needs to be stabilized. The obvious choice is a 3 terminal linear regulator. Bypass capacitors should also be installed. I have not shown these parts because they are normally assumed to be present where a defined supply voltage is specified (ie. +5V).

enter image description here

  • \$\begingroup\$ Another nice solution to consider--thanks very much. In my application (see comments below the question), IC1C could be dispensed with, so it only requires a dual opamp. Thanks again. \$\endgroup\$ Commented Jun 17, 2016 at 11:09

I feel like I'm a bit late to the party but I have a solution that will give out logic signals.

3-state monostable

The pushbutton on the top left labelled \$I/O\$ is the logic input.

R1 and C1 will change the timing of the monostable in which the formula is:

t = 1.1 * C1 * R1

t is in seconds

C1 is in farads

R1 is in ohms

You can also adjust the 9V and the 3.3V source to your liking, as:

4V in the image corresponds to \$V_1\$


2V in the image corresponds to \$V_2\$

(Just make sure the values aren't too small or the transistor's won't turn on, unless that's your intention.)


Use a monostable (thin pulse duration, t) to gate an analogue switch to pass voltage V1 for duration t. When "t" finishes the presense of the input pulse can gate a different analogue switch connected to V2. When that main input pulse finishes the 2nd analogue switch connects to 0V.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.