I arranged this circuit to prevent wires from crossing each other... I'm using using paperclips to make the circuit =). This is what I have so far:
I tested the circuit and it works! Just one problem: during the "void setup()"part of my code (Arduino), the motor starts to run without any input. I tried to set the PWM pin low, but it didn't worked. How could I fix this? Pull-down resistors? Here's the code I'm using:
Everything looks fine to me. Since you’ve got the pull-up resistors and NPN inverter controlling the ‘direction’ inputs, a pull-down resistor on the enable line is probably the way to go. As well as keeping everything settled during the startup phase, it’ll help disable the motor driver if there’s an error/short/broken connection or if you disconnect the microcontroller.
I’d also suggest adding the same pull-up and pull-down resistors on the enable/direction pins for the 2 unused half H-bridges - if left ‘floating’ those inputs can oscillate wildly which consumes extra power and generates electrical noise. It’s not really critical, but for the cost of 3 resistors you might as well.
The pull-down goes from the The pull-down goes from the enable pin to ground. You probably don’t need to worry about the capacitors for this circuit, unless you run into specific problems - the pull-down resistors should be enough.