0
\$\begingroup\$

I need to control a DC motor with the PWM audio waves coming out of the audio jack of a device. The device will send a positive PWM to drive the motor forward and a negative PWM signal for driving it backwards. The PWM signals can have an amplitude of 500mv max (positive or negative). I have a supply voltage of 5v also.

Can anyone please show me how to modify an H-Bridge or a similar circuit to make this work.

\$\endgroup\$
2
  • \$\begingroup\$ Please post a link to the DC motor, and the device/equipment producing the PWM audio. That might make it easier for people to help you. Also how much power does your 5V supply provide? \$\endgroup\$
    – gbulmer
    Commented Oct 20, 2014 at 12:45
  • \$\begingroup\$ The PWM generator is an Android phone (HTC Wildfire S). And the DC motor I am using is adafruit.com/product/711 \$\endgroup\$
    – Xmindz
    Commented Oct 20, 2014 at 12:48

2 Answers 2

2
\$\begingroup\$

Your basic architecture is flawed. The circuit producing the audio output will high pass filter the signal somewhere in the path. Even in "HiFi" audio, 20 Hz can be attenuated 3 dB with gain dropping off arbitrarily below that.

The net result is that there is no DC information in the signal. There is therefore no positive and negavite PWM. The DC average of the signal will be 0. For example, a positive 70% duty cycle PWM will be indistinguishable from a negative PWM of 30% duty cycle.

You might be able to salvage some of this concept by using 50% duty cycle as the 0 level, with high duty cycles (more time spent high than low) meaning forward rotation and low duty cycles meaning backward rotation. Note that you can't use 100% or 0% duty cycle for full forward and full backward since both would look the same after DC is removed. You probably want to limit the PWM to the 5-95% range or thereabouts.

However, all this is a kludge. You mention the device producing this audio is a Android phone, so you have various other digital communication interfaces available. One way or another you want to get digital motor speed from the device, and have the microcontroller driving the H bridge produce the actual pulses. You could even pass digital information over the audio output.

\$\endgroup\$
1
  • \$\begingroup\$ There are examples for audio signal controlled robot cars. Please have a look at this: srimech.com/simple-headphone-controlled-phone-robot.html This guy has done it with servos where I want to do it with DC motors. But unfortunately I'm too weak in Electronics to redesign the circuit for DC motors. \$\endgroup\$
    – Xmindz
    Commented Oct 21, 2014 at 10:40
0
\$\begingroup\$

Alas, you are trying to get a DC signal out of an audio jack. i.e., Your audio jack is AC, with an average DC value of zero volts. (You might even find that your audio driver feeds the signal to the audio jack through a capacitor...) So, you need to choose a way to convey your information on an audio signal. This can be accomplished by using some means of modulation. You could use amplitude modulation or frequency modulation quite easily. You will of course need to demodulate the signal after it comes out of the audio jack, and before it gets to your H-driver. I'm not sure how you are creating the audio signal that is to come out of your audio jack, but that may determine whether you use AM or FM. If you use AM, you could simply use a signal that is either on, or off, at any instant. (Similar to what is used when sending Morse code on an RF carrier.) Then, if it is on 50% of the time, assume this is zero drive. If it is on more than 50% duty cycle, then translate that to a positive pulse width that is proportional to the amount it is over the 50%. Conversely, to drive negative, simply force the signal modulation period to be less than 50%, and assume this is a negative drive... Quite simple actually... If you want to go FM modulation, which will work just as well, you can pick a center frequency, say 10 KHz, and assume that it is the no-drive frequency. And, any frequency above 10 KHz can be interpreted as a positive drive, and any signal below 10 KHz can be interpreted as a negative drive. And, the deviation in frequency from the 10 KHz can determine the PWM percentage in each direction... Be sure to have a dead zone on your demodulator, for either AM or FM, as you may not have exact control of the signal generation... Plus, it is a good design practice... And of course, be sure to accommodate the situation where you have no signal. i.e., your demodulator must interpret the lack of signal as a "No-Drive" command...

\$\endgroup\$
1
  • \$\begingroup\$ There are examples for audio signal controlled robot cars. Please have a look at this: srimech.com/simple-headphone-controlled-phone-robot.html This guy has done it with servos where I want to do it with DC motors. But unfortunately I'm too weak in Electronics to redesign the circuit for DC motors. \$\endgroup\$
    – Xmindz
    Commented Oct 21, 2014 at 10:43

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