Go Down

Topic: Create PWM with amplitude of +9v and -9v (Read 3441 times) previous topic - next topic


Hi, I have an Arduino Duemilonove and Ardumoto shield. Is somewone know if it is possible to create a +/-9v PWM with frequency of about 50Hz using those resources? I also need to control the Duty Cycle..


Yes it is easy you need a split voltage supply of +/- 9 volts and a pair of transistors. What sort of current do you need to drive with this?

However I suspect that you don't actually want to do this so we need to know what you actually want to do and if this is the right way. So many beginners waste a lot of time asking for things that they don't really need, but theynonly think they need.


I need to drive actuator, which is about 500-600mA. It is for My final project in university.


That is a lot of current. Anyway a class B push pull amplifier stage should do it.


I know that Ardumoto shield can provide a negative DC (-9v) voltage while setting: digitalWrite (dir_a, LOW), and positive DC (+9v) while setting: digitalWrite (dir_a, High). Therefore i can get a PWM of +-9v without any additional transistors, but i don't know if i can do it in high frequency.. How can i make delay of HIGH and LOW to be less than 1ms.


How can i make delay of HIGH and LOW to be less than 1ms.

How does that tie-in to your 50Hz (20ms cycle) requirement?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


I know that Ardumoto shield can provide a negative DC (-9v) voltage while setting: digitalWrite (dir_a, LOW), and positive DC (+9v) while setting: digitalWrite (dir_a, High).

No it will not produce a negative voltage. That shield is an H-bridge circuit. It will reverse the polarity applied to a load on connected between its two outputs but it will not supply a negative voltage.

You asked about producing a +9V and a -9V signal.

What exactly do you want to produce?


OK, sorry, i will start over... I am trying to drive a Hard Disk actuator arm. I soldered two wires to the Arm's coil which placed between the magnets. While i'm connecting one of the wires to +5v and the other to 0 in external PowerSupply, it takes the arm to one side due to electro magnetic field which created by the current in the coil, but if i want the arm to go to other side, i need to switch the wires or to decrease the voltage to be negative (current will flow to another side). I need quite precise control of the arm, so i want to use the PWM with a high frequency to control the situation of the arm by changing the Duty Cycle on period of 500Hz.


So you will need to filter the PWM signal and send an analogue signal into the coil. That means your shield is not going to be any use to you as that will only produce a hard on or hard off signal.
So back to what I said at first you need a class B output stage running off a split supply which you feed from a filtered PWM signal. As the PWM only has 8 bits of resolution and you want a positive and negative signal then you will only be able to move your head into one of 127 places. Is that precise enough for you?
For PWM filtering see:-


I actually already tried to send a analog signal to the coil, but there is a problem because while the current in the coil is 0, the arm is not stable at all, so that's why i need a real PWM on the coil in a pretty high speed. While i'm giving a +-9v vith Duty Cycle of 50% directly on the coil, the mean voltage is also 0 byt the arm is stable because of the hihg frequency.


Jun 23, 2011, 07:18 pm Last Edit: Jun 23, 2011, 07:21 pm by gardner Reason: 1
I'm missing something.  Head positioning "voice coils" work on the servo principle.  There has to be a positioning feedback loop for the servo logic to decide whether to drive it up or down from where it is, and how hard.  If you don't have positioning feedback, all you can do is drive it weakly or strongly against one stop or the other, or let it float.

Maybe you have a progressive centering spring like a meter movement?  Then position is simple function of force applied.  Is that what you're up to?

Go Up