H Bridge motor control - help understanding.

Hi folks,

“Goldfish brain” posting, so I am sorry for the way this is posted.

The other day I was looking at DC motor control for the RPi. Granted that is not an Arduino, but hey, that isn’t the important part.

The control board has the ability to control 2 motors controlled by an H Bridge.

What confuses me is the complexity of it.

Basically there are 8 inputs to the board, and 4 output points for the motors. (2 for each motor).

The power has THREE inputs: An “external power”, Ground, and +5 volts.
The Ground and +5 are from the PI/Arduino. The External power is the one used to control the motor.

So:
Each motor has 4 input pins and that is where I get confused.

The board has a big CHIP on it which is a motor controller kind of thing.

Sorry I can’t post the link - goldfish brain, remember.

But it is pretty “simple” to control. You have a sort of “activate” pin, and two to control the direction.

So it goes something like:
Set the two control lines high, then use the other two to control the direction of the motor.
BUT!
It doesn’t explain why you need two “enable” pins?
The direction examples are forward, 2 seconds, pause 2 seconds, reverse 2 seconds, pause 2 seconds, repeat.
So the “direction” pins go something like:
LOW, HIGH
HIGH, LOW
LOW, LOW

But there again, it doesn’t say what happens if you put both lines HIGH!!

Ok, I need to research, but I am putting the question out there.

Anyone mind helping me?

P.S.
Found the link:

Thanks in advance.

Sorry I can't post the link - goldfish brain, remember.

I have no idea what that means, but assuming there's a reason you can't post a link, what's the control board part number, and / or what's written on the

big CHIP ... which is a motor controller kind of thing

It is unusual, afaik, to have 4 inputs per motor. From memory the L298 has 3 (2x polarity and 1x enable) while others like Pololu's 2130 (DRV8833) has only 2 since there is no explicit enable.

Post some more detail of the equipment, goldfish brain (whatever that means) notwithstanding.

Well,

At the bottom, I posted I found the link.

If you watch the video, there are FOUR lines to control the motor.

As I found that video, I got the part number, and am looking at the data sheet.

But to watch, it is confusing.

A h-bridge is the electronic equivalent of a DPDT (double pole double throw) switch. It is intended to allow you to route the power forwards of backwards through the motor. A h-bridge usually has 4 transistors (or mosfets) as switches. If you imagine they are arranged like this (don't apply this to any specific h-bridge)

A B C D

then the motor will go in one direction if A and D are on and C and B are off etc. Hence the need for 4 input signals. Usually if you have the wrong ones ON the smoke will escape, so read the instructions very carefully.

...R

Thanks.

Granted how you explained it.

But it poses the question to me: If you have the 4 "transistors" to switch things - with the stated problem - you can build it your self.

So to "reduce" the problem, that chip was used.

If you watch the clipi about 15 minutes in he shows the code. There are 4 outputs used to control the one motor. But! It is poorly explained. There is an "enable" and two direction control lines. You can see how he "enables" the motor, the using the two direction control lines, control the motor's direction.

But these lines are NOT going to the mosfets/transistors. They go to the CHIP. L298N

Therefore: If they made the chip "better" they could do it with 2 lines: "Enable" and "Direction" You send signals to the CHIP and it works out which mosfets to turn on/off.

That way: You can't have the wrong combination to allow the magic smoke to escape.

Or am I still missing something?

Ok, I've viewed the vid and it is indeed an L298N driver. it is very weird to me that that control board doubles up the enable pins. If you look at the L298N data sheet, there is only one enable pin per motor. So why that board has 2, and why they both need to be connected to the micro, I have no idea.

I suspect that they have simply broken out 2 pins from each enable- for whatever reason- and that it's unnecessary to connect them both. I have a 298 on a MotoMama board, and there is only one enable pin broken out per motor: and why not, since there's only one enable per motor on the chip in the first place.

The L298N requires that to run either motor, its enable must be high and the inputs hi/lo for one direction and lo/hi for the other.

This looks like that board, and Look! the enable pins on either side have a jumper on them.

I'm wondering if one of the 2 pins is actually the enable, and the other is 5v so that the jumper permanently enables the motor without the need for control?

EDIT.... Figure 6 of the datasheet shows there's no harm in making the inputs the same, either hi or lo. With the channel enabled, then if the inputs are the same the motor is braked. With the channel disabled, the motor is free-wheeling under all combinations of input.

Robin2:
A h-bridge is the electronic equivalent of a DPDT (double pole double throw) switch. It is intended to allow you to route the power forwards of backwards through the motor. A h-bridge usually has 4 transistors (or mosfets) as switches. If you imagine they are arranged like this (don’t apply this to any specific h-bridge)

A B
C D

then the motor will go in one direction if A and D are on and C and B are off etc. Hence the need for 4 input signals. Usually if you have the wrong ones ON the smoke will escape, so read the instructions very carefully.

…R

The 298 has 2 inputs per channel, 3 if you count the enable. I think the OP was asking why there were 4 in the sense of those 3 plus a spurious enable making 4 total. (As I posted above, I think that spurious enable is actually a 5v to jumper to the enable ro make it unncessary to enable a channel from the micro)

Pololu’s 2130 has only 2 per channel, no explicit enable.

EDIT… BTW, can anyone identify that board in the video? I know it’s as 298 chip 8) , but I’m trying to find a datasheet for the board. I find loads of photos of it, mostly ebay sales, and they don’t identify the board. I’d like to check that the 2x “enable” pins on each side are in fact 1x enable pin and 1x 5v pin to jumper.

MORE EDIT… I found this which I speculate is an earlier, no longer supplied, version of the same board, and there is no “2nd enable” on either side. That would lead me to conclude that the 2nd oin is indeed a 5v supply for jumping to the enable, added as an enhancement. Makes sense- why waste 2 pins when on some micros there are too few anyway, as long as it’s ok for the motor to be enabled all the time.

The reasons that some circuits appear to have a redundant "enable", is so that you can put PWM into one of them and a more straightforward on/off digital signal into the other one.

From one of the pics in the vid that board has jumpers for each enable pin, so there are only 2 enables, and an extra pin to HIGH that can be jumpered to the enable to save you having to deal with it (well that's my theory without watching the whole video, but you can see the jumpers).

michinyon:
The reasons that some circuits appear to have a redundant “enable”, is so that you can put PWM into one of them and a more straightforward on/off digital signal into the other one.

Could be that then. Although that wouldn’t explain why in some pix of (what I think is the same board) they’re jumpered.

My money’s on the back pin being 5v. Bit speculative on my part though, without knowing the make of the board and finding some words about it.

Data sheet for the L298 chip. In the past I've seen reference to paralleling the two h-bridges in this chip for increased current for a single motor. I think in some instances with some h-bridges, the enable pin is/can be used as the PWM control for the h-bridge.

https://www.sparkfun.com/datasheets/Robotics/L298_H_Bridge.pdf

zoomkat: Data sheet for the L298 chip. In the past I've seen reference to paralleling the two h-bridges in this chip for increased current for a single motor.

It's in the datasheet for the L298 - but only one of those datasheets (that I have found) show the DC motor control reference schematic, and how to use the bridge in paralleled mode for 4A single-motor control (the other datasheet only shows the stepper schematic, and makes reference to the DC motor and paralleled mode, but doesn't have a schematic for it).