Question: I need to do a voltage conversion to control a servomotor.

I need to convert a pwm signal that ranges from 0V to + 3.3V into an amplified signal that ranges from -10V to + 10V.

I thought about doing this with the use of an operational amplifier (as in the circuit below).

However, I can't get the correct Vout signal, just a voltage ranging from 0V to + 10V.

Is there another way to do this conversion?

![schematic](https://i.stack.imgur.com/3R3Np.png)

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2f3R3Np.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)

Answer: 
To address both parts of your question:

1. What's wrong with the current circuit: 
So remember that a MOSFET is not actually a symmetric device. It can't turn-off current going in both directions, only in one direction. Your schematic has current flowing from source to drain on the MOSFET, but that is the direction of the body-diode in a MOSFET as well. Not all circuit symbols show it, which can lead to this sort of simple mistake, but if you look it at the circuit symbol from the datasheet of the very MOSFET part number you used, you can see the more complete circuit symbol that shows the diode:

[![NFET with Body Diode Shown](https://i.stack.imgur.com/O6A7p.png)](https://i.stack.imgur.com/O6A7p.png)

So even after you turn-off the MOSFET in the circuit you have, it will still conduct current through that body-diode. 

2. Practical note:
This kind of circuit for fault-isolation is generally in the class of ICs known as E-Fuses, and can be bought in a convenient form factor from the likes of TI or STM or Analog Devices. You can even have it re-attempt to turn on in short pulses that won't take down the system but allow you to tell when or if the short has been removed from the system.
If you just want to generate signals that can be monitored by a 4 - 20 mA analog input then try this.

![schematic](https://i.stack.imgur.com/5H38d.png)

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2f5H38d.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)

*Figure 1. A circuit that will give readings in the range 4 - 20 mA for a variety of circuit status indications.*

* Line open: \$ i = 0 \ \text {mA} \$.
* End of line only: \$ i = \frac {24}{3k9 + 1k + 250} = 4.7 \ \text {mA} \$.
* EOL + STANDBY: \$ i = \frac {24}{(3k9 || 3k)+ 1k + 250} = 8.1 \ \text {mA} \$.
* EOL + STANDBY + ACTIVE: \$ i = \frac {24}{(3k9 || 3k || 1k)+ 1k + 250} = 12.7 \ \text {mA} \$.
* SHORT CIRCUIT: \$ i = \frac {24}{1k + 250} = 19.2 \ \text {mA} \$.

R4 will convert these currents to 0 to 5 V for an ADC.

You can work out other combinations for missing END OF LINE resistore, etc.