H-Bridge and PWM improvements/mistakes

This is my first post,

I’m building a DC motor controller. I’m using an H-Bridge (model L293DN, the one included with the arduino) to control the direction of the motors and PWM to control the speed of the motor. I’ve read around the forums and it seems that PWM is tricky to get right (determining right resistors/transistors).
To avoid having to build additional circuits I plugged digital pin 9 and 10 to the enable(1,2/3,4) input in the

Is this recommended? If not is there a better way to do it?

In the program I put
analogWrite(9, motorSpeed);
analogWrite(10, motorSpeed);

0 <= motorSpeed <= 255

However, with a 6V (4x1.5V) battery, at motorSpeed < 50, the motor emits a high pitched sound and doesn’t move. As motorSpeed increases the sound disappears and the motor works fine.

Why is this happening? (This also happened when I used the PWM circuit using diode and transistor outside, so it’s not just the H-Bridge fault, maybe it’s the transistors?)

What happened with the H-Bridge, differently from the external circuit, is that the rotation of the wheel is uneven. As if the floor was bumpy causing the car to speed and slow down, this uneven rotation happens is also visible when I lift it.

Any ideas why?

Thank you

The L293D is an old design and loses anything up to about 3V. So you only supplying the motors with about half your battery voltage which is probably why they don't run very well, particularly at low PWM rates.

But since you haven't told us what motors you're trying to use or how many of them or how anything other pins9 and 10 are connected it's just a guess.


So what kind of bridge would you recomend?

I'm using 2 Brushed DC Motors

Motor details:

  • Operating Voltage: 3V ~ 6V DC
  • Recommended Operating Voltage: about 3 to 6V DC
  • Load Current: 70mA (250mA MAX)
  • No-load Speed: 1:48 (3V)

IO pins 2,3 are connected to H-Bridge inputs A1, A2, IO pins 4,5 are connected to H-Bridge inputs A3, A4 H-Bridge outputs Y1,Y2 connected to left DC motor Y3,Y4 connected to right DC motor

5V arduino is connected to H-Bridge Vcc1 for logic 6V battery connected to Vcc2 for power supply

The spec sheet at



"The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V."

What do you mean that it loses everything up to about 3V?

For low voltages the Pololu DRV8833 dual h-bridge works well.

When choosing a h-bridge study the specs to ensure it has a low ON resistance.


Be aware that any motor controller has to either handle the motor stall current, or limit the current to a value it can handle. Stall currents are typically about 10 times the nominal running current for most motors.

For instance a motor driver rated at 1A continuous, 2A max will probably be fine with a 200mA motor, likely will struggle or fry with a 1A motor.