Can I connect at least 5 motors to the mbed?

14 Jan 2012
  • Edit
  • Actually, 4 motors is enough

Each motor needs to be controlled by 2 pwm signals, so that's 8. What are the performance differences between a software pwm and hardware pwm? Is it okay to mix them?

15 Jan 2012

In my ROV project I am driving 7 DC motors, though admittedly only 3 via PWM.

But why do you need two PWM signals per motor? What sort of motors are they?

Scott

15 Jan 2012

The motors need to be controlled by h-bridges which is why they need 2 pwm each

15 Jan 2012

Hi Tony,

Assuming a standard h-bridge setup, you can usually just use a single PwmOut driving an enable pin, and drive the two direction pins with DigitalOut.

Take a look at:

Hope that is helpful,

Simon

15 Jan 2012

Alternatively you can drive it with a single PWM and no direction signal. At 50% duty cycle the motor is idle. Below 50% it turns one way, above 50% it turns the other.

15 Jan 2012

Can I drive the TLE-5206 with only a single PWM channel? DS: http://www.datasheetcatalog.com/datasheets_pdf/T/L/E/5/TLE5206-2.shtml Do I attach pwm to In1 and Not pwm to In2? If that were the case, would I get brake when pwm=50%?

15 Jan 2012

It looks like you can use that TLE-5206 using a single pin (DS pages 15 and 16 - look for "3. Locked Anti-Phase Control"). The ratio of high-to-low on the inputs gives variable speed in one or the other direction, and a 50% high-to-low ratio (ie 50% duty cycle) should give no forward or backwards rotation.

Have a look at the LMD18200 h-bridge chip (http://www.national.com/pf/LM/LMD18200.html) which has a dedicated direction pin, which in my experience makes it easier to understand and implement. They are quite a bit more expensive and come in an awkward 11 pin package (there is, or was, a breakout board for these available from Sparkfun which makes them easier to work with).

Hopefully that is useful to you.

Scott

15 Jan 2012

Thanks Scott. So do I connect it like this: IN1:S, IN2:S Xor PWM? This would still require two ports but only one pwm port. Is there anyway to make it work with only the pwm port?

15 Jan 2012

It looks to me that you connect a single PWM to both IN1 and IN2.

To be honest, I don't understand how this works when looking at the truth table for the inputs ....

15 Jan 2012

Basically OUT1 follows IN1 and OUT2 follows IN2.

Two mbed control signals are needed if you want to control both speed and direction. One of them is PWM to control the speed, the other signal controls direction.

For example PWM to IN1, Direction to IN2. Direction=0 and PWM of 0% will mean Brake, PWM=100% will mean max speed. Direction=1 and PWM of 0% will mean Max speed in other direction, PWM=100% will mean brake.

You can use an external EXOR gate to reverse the reversed behavior of PWM, but it is easier and cheaper to just hide that behaviour in a software method.

When you connect both INputs to the same PWM the motor will never run. When you connect one input to the PWM and the other to the inverted PWM (using an external inverter) the motor will stop at PWM=50% and run in opposite directions when you go to PWM=0% or PWM=100%. This will work, but you loose resolution in the speedcontrol range.