How to connect the MCU with L298N and relay? When to choose L298N or relay module?
The main control chip is L298N dual H-bridge motor drive module, the drive voltage is 5~35V, generally drive the DC motor forward and reverse generally use L298N.
VCC: There are one 12V port and one 5V port. For example, to control a 12V DC motor, connect the positive pole of the 12V power supply to the 12V pin.
GND: Connect the negative pole of the battery to this pin, and also connect the GND of the microcontroller to this pin.
ENA/ENB: enable port, only when ENA port is high level, IN1, IN2 can be used, when ENB port is high level, IN3, IN4 can be used.
IN1/2/3/4: Control port. 1/2 controls OUT1 voltage output, and 3/4 controls OUT2 voltage output together. Such as: IN1=1, IN2=0, output ports OUT1 and OUT2, output positive voltage, the motor rotates forward, otherwise the motor reverses; IN3, IN4 are the same.
OUT port: directly connected to the motor, 12 groups, 34 groups.

As a switch, it is used to control large current with small current, like the electromagnetic door lock can use the relay module as a switch. Although the use of relays to control the forward and reverse rotation of the DC motor can be achieved, it is more complicated and requires two relays to be cross-connected.
DC+: Connect the positive pole of the power supply, for example, to control a 12V load, connect the positive pole of the 12V power supply to this pin, and the negative pole to DC- (the voltage is 5V.9V.12V and 24V according to the requirements of the relay).
DC-: Connect to the negative pole of the power supply.
IN: The control signal input terminal can control the relay pull-in at high or low level, and the single-chip microcomputer control can set the relay module to low level control.
NO: Normally open interface of the relay. The relay is suspended before the relay is closed, and shorted to COM after the relay is closed.
COM: Relay common interface
NC: Normally closed interface of the relay, the relay is short-circuited with COM before pull-in, and hangs up after pull-in
When the last three ports are not input at IN, NC and COM are short-circuited. When IN input is high or low (see whether it is set to high or low), COM and NO Short.
First, introduction A DC motor is a motor that converts DC power into mechanical energy, which is widely used in electric power drag due to its good speed control performance for driving a variety of ...
The principle and application of the most complete H bridge motor drive module L298N H Bridge -Basic Knowledge The static operation of the H bridge H-bridge control motor Motor is right control Motor ...
This article will briefly introduce how to passL298N motor drive moduleRealize the positive and reverse control of DC speed reducer (electric push rod), follow-up to update the tutorial containing PWM...
This post is an actual combat plus summary after referencing many blogs. The reference link is as follows: Arduino smart car tracking Not applicable to PWM speed regulation, completely solve the probl...
Article Directory L298N motor drive module PWM speed control principle DC motor wiring PWM code L298N motor drive module The L298N motor drive module can directly drive two 3-16V DC motors, and provid...
The motor drive module is often used in electronic production. The following uses L298N model module as an example to introduce its use method. The module pin descriptions are as follows: It is...
Features Use the buttons on the STM32-PZ6806D development board of Puzhong Technology to control the motor forward and reverse, start, stop, and connect the PWM output wave to the LED light of the dev...
Arduino foundation entry series Arduino development board drives DC motor by using L298N motor drive module Arduino self-written note, just after a meal, etc., it is a four-year purchase for his unive...
Introduction to the use of L298N module as the picture shows: This is an integral part of L298N Let's start to analyze and explain one by one 1. First, supply voltage of L298N As shown in the figure, ...
The module pin description is as follows: Note: Built-in 5V power supply, no need to connect 5V input from outside Enter information: The pins of ENA and ENB are respectively connected t...