Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by Rich!

H-Bridge Speed Control

Evening All

I'm working with H-Bridges and am having trouble finding the controls to regulate speed. I've followed the tutorial which directs me to use the PWM slider to regulate speed however I can't locate this control. When I open the Control tab this is all I see:

User-inserted image

Any suggestions? My board interface is different from the one in the tutorial.



AI Support Bot
Related Content
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
@Mulberry you'll need to have the enable lines on the motor driver board hooked up to a couple (or just 1) digital pin(s) in order to use the PWM sliders to adjust speed, it is shown on the tutorial video but not the diagram. The Diagram shows the enable lines tied to +5V (always enabled) with jumpers but DJ uses wires connected to the EZ-B in the video example. It is possible to PWM the input lines in order to trim speed but you would have to write your own custom EZ-Script to do it. That being said, a custom script is pretty straight forward. If you'd like to go that route and meet any challenges just post again and the community is sure to give you the advise you need.
Jeremie, he'll need both (not 1) pwm if using the hbridge speed control - otherwise the robot won't turn:)
Just meant that you soldered 2 enable connections to 1 wire in the video so you could only use 1 Digital to control PWM. Sorry man, should have been more clear.
No, he needs two separate pwm or the robot won't turn if using the hbridge speed control.:)
The HBridge Control and the HBridge PWM Speed Control are similar but different. The HBridge control simply turns on and of the bits to control movement direction. The HBridge with PWM will use the PWM to control variable direction steering. When you combine the HBRidge PWM with Joystick, you can use the analog joystick to adjust fine tune steering.

Here's an example:)

United Kingdom
@Mulberry have a look at the L298n H-bridge tutorial I wrote. There are some photos of the L298n and these terminals (they have jumpers across when you get it delivered).

My method uses one jumper to both PWM pins - this is an old photo done before the speed control was in ARC. While it will work with one on PWM and both speeds set the same it doesn't work correctly so 2 jumpers are required as DJ has said, or use a different control (one without speed or even the custom panel and script it for a single speed control)

The tutorial I linked to should also explain to you how a H-Bridge works etc. and give you a better understanding, one you understand how things work they are much easier to work with:)
Ah! My H bridge doesn't have the enable pins shown in the video (around 5:07) for the PWM wire. I thought perhaps the new bridge design or software update resolved that step. Below is an image of my bridge. So clearly I don't have an enable connection. Question is where do I connect them?

User-inserted image
United Kingdom
I'm on my phone so can't see very well but it looks like you do, the row of pins behind the in1 to in4 have jumpers between 5v and ena and enb. Remove the jumpers and pwm the ena and enb pins.
Excellent Rich. There they are. You have been a tremendous help with all the questions I've asked.

Thank you!

United Kingdom
OK now I am home so I can see it better.

You have PWM, they have jumpers connected to 5V which need removing. These are indicated by the yellow box I have added to the photo below.

Then take 2 Digital ports and connect the signal to the ENa and ENb pins (the outer 2 pins, they do have labels on the board) as indicated by the 2 white lines I have shown in the photo below.

User-inserted image

Edit: Posted that at the same time you replied:) But the info is there for anyone else who may need it.
Yep, Rich is right. Take the little jumper clips off. Those are the pins you attach to for PWM. You have two sets here. One for each motor connected to the H-bridge. Like Rich mentioned earlier; you can jumper across the two sides on the H-bridge, use one enable wire back to one EZB digital port and have one PWM slider control in ARC for both motors and each should move at the same speed and at the same time. However, you also can leave out the jumper mentioned above between the two sides and then run a separate enable wire for each (motor) back to EZB to different digital ports. You then need to install two controls, (a PWM slider) for each side (motor) in ARC and set it to the proper ports. This will give you individual speed and enable control for each motor. Remember, you need to either move the slider up off of Zero in the slider or set the speed in a script to get the motor to start moving. Mine wont start till I get it above 15 or so but all motors are different.

What are these motors going to move on your robot? Is this by any chance a full sized B9? ;)

Have fun, Dave Schulpius
Hi Dave

Yep. Its me from San Francisco :D and you're right about the B9. I want to control my waist rotation and my soil sampler with this bridge. I'm using two EZ boards (following in your lead): one for the leg/tread section and then one for the torso/brain.

I'm slowly getting there :P

Hi Daniel,
Welcome to the EZ life. Glad to see you here. you are good to love it.

What are the amps each of the motors pull. make sure your hbridge is rated to handle them. What hbridge are you using here?
Hi Dave

I'm using the H bridges sold through EZ Robot. They're rated at 2.5. The heaviest motor I'm using is a Dewert and they're rated at 1-2 amps. At least that's what I found on the B9 Builder's Club. As far as I can tell that's correct...I hope.

Okay, here's my fear. The motor is rated at 2 amps. The H bridge is 2. 5. Why back voltage can be almost twice as high as supply voltage. This happens when you reverse the DC motor quickly. Soul, if you do the map, you're fly back voltage can be more than 4 amps. This will burn out your fridge. It happens to me and I am using the same motors you are
United Kingdom
Is there any way to block flyback current? Diodes or something? This (flyback) is all new ground for me so it's very interesting.
Well, you cant really block the flyback voltage but you can bleed it off to ground through quick switching Shottky diodes. Here's a post I made last year when I was destroying H-Bridges and trying to figure out why:

I've come up with why I'm destroying h-bridges. I installed another working one and got things working properly with the H-Bridge movement control in ARC. Push an arrow, push Stop, push the other arrow and the motor would reverse nicely. I did that a few times and all went well until....... I decided to switch the motor direction back and forth without pushing the "Stop" button. Well, it did change direction a few times nicely but then it just locked on in one direction again and would not respond. Remember, I'm supplying 24vdc through the H-Bridge to the DC motor (which is OK).

The problem happens when I reverse the motor quickly and it sends a serge back into the H-Bridge causing damage. I read that this is normal and dammage happens when there is no protection diodes to block the back shock. Seems that the back voltage ( counter-electromotive force also known as back electromotive force) can be as high as twice the supply voltage. So the answer is to surround the motor with Protection Diodes and a of course a fuse. The best type of diode to use is a very quick switching diode and they recommend a Shottky diode rated just above (not below) the value of the supply voltage and rated above the current you will pull. In my case I need a 30v, 3 amp diode sense my supply voltage is 24vdc and my motor pulls just above 2 amps under load (a 1N5821 is just right). Well, now to build the circuit and see if it helps. They also suggest adding caps to save the motor and add more power smoothing. Here is a drawing of how it should look:

User-inserted image


Here's a picture of one of the diode protection boards I made to keep the flyback voltage away from my h-bridge. It's the little tan one on the left:

User-inserted image

Most people building small robots with small DC motors will not have this problem. I'm running a couple small DC motors that turn my Radar and Ears and have no protection diodes. No problems with them. It the bigger DC motors that turn my robots waist and bend the hips that were blowing my H-Bridges. I suspect this has been the problem of a few people on this forum that has had problems with one side of their H-bridge not working and it not being a faulty product. Perhaps it was working properly till Flyback voltage took it out. Well never know though.

Hope this helps.
Dave Schulpius
I just wanted to note that the 2.5A L298 motor control board we have in our store does include the flyback diodes, so you don't have to worry about back EMF voltages from your motors as they dissipate voltages up to 1000V.

While I'm here:) One thing I would recommend if you are using the L298 near it's current limits and finding that it is thermally shutting down is to use a lager heat sink on the back of the chip or a fan on the current heatsink to keep the L298 cooler. The L298 will be able to run as long as it doesn't reach it's internal thermal limit.
Ahh yes, I forgot to mention that there are motor controllers and h-bridges out there that have this protection built in. Pololu also has a few fine boards that use this.