# Negative voltage: How do I scale a 0 to 5 V signal to -10 V to +10 V?

To control my robot, I need to generate negative and positive voltage in a single line, because the motor I try to control is an industrial one.

Do you have any suggestion for it? How can I produce a negative voltage using an Arduino board and simple electrical elements?

• wire a positive voltage in reverse? – BrettAM Jan 11 '16 at 6:22
• It would help if you could be specific about the motor that you want to control. – dlu Jan 11 '16 at 6:26
• The servo-pack takes the voltage in single line from -10v to +10v. Usually motors have two pins to control the direction and velocity. But, in our servo-pack, one pin is ground and the other one takes a voltage in the interval of [-10,+10]. I want to control this motor using an Arduino Uno. – Soheil Gharatape Jan 11 '16 at 6:57
• @BrettAM I need to change the direction of motor with my control circuit and I just have the positive output of Arduino. Where should I put this single output line to inverse the direction? – Soheil Gharatape Jan 11 '16 at 7:16
• Can you provide a link to a datasheet for the motor? How does the +/-10V relate to how the motor works? – Majenko Jan 11 '16 at 11:35

"transistor" has walked you through what is necessary. Just an additional point of note: if you don't have a +/- power supply, you can easily generate the negative voltage using eg ICL7660 or even using a 555: https://www.ikalogic.com/555-based-voltage-inverter-schematic/

Just because I'm curious, could you add a link to the servo datasheet?

• you can find the link in the 7th comment of the first post. – Soheil Gharatape Jan 12 '16 at 3:10

How do I scale a 0 to 5 V signal to -10 V to +10 V?

First write the conversion formula:

``````Vout = 4 * Vin - 10
``````

Testing the formula gives the following:

• Vin = 0.0 V ==> Vout = -10 V
• Vin = 2.5 V ==> Vout = 0 V
• Vin = 5.0 V ==> Vout = +10 V

You will need an op-amp circuit to create this function. In addition you will need a +12 and -12 V supply. simulate this circuit – Schematic created using CircuitLab

How it works:

• OA1 is an op-amp wired in an inverting summing amplifier configuration. We'll address the inversion later but for now all the answers will be "upside-down". The gain is set by -R2/R1 = -40k/10k = -4. If we feed 1 V in from the ADC we will get -4 V out.
• R3 provides a negative input. The gain will be set by -R2/R3 = -40k/48k = -5/6. Since it's connected to -12 it will contribute +10 V to the output.
• The actual output will be the sum of the two: in our example, +10 - 4 = 6 V.
• C1 and C2 provide noise filtering for the op-amp. Place them close to the chip.

Now, what to do about the inversion? We have three choices:

1. Fix it in the micro controller code. Set +5 V as maximum reverse speed / torque. Set 0 V as maximum forward speed / torque.
2. Fix it in the servo amplifier and tell it to reverse its command signal.
3. Fix it in the electronics. By adding another inverting op-amp we can turn the signal the right way up.

The TL082 opamp suggested has two op-amps in the one 8-pin package.

Servo Enable simulate this circuit

Delay the servo enable until the micro controller has initialised and all other functions are ready. See manual Section 3.2.3, page 73.

Note that this is a simplified relay drive schematic. You need a transistor drive and a snubbing / flyback diode around the relay so one of the small 5V relay boards would be a good solution as they are already built in. An opto-isolator would be simpler.

Ensure that safety circuits (guarding and e-stops) are correctly wired using safety-rated components (and not only, for example, the micro).

• Thank you so much for your complete answer. I am going to make the circuit and may ask more questions when I finish making it. One more time, thank you for the detailed answer. – Soheil Gharatape Jan 12 '16 at 3:07
• This circuit seems to have an issue. When the Arduino is not fired yet, if the motor is turned on, it will rotate with the maximum torque in negative direction. Which may damage our system. One solution comes to my mind to solve this. We can use a 74HC4052 to scale the voltage to [-5,+5] and then use an op amp to gain this value. Am I right? – Soheil Gharatape Jan 12 '16 at 6:09
• You should already be using Servo Enable to inhibit the drive until the controller is ready. See update. – Transistor Jan 12 '16 at 7:38
• I'm back after so long :). Actually the circuit works but not well. There is an offset in output. After lots of searches, I found that there are other solution for this problem. For instance, it is possible to use an IC which is called Digital to Analog converter. Do you know how can I handle the problem using that IC? Because the output of abovementioned circuit is not precise and reliable. – Soheil Gharatape Mar 25 '16 at 6:34
• P.S.: my system has high band width and accepts pure analog voltage as input. That's why I came into the idea of using DAC. – Soheil Gharatape Mar 25 '16 at 6:43

if you want to operate DC motor in both directions you need to use H-Bridge external small circuitry for that

Use relay circuit for that purpose  • As I mentioned in my post, I must produce the voltage in a single line, because my motor is not a DC motor. It's a servo-pack. – Soheil Gharatape Jan 11 '16 at 9:44
• For that you will need to use relay circuit that will switch between negative and positive voltages – Muhammad Hassaan Bashir Jan 11 '16 at 11:12
• This answer does not address the 10 V requirement. The motor is not a DC motor, it is a servo. Switching a relay 'between negative and positive voltages' will not give smooth analog control. -1. – Transistor Jan 11 '16 at 20:28