logo elektroda
logo elektroda
X
logo elektroda

L298 H bridge module - review and opinion

grala1 6834 12
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • Today I will try to introduce you to the H bridges.
    The H-bridge is an electrical system that allows you to change the direction of a DC motor by reversing the polarity of the voltage at its output. Such a bridge can be made of e.g. relays, transistors or a ready-made integrated circuit can be used.
    The name comes from the graphic representation of the layout. Such a bridge is made of 4 contacts which are switched in pairs.
    Below is a graphic representation of the H.
    L298 H bridge module - review and opinion

    The contact S1 and S4 form one pair and the contact S2 and S3 form the second pair. Switching on one pair of S1-S4 results in a positive potential on the left pole of the motor and negative on the right pole. Switching on the second pair, S2-S3, causes the reversal of this polarity, which changes the direction of the current flow and, as a result, the direction of rotation of the motor.
    Building an H bridge on relays is quite simple and does not require complicated control. However, this solution has some disadvantages - contact resistance, contact life and its number of contacts. By adding a transistor to this system, we gain an additional function thanks to which we can regulate the speed of the motor powered from such a bridge.
    You can also use bipolar transistors or MOSfets to build bridges.
    With the above-mentioned bridges, it should be noted that during their control, a certain state appears which can be said to be forbidden, i.e. we cannot control all our contacts at the same time, we can only control pairs S1-S4 or S2-S3, otherwise the system will create short circuit.
    H bridges are used quite often, for example, in the construction of sumo, micromouse or linefolower robots, they can also be found in power steering systems in cars.

    A bit of theory behind us so we already know what it is and what it is for. Now we can take care of our layout on the subject. The L298 is a double H-bridge in a Mulitwatt 15 housing. The word "double" here means that in one housing we have two separate bridges, which will allow us to operate two DC motors.
    The module discussed here is a ready-to-use system where, after connecting the power supply and connecting the engine, we can start playing with the engine.
    Below is a photo and description of the connectors and outputs of this module.
    L298 H bridge module - review and opinion

    Below is a diagram of the module.
    L298 H bridge module - review and opinion

    As you can see from the photos and the diagram, we have two power supplies here - one to power the motor, the other to power the bridge logic. The manufacturer of the board stated that the logic power supply is 5VDC and the motors are 12VDC. Looking at the documentation, we can find that the logic power supply can be 4.5-7VDC and the power supply for motors up to 46VDC. However, looking at the board, we can see that the capacitors used here are for voltage up to 35V, so we should not exceed their voltage.
    On the board we can also find a 78M05 stabilizer in the TO-252 housing, the supply voltage of which is in the range 7-35V, which means that if we want to supply the motors with a voltage lower than 7V or higher than 35V (but here we are limited by capacitors), it would belong to the ARK connector connect 5V and remove the power jumper which supplies power from the stabilizer to L298. If we are going to use motor power supply in the 7-35V range, we can only supply the motors to the ARK connector and leave the jumper on. In addition, the board has a LED indicating that the voltage is appliedon the logic of the system and diodes protecting against overvoltages when the motor winding is disconnected. On the PCB, we have two more ARK connectors for connecting two motors and a goldpin strip with descriptions: ENA, IN1, IN2, IN3, IN4, ENB. These are the inputs for controlling our bridge. ENA enables operation of the OUT1, OUT2 outputs, and ENB enables the OUT3, OUT4 outputs. The EN input can be used in two ways - the first is to leave the jumpers in their places, where for control it is enough to give the high states to the IN inputs or remove the jumpers and to the lower row of goldpins in place of EN, give the PWM signal thanks to which we will be able to regulate the motor speed or obtain soft start and engine stop.

    Earlier I wrote about controlling pairs of contacts. In the L298 system, our pairs S1-S2 correspond to input IN1, S3-S4 to input IN2 for the first bridge (OUT1, OUT2 output), input IN3 and IN4 are pairs S1-S2 and S3-S4 of the second bridge (output OUT3, OUT4). You remember from what I wrote earlier, when controlling two pairs at the same time, the forbidden state appears - here, in the L298 circuit, such a state will not occur, as you can see in the block diagram of this bridge below.
    L298 H bridge module - review and opinion

    In case of the appearance of identical logic states on IN1-IN2 or IN3-IN4, there will be no short circuit. When a low state appears at both inputs at the outputs at the same time, we will have minuses, while at high states at the inputs at the outputs, there will be pluses, so there will be no short circuit, nor will our motor start. If we want to drive our motor to the right we give "1" to IN1 or IN3 or when we want to drive it to the left we give "1" to IN2 or IN4.

    Our bridge allows us to power the motor consuming 2A current, the bridge is able to give us 3A in the "peak".
    The L298 system has two inputs which the PCB manufacturer did not use. We are talking about pins 1 and 15 called "Current sensing A" and "Current sensing B", which, when connected in series with properly selected resistors to ground, are used to control the load current.

    Below is a short program written in BASCOM, where we can adjust the speed and direction of the motor rotation with the use of four buttons. The speed control only works when the engine is stopped. The program starts with a PWM filling of approx. 49%. Remember that when the PWM frequency is too high, the motor will lose power and that the motor will stop with a higher filling and not only with a filling equal to zero.
    Code: VB.net
    Log in, to see the code


    Below is a short video of how it actually works.
    [movie: 3fe4699d3f] https://filmy.elektroda.pl/83_1528077404.mp4 [/ movie: 3fe4699d3f]

    This module can also be used to control a unipolar stepper motor. It is enough to connect the common terminals of the coils together and connect them to ground, and connect the four ends of the coil windings to the OUT1-OUT4 outputs. The ENA and ENB jumpers should be left here because here the speed control is achieved through the delay between the coils and not the PWM control.
    Below is a program written in BASCOM where we have two buttons - one allows the engine to move to the right, the other to the left. Each button press takes one sequence - 4 steps. Holding the button will repeat the sequence, i.e. as long as you hold the button, the engine is spinning. Changing the "Waitms 15" time will cause the motor speed to change.
    Code: VB.net
    Log in, to see the code


    Below is a video of the action.
    [movie: 3fe4699d3f] https://filmy.elektroda.pl/68_1528077512.mp4 [/ movie: 3fe4699d3f]

    This module can also be used to control a bipolar stepper motor. In the case of controlling stepper motors, the L298 acts as an "amplifier" of the input signal.

    This module is quite popular and cheap. You can mock it from Allegro for a shipping price from PLN 15.49 or on Aliexpress for a price from $ 1.28 including shipping.
    Module dimensions: 44x44x30mm.
    L298 H bridge module - review and opinion L298 H bridge module - review and opinion L298 H bridge module - review and opinion

    Finally, a few oscillograms.
    Output with connected DC motor.
    L298 H bridge module - review and opinion

    Output without connected DC motor.
    L298 H bridge module - review and opinion

    Output (yellow) and input (green) with connected unipolar motor.
    L298 H bridge module - review and opinion

    Output (yellow) and input (green) without unipolar motor connected.
    L298 H bridge module - review and opinion

    Cool? Ranking DIY
    About Author
    grala1
    VAG group specialist
    Offline 
    grala1 wrote 9760 posts with rating 4852, helped 1477 times. Live in city Kalisz. Been with us since 2006 year.
  • ADVERTISEMENT
  • #2 17257162
    tronics
    Level 38  
    Almost beautiful :) Almost, because this part doesn't fit a bit here:
    Quote:
    we cannot control all our contacts at the same time, we can only control pairs S1-S4 or S2-S3, otherwise there will be a short circuit in the system.

    Is any other connection really prohibited? No. S1-S3 and S2-S4 yes, because it is a short circuit on the power supply and that is why there are gates preventing them from being driven in this way. And is S1-S2 or S3-S4 not practical? (only a colleague writes that the engine will not start) ;) Has. And probably even in the L298 it is used (giving the same signal to both inputs = fast motor stop). This is also used in the 3f bridges :)
  • ADVERTISEMENT
  • #3 17257407
    nomek
    Level 18  
    Here is the error quot: "AC motor" - it should be DC.
  • ADVERTISEMENT
  • #4 17257794
    szeryf3
    Level 29  
    Well, a nice and quite interesting friend went to the topic.
  • #5 17258268
    TechEkspert
    Editor
    Interesting material, I had the opportunity to test a similar module with the L298 and it is quite convenient for experiments and quite resistant to damage.
    At the end of the trials, I made a pseudo inverter on the Arduino L298 and transformer.
    Everything worked fine for a while, but at some point the L298 broke (caused a short circuit in the 12V power line).
    I suspect that the overvoltage from significant inductance damaged the system.

    Here are the details of the trials: H-bridge and inverters .
  • #6 17258343
    krzbor
    Level 27  
    It seems to me that pins 1 and 15 of L298 are connected to ground. Diagram and description suggest they are disconnected.
  • #7 17258430
    TechEkspert
    Editor
    According to the scheme below, 1 and 15 are connected to ground:
    Electronic schematic of H-bridges with ground connections on pins 1 and 15.
    if we put the resistors in series, we can measure the current for each bridge separately.
  • #8 17258598
    krzbor
    Level 27  
    TechEkspert wrote:
    According to the diagram below, 1 and 15 are connected to ground

    In this diagram, they are connected to ground via Rsa and Rsb. The presented circuit does not have Rsa and Rsb, and the pins 1 and 15 are connected directly to ground - I mean the "Module diagram" drawing, where pins 1 and 15 are not connected.
  • #9 17258862
    kilioo
    Level 12  
    The H bridge can be used for many things, not just engines. Have you ever heard of one made of transistors? It is not described in detail how the protections between the switched keys work, which is of paramount importance for the correct operation of the system.
  • ADVERTISEMENT
  • #10 17258905
    grala1
    VAG group specialist
    tronics wrote:
    Almost beautiful :) Almost, because this part doesn't fit a bit here:
    Quote:
    we cannot control all our contacts at the same time, we can only control pairs S1-S4 or S2-S3, otherwise there will be a short circuit in the system.

    Is any other connection really prohibited? No. S1-S3 and S2-S4 yes, because it is a short circuit on the power supply and that is why there are gates preventing them from being driven in this way. And is S1-S2 or S3-S4 not practical? (only a colleague writes that the engine will not start) ;) Has. And probably even in the L298 it is used (giving the same signal to both inputs = fast motor stop). This is also used in the 3f bridges :)


    Read to the end.
    grala1 wrote:
    As you remember from what I wrote earlier, when controlling two pairs at the same time, the forbidden state appears - here, in the L298 circuit, such a state will not occur, as you can see in the block diagram of this bridge below.
    In case of the appearance of identical logic states on IN1-IN2 or IN3-IN4, there will be no short circuit. When a low state appears at both inputs at the outputs at the same time, we will have minuses, while at high states at the inputs at the outputs, there will be pluses, so there will be no short circuit, nor will our motor start.

    You quoted the part concerning the general description of the H bridge and you write about the L298, which I described later, and I think that it is sufficiently explained why, for example, a short circuit in this particular bridge will not occur.
    Not writing only that it will not move and I will explain what will happen.
    Should I translate everything - reading schematics, logic gates, everything that is in the documentation of this circuit?
    Let's not exaggerate :)

    nomek wrote:
    Here is the error quot: "AC motor" - it should be DC.

    Thanks for paying attention. It has been corrected, I don't know why it turned out that way :(

    krzbor wrote:
    It seems to me that pins 1 and 15 of L298 are connected to ground. Diagram and description suggest they are disconnected.

    You are right, I did not include it in the diagram, I have already corrected it. These inputs are pulled up to the ground.
    In the description I did not write anything about the fact that they are not connected. I wrote that they are not used, which could actually be understood by mistakenly following the earlier diagram. I meant something else - direct connection of these inputs to ground turns off the L298 load current monitoring.
  • #11 17258917
    tronics
    Level 38  
    Quote:
    Read to the end.

    I read, there was nothing about braking like this, and the only braking is regarding soft start and stop by pwm on enable :) And there is a difference between free braking and electrodynamic braking. As for me
    Quote:
    When a low state appears at both inputs at the outputs at the same time, we will have minuses, while at high states at the inputs at the outputs, there will be pluses, so there will be no short circuit, nor will our motor start
    it does not reflect either the applicability or the sense of using such a state - of course for people for whom this article is intended, because the rest understand and without the article, they look at the note.
  • #12 17262917
    coolrob
    Level 15  
    @ grala1 this first schematic is from Corcodile Clips? :D

Topic summary

The discussion revolves around the L298 H-bridge module, which is used to control the direction of DC motors by reversing voltage polarity. Participants clarify the operation of the H-bridge, emphasizing the importance of avoiding short circuits by correctly switching pairs of contacts. There are mentions of using the L298 for various applications, including experiments and inverters, with some users sharing personal experiences regarding its durability and potential failure due to overvoltage. The conversation also touches on the schematic details, grounding connections, and the differences between braking methods in motor control. Overall, the L298 is recognized for its convenience in experimentation, though caution is advised regarding its limitations and potential damage from improper use.
Summary generated by the language model.
ADVERTISEMENT