I want to have a +-12.0V square wave output from an opamp fed from a 3.3 and 5V power supply. The signal is 2.5kHz with a low duty cycle of 3-10% generated by an MCU. Peak voltage at both ends need to be within 0.1V from +-12V. The load I am driving is 1kOhm so max 12mA. The slew rate requirement is 20V/us.

I have have tried a 5V to +-12V DC/DC converter as well as chargepump a. Given the low load I would think a chargepump is the most econimical. Using rail to rail opamps gave me 11.9V but I have never found an opamp with high enough slew rate. Meaning the rail to rail opamps seemed to0 slow.

Then I have searched for ‘trimmable’ charge pumps at say +-12.5V that would drive a faster opamp with a 0.5V output drop but have just not found it.

Was just wondering if you guys could help me with this. My situation is just easier with a more accurate 12V output. Even 11.9 has some downsides. Thanks

EDIT: Built the circuit per first answer. It works great!. Albeit the output is inverted. I solved this by modifying the circuit. Removed the inverting transistor for the +12V and added a second inverting transistor for the -12V side. But other than what I had expected, the circuit became clearly 'slower' in the second, non-inverting case than it was in the inverting case per the first answer.

I learned (by doing) that switching at 3.3V is slow and at 12V it is fast. What I do not understand is why the transistor M22 that I added makes the circuit slower. It is switched at 12V. What can I do to make my signal faster? (note that I simulate at 1Mhz and will build at 2.5kHz).

Top schematic: inverting, bottom: non-inverting: Top schematic: inverting, bottom: non-inverting

Response graphs of OUTPUT (inverting schema) and OUTPUT2 (non-inverting schema). Clear that OUTPUT2 is 'slowish'. enter image description here

Probably better way to switch a -12V signal with at the inverse of a 3.3V signal than what I have done. Help appreciated!!


3 Answers 3


You can use transistors as so.. assuming you have solid +/-12V rails available (you could use a +/-15V DC-DC converter and linear regulators):

This circuit uses 5 inexpensive MOSFETs and one 4-resistor resistor network to shift the MCU signals to +/-12V. The necessity to keep |Vgs| < 20V adds a bit to the complexity.

enter image description here

This will give rise/fall times in the 100ns range and voltage drop typically < 50mV.

  • \$\begingroup\$ This is fascinating that you use 3 MOSFETs to convert the MCU signal. Thank you for the right partnrs, I will build it. Could you then also give the simplest option to get to +/-12V within 50mV from 3.3 or 5V. I can then build and test the thing in one go \$\endgroup\$ Commented Apr 4, 2021 at 21:46
  • \$\begingroup\$ If you put a couple transistors in parallel for M1/M2 it should get within 50mV. Much bigger transistors will result in too much shoot-through without a more sophisticated circuit. Redusing R6/R5/R3 will help with that, to a point. \$\endgroup\$ Commented Apr 4, 2021 at 21:57
  • \$\begingroup\$ But for 50mV the transistors indicated should do, right? \$\endgroup\$ Commented Apr 5, 2021 at 7:45
  • \$\begingroup\$ Use two in parallel for each of the two output transistors. \$\endgroup\$ Commented Apr 5, 2021 at 14:50
  • \$\begingroup\$ I have built the circuit and appreciate the voltage divider for the >20V now :-). You are inverting the signal though. I tried to prevent that. For the plus side that is simple (remove M5), for the negative side I could only come up with adding a copy of M3/R2 couple between M3 and M4. It works, but it becomes slower than your inverted solution. I was new to Mosfets and enjoyed my Easter. Thank you! I seem now with the issue of trying to switch a negative line with a positive voltage. \$\endgroup\$ Commented Apr 6, 2021 at 20:53

You can use a readymade 5V to +/-15V dc-dc converter to power your opamp. If you need lower noise, add CLC filters on the input and output.

That shifts the accuracy requirement to the signal fed to your opamp though.

If you will only use square waves and you have an accurate +/- 12V charge pump converter, another option is to replace the opamp with a pair of MOSFETs, and just switch the output between +12 and -12.

  • \$\begingroup\$ Good point on noise generated by input. The MCU is within 2-3 cm. Any reason to add filtering at 2.5kHz and <<100ns rise time? \$\endgroup\$ Commented Apr 5, 2021 at 7:47
  • \$\begingroup\$ I don't think you should worry about it, the mcu will make more noise on the power supply than the charge pump and it doesn't need a special low noise supply, except the ADC reference voltage if you want ADC accuracy. \$\endgroup\$
    – bobflux
    Commented Apr 5, 2021 at 8:15

Aren’t you shortcutting negative and positive 12V this way? Switching on plus 12V happens faster (driven by 1 MOSFET) thans switching off minus 12V (driven by 3 MOSFETs).

I mean: in the second, non inverting example. Not sure why not also very briefly in first example though.

  • \$\begingroup\$ Should I measure current in the 12V and -12V supplies to check? But isn’t this always a risk with pushpull? How is that solved in other occasions? \$\endgroup\$ Commented Apr 8, 2021 at 7:32

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.