# How do I convert voltage from 0 to 5V into -10 to 10V

#### kevin.cheung19

Joined Nov 22, 2011
24
I want to use a microcontroller to control a motor. The output voltage that I can control from microcontroller is 0-5V, but I need to be able to input -10V to 10V analog input to the motor controller to control the speed of the motor. Is there any chip that can map a 0-5V signal into a -10V to 10V signal. I can supply a +15V and a -15V supply.

Thanks

#### SgtWookie

Joined Jul 17, 2007
22,220
I did almost the identical circuit for someone else awhile back.

See the attached.

#### Attachments

• 131.9 KB Views: 818

#### kevin.cheung19

Joined Nov 22, 2011
24
I did almost the identical circuit for someone else awhile back.

See the attached.
This is awesome! But I was wondering is there any pre-built IC chip that I can use here? If not, then I can build the circuit myself

#### JMac3108

Joined Aug 16, 2010
348
SgtWookie,

Very nice circtuit, and exactly what he needed. For anyone interested, the transfer function for his circuit is: Vout = 4Vin - 10

Try plugging in 0-5V for Vin and you'll get the same numbers that his graph shows.

One small idea to simplify the circuit ... For a non-critical application like this, why not make the 5V reference voltage with a simple voltage divider? You can increase the op-amp feedback resistors to 100K and then use 1K resistors for the voltage divider with minimal error. Resistors cost less and take up less room than a 5V linear regulator.

#### tgil

Joined May 18, 2011
19
Try looking at the Si9986 from Vishay. I have used this before for motor control using a microcontroller. You will need to use a pulse width modulated signal to control the motor speed. The overall setup is very simple. You just need the MCU, the IC, and two power supplies. A 5V supply for the MCU and a 10V supply for the motor. The H-bridge takes care of the -10V.

Good Luck

#### SgtWookie

Joined Jul 17, 2007
22,220
One small idea to simplify the circuit ... For a non-critical application like this, why not make the 5V reference voltage with a simple voltage divider? You can increase the op-amp feedback resistors to 100K and then use 1K resistors for the voltage divider with minimal error. Resistors cost less and take up less room than a 5V linear regulator.
In a prior iteration, I'd used a pair of 20k resistors with a 10v source; this worked out to have minimal errors.

I like to present circuits that have very close (if not exactly) to what the inquiring member needed, in a hopefully easy-to-understand manner.

The circuit I presented does have some minor errors due to the input offsets of the two opamp channels; the left opamp would have its' input multiplied by four, the right opamp by two - and the errors are cumulative. The total error in this circuit would be somewhere around 16mV, and that will change depending on the accuracy of the 78L05; as it's error will also be multiplied.

I suppose one might use a couple of 1k resistors - or a 2k pot to provide adjustment. I like to keep resistive dividers having somewhere between 100uA and 2mA current; I more or less automatically discard values above 2mA due to excessive current. 6mA certainly would not be excessive in this case, as the idle current of a 78L05 is about that anyway.

Joined Apr 27, 2009
97
I want to use a microcontroller to control a motor. The output voltage that I can control from microcontroller is 0-5V, but I need to be able to input -10V to 10V analog input to the motor controller to control the speed of the motor. Is there any chip that can map a 0-5V signal into a -10V to 10V signal. I can supply a +15V and a -15V supply.

Thanks
This is a unipolar to bipolar converter. It can be done with one op amp. You can use a differential amplifier to design it. Use this calculator to find the resistor values.

http://masteringelectronicsdesign.com/differential-amplifier-calculator-2/

Also, this article gives you step by step instructions on how to design a unipolar to bipolar converter:

http://masteringelectronicsdesign.c...-converter-for-a-unipolar-voltage-output-dac/