I have been trying to control a voice coil actuator with PWM input, but i have the following problems and would like you to correct or point me in new directions.

I have an arduino which outputs PWM voltage. As i only have a single power supply and PWM is always positive to ground i figured i would just use a voltage divider op amp(12v->+6v;-6v) to feed the TL062(which i happen to have in handy and has nice rail2rail swing, i think).The impedance of the coil is 12 ohm.

The op amp voltage divider is done with only 2 equal resistors in inverter mode. Regarding the driver op amp TL062,I am planning it as inverter dc coupled but i am not sure. I am also not sure what is Vs in the equation but i assumed 5 because of the max PWM voltage(i really don't know if this is right). The problem is i can't get my circuit to work with the parameters i have set. Which are

Gain=(-6-6)/(5-0) = 2.4 which makes that R2=2.4*R1

Vbias = (Vout + GVin)/(1 + G) (+6 +2.4*0)/(1+2.4) = 1.76V

Vbias = R4/(R3+R4)*Vs <=> R3 = 1.84 * R4

I have taken the equations and theory from Link to Google PDF viewer the section about DC coupled inverted amplifier.

I am sorry for the length of the question but it is so everything is stated as clearly possible at the first time

  • \$\begingroup\$ I am not sure to understand. The Arduino is supposed to output a square wave swinging from zero to +5V. What you expect is having a square wave on the coil as well? What's the problem of the positive-only output of the Arduino (apart the few current available)? The TL062 is not rail-to-rail on the input, nor on output. \$\endgroup\$ Aug 15, 2011 at 5:37
  • \$\begingroup\$ My understanding is that i need a negative voltage to make the actuator move in the opposite direction from the normal one. The PWM is such that it can swing the actuator faster or not. The square wave is a consequence of controlling Voltage in arduino. I know it is not rail to rail, but unless there is some detail i don't understand, the Vom(Maximum output swing) is +-10V for Vcc=+-15V.Granted it is not my working Vcc but i supposed it allows the swing to be -6+6 wich Vcc=+12V \$\endgroup\$ Aug 15, 2011 at 12:23
  • \$\begingroup\$ Now I begin to understand. You supply +12V and -12V to the opamp: in that case there's no problem. I am still unsure to mean correctly: your coil should span from -6V to +6V, as if it was DC voltage? Your goal is to adapt the PWM output (by duty-cycle) so that 0% will produce -6V and 100% will produce +6V? \$\endgroup\$ Aug 15, 2011 at 16:29
  • \$\begingroup\$ Exactly that, but i supply the op amp with Vcc +6 and -6V and the output is as you described \$\endgroup\$ Aug 16, 2011 at 0:51

2 Answers 2


You are on the right track but need a clearer understanding of the amplification needed and of what you will need to provide the power level you need. You need up to 0.5A or 1 A in the inductor depending on how you drive it - only special (very) high power opamps can do this directly..

  • The amplifier can (and should be) run at high gain as the output needs only be at one supply rail or the other.

  • The amplifier is acting as a "comparator" and a comparator IC could be used.

  • The reference voltage for the amplifier or comparator needs to be somewhere mid way between Vin_high and Vin-Low - actual level is not crucial if the gain is high. Half Vin+ = 2.5V will be fine.

  • The amplifer will provide the voltage swing that you want but will not provide enough drive current. A simple 2 transistor output driver will provide the current that your inductor needs.

If you were trying to amplify an analog signal whose waveform needed to be accurately reproduced your general concepts re amplification would be appropriate.

However, PWM is a "rail to rail" square wave signal. To convert from 0/5 to +/- 6 it is only necessary that the output be high when the input is high and low when the input is low. (Or equally validly, inverted so that the output is low when input is high and high when low). The amplifier (or comparator) can have notionally infinite "gain" - the output will only reach the high or low rail no matter how much gain you use and you generally will get faster response and more certain square wave output by using very high gain.

What you want is effectively a "comparator" - output is high when input is over a certain level and low when input is below a certain level.

Shown below is the basic inverting amplifier circuit diagram from the datasheet that you referenced. Gain is 10 as shown here (10k/1k), If you remove the 10k and short-circuit the 1k you have a basic comparator. You can use an opamp for this purpose but a comparator is dedicated to the task - it's essentially an opamp that is optimised for fast rail to rail transitions. You can use your TL062 for this or a purpose built comparator IC. You could instead replace the opamp with a simple 1 transistor amplifier stage, as shown below.

c:\in\Inverting amp.jpg

enter image description here

Current / Power amplifier

errata: oops - add resistor R2b between Q1c and Q2b.

Once you have adequate voltage swing you need to provide a means of delivering adequate current. In the top circuit shown below, Q3 and Q4 mirror the voltage at point X (less a Vbe drop) but provide a high current output capability in the process. In the top diagram point "X" is driven by Q1 which in turn is driven by Vin - from the Arduino in this case. If you wish to use an op amp then the lower circuit is used to drive point X in place of the circuitry associated with Q1. As drawn the transistor based circuit is non inverting. This can be altered if inverting PWM is desired. The op amp version does not have inverting and non inverting inputs marked on the op amp. These may be assigned as desired to produce inverting or non-inverting drive. (Vin to noninverting (+) input and inverting input to Vref to get non-inverting PWM drive.

I can refine this answer and provide extra comments if interest is shown.

In the lower opamp circuit the lower horizontal line is ground (as in eg +5/gnd) and the 10k does join to ground.

As shown here the inductor is driven with +/- 6V relative to ground. If you want +/- 12V drive then you can use two of the output drivers driven by inverting and non inverting feeds with the inductor connected between the two outputs. This becomes a full bridge or "H bridge" driver.

enter image description here


  • All transistor version.

    Vin low so Q1 off so Q2 base oulled high by R2 so Q2 off so Q#/Q4 bases pulled low by R3 so Q4 on as an emitter follower and Q3 off. Q4 now acts as an emitter follower and provides negative rail to L1. Current is limited by L1 resistance, L1 inductance (affects rate of rise), current capacity of Q4, Current gain of Q4.

    Vin high so Q1 driven on so Q2 on so Q3 on as emitter follower and Q4 off. Q3 now acts as an emitter follower and provides positive rail to L1. Current is limited by same factors as above.

  • Opamp version

    Assume opamp is set up to be non inverting so Vin connects to non inverting input.

    Opamp inverting input is at 2.5V due to 10k/10k divider.

    Vin high so Vin > 2.5 so opamp output driven high. Point X high which connects to point x in cct above with same results.

    Similar but opposite for Vin < 2.5V

Inductive energy recovery: D1, D2 provide paths for inductive current when both Q3 and Q4 ar off or partially off. Diodes need to be able to handle peak inductor current and have a switching speed fast enough to deal with any spikes on PWM edges. Leaving these out may result in destruction o Q3, Q4.

  • \$\begingroup\$ The opamp version would be the best choice for me as i have 0 to none knowledge with transistors circuit analysis (i only had circuit analysis until opamps/caps/inductors, making the actual choice of components and resistances tough for my level. Even though if you pointed the concepts to study i would follow. One thing i didn't for sure understand was the inductor L1. Is L1 for spike protection or is it the coil itself. \$\endgroup\$ Aug 16, 2011 at 12:34
  • \$\begingroup\$ @aiwarrior - L1 is the coil itself. Note that even if you use the IC version you MUST have an output that can handle the current required. There are amplifier ICs that can do this - some may be priced OK. If you are serious about doing this tell us more and I/wee can see if we can add more practical information. What frequency PWM do you intend to use. Is this actuator from a hard disk or ??? \$\endgroup\$
    – Russell McMahon
    Aug 16, 2011 at 12:43
  • \$\begingroup\$ @RusselThis is for a hard disk actuator that will just behave like a shutter for some dispensing unit. There is no need for high accuracy. Also for simplicity reasons i only considered the shutter states as open/closed states. The accuracy just makes the shutter faster which in turn dispenses granular pellets by gravity in more controlled quantities. I have no intention of making this expensive(the coil itself is salvage so...) and if i can learn in the process it would be nice. The reason i voted you correct answer was that you showed me my question did not give me the answer i wanted. Thanks \$\endgroup\$ Aug 16, 2011 at 13:06

First off, you must choose a rail-to-rail opamp. It must accept input swing up to the supply, and the output should be able to swing up te supply. There are plenty of them: for example the LT1801.

Wherever possible I apply my standard circuit pattern for an opamp. Consider the NON-inverting input directly connected to the PWM source. The inverting input is connected to two resistors: one (R2) to the opamp output, and another (R1) to a DC voltage source of value Vs. It is easy to show that the opamp output is:

Vout = Vni + K * (Vni - Vi)


  • Vni is the voltage at the NON-inverting input of the opamp;
  • Vi is the voltage at the R1 lead;
  • K is R2/R1.

All voltages are respect ground.

At this point, it is much like a high school problem. Since the PWM swings always from 0 to +5, you have only two cases: when Vni is zero, you want Vout equal -6V, and when Vni is +5, Vout must be +6V.

You may put all together so to have a two-simultaneous equations, with two variables: K and Vs. If I didn't mistake, that leads to:

K = 7/5, so R2 must be 7/5 times higher than R1 (e.g. 68K and 47K approx).

Vs should be 30/7 = 4.29V Volts, that you get by a simple voltage divider applied at the +6V supply.

So, this circuit will amplify the PWM square wave to a -6..+6 square wave. Same frequency and same duty-cycle. However, you should choose a good opamp having a slew-rate high enough to follow the PWM shape.

It misses the coil driving. You might drive the coil almost directly, I mean without any low-pass filter, but that's depending on the coil, on what you looking for and other factors. I don't think you may drive the coil without any current amplifier.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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