0
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

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.

\$\endgroup\$
13
  • \$\begingroup\$ 0.5amps is enough as I need to drive 2 tiny coin vibration motors rated at 3V, 90mA \$\endgroup\$ – David Norman Jun 24 '14 at 9:22
  • \$\begingroup\$ @DavidNorman OK 90 mA sounds cool but you need to control the Vc pin too and, it might be advantageous to filter your PWM to a DC level and use this inputted to the Vc pin. See adds in my answer. \$\endgroup\$ – Andy aka Jun 24 '14 at 9:47
  • \$\begingroup\$ These OPAMPs act sort of like a comparator right? What role does Vc play as compared to IN1 and IN2. Why is it even there when there are inputs? \$\endgroup\$ – David Norman Jun 24 '14 at 21:21
  • \$\begingroup\$ I believe these op-amps control the voltage via linear methods i.e. they try and set OUT1 (or OUT2) to a fixed voltage rather like a linear series voltage regulator. The giveaway (to me) is the potential divider. In1 and 2 can somewhat override the output i.e. it can switch it off (it seems) but it can only force the output to be as high as twice Vcontrol. So when it says "H" in the truth table in my answer, H = 2*Vc \$\endgroup\$ – Andy aka Jun 24 '14 at 21:25
  • \$\begingroup\$ I see. What if I connect Vc directly to VCC i.e. 3.3V? I was looking at its application notes (onsemi.com/pub_link/Collateral/ANDLV8075LP-D.PDF) and they say 'Must be short-circuited to VCC pin when using saturation control'. Now what is this suppose to mean? the word 'saturation' doesn't make sense to me \$\endgroup\$ – David Norman Jun 24 '14 at 21:54
1
\$\begingroup\$

Sure you can do that without any problems Just make sure all the grounds (gnd's) are connected together. but do you mean IN1 = IN2 or IN1 = inverse IN2 for the last case you need to put an invertor behind it

If you have any more questions feel free to ask

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
1
  • \$\begingroup\$ I did not mean IN1 = IN2. Is it possible to use OC1A as PWM and OC1B as a generic I/O? \$\endgroup\$ – David Norman Jun 24 '14 at 8:54
1
\$\begingroup\$

Parallax make a h bridge. Hb50. You can link 2 together off the 1 input and control them separately. That way you can have 2 motors working independently of each other but sharing 1 pin on the microcontroller

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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