Using single microcontroller PWM output for 2 h-bridges

h-bridgemicrocontroller

I am using ATMega16L and I'm using two DC motors to build an autonomous robot. I want to use an h-bridge to control the two motors. Can I use a single PWM output from say Timer1 on the microcontroller to control two h-briges so that the motors can go forward at the same speed, go reverse at the same speed and change direction by making one motor go forward and the other in reverse?

Can I connect OC1A PWM output from the microcontroller to be an input to 'IN1' pin on both h-bridges while 'IN2' is low so that robot goes forward and vice-versa to make the robot go backwards. I am not sure how to connect the circuit to share OC1A output to control these h-bridges.

Best Answer

If you are happy with the specified H bridge only being able to supply 0.5 amps absolute maximum whilst "dropping" about 1 volt with the high-ish on-resistance of the MOSFETs in the package, it can be made to work. The data sheet showed an application where it runs from a 3V supply - it's a feeble little device and there are significantly better devices available.

See also my post on this subject.

Really this device is intended for an analogue control of the motors. Note the diagram below: -

enter image description here

If you read the spec you'll see that the rise time and fall times are about 1 to 2 us so your PWM control needs to be limited to maybe about 50 kHz - you'll also need to setup the control voltage Vc - see the feedback resistors and op-amps - they ultimately control the voltage that the motor sees so PWM will work but you may be better just using a filter from the PWM signal to create an analogue voltage and feed this into Vc.

At 90mA and 3 volts, the power is 270mW and this is acceptably inside the absolute max rating of 700mW but the device will get warm and "lose" battery energy.