0
\$\begingroup\$

I would like to generate a square signal with SW adjustable duty cycle, phase etc using the output pin of a microcontroller (3.3V). Frequency <100Hz. However, I also want

  1. the amplitude of the high state to be in ~ 2-7V range adjustable with a trim potentiometer from a 12V supply rail,
  2. When the signal is low it should be close to zero.
  3. no spikes or disconnected states between transitions to high/low
  4. signal to be zero when the microcontroller output is zero (non-inverted).

The signal will be fed into high impedance op-amp inputs which will driveflash/strobe circuits, so it is like a common analog input signal to multiple strobe circuits. What is the simplest way to do this? A mosfet, analog switch IC or ?

Thank you!

\$\endgroup\$
1
  • \$\begingroup\$ How much current do you need? You can probably use the MCU to drive a mosfet driver to switch the output of a variable buck converter. 100Hz is quite slow. \$\endgroup\$
    – K H
    Jan 24, 2021 at 8:41

3 Answers 3

1
\$\begingroup\$

Another option is simply an N-MOSFET. 99.9% of the time you can do the inversion in the MCU itself and remove U1, but on the off-chance that you can't for whatever reason, add an inverter U1. Also, restrict your pot range by adding lower and upper fixed resistors:

schematic

simulate this circuit – Schematic created using CircuitLab

An even simpler option is to replace both the inverter and the MOSFET with an open-drain (or open-collector) 12V-tolerant non-inverting buffer.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ probably no big deal, but this will default to output-high, when microcontroller is reset or unpowered. If that is not the desired behavior, a pull-up resistor can be added to U2 gate. \$\endgroup\$
    – Pete W
    Jan 24, 2021 at 21:56
0
\$\begingroup\$

I would use an analog mux. You require "no spikes", this is a vague requirement, but a fast analog mux should meet your needs.

Depending on which analog mux you choose, you may need a level shifter.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
2
  • \$\begingroup\$ Thank you! The Analog MUX would be a SPDT analog switch, correct? I was wondering about the break-before-make feature of these switches: could there be a problem during the transition between high-low, since the output is briefly floating? I suppose one can add a pull-down resistor to the output of the mux? \$\endgroup\$
    – bekoch
    Jan 24, 2021 at 9:48
  • \$\begingroup\$ Yes, a SPDT, something like a 4053, but this is an old part, there are probably better options. A pull-down wouldn't hurt. \$\endgroup\$
    – Mattman944
    Jan 24, 2021 at 10:08
0
\$\begingroup\$

here's another, not particularly precise, but just for variety. pot is 7K. falstad link enter image description here

\$\endgroup\$

Your Answer

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

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