Pin IN1 of the IC L298 is connected to pin 8 of Arduino while IN2 is connected to pin 9. The following table shows which direction the motor will turn based on the digital values of IN1 and IN2. ON or OFF inputs, while pin 6 needs a pulse-width modulated (PWM) signal to control the motor speed. Since we will be controlling only one motor in this example, we will connect the Arduino to IN1 (pin 5), IN2 (pin 7), and Enable1 (pin 6) of the L298 IC. There are three input pins for each motor, Input1 (IN1), Input2 (IN2), and Enable1 (EN1) for Motor1 and Input3, Input4, and Enable2 for Motor2. The above diagram shows how to connect the L298 IC to control two motors. Components Requiredįollowing is the schematic diagram of the DC motor interface to Arduino Uno board. At these currents, however, you will need to use heat sinks. The L298 can control the speed and direction of DC motors and stepper motors, and can control two motors simultaneously. We will be using the L298 H-Bridge IC here. It is called an H-bridge because it uses four transistors connected in such a way that the schematic diagram looks like an "H." One of the most common application is to control motors in robots. H-bridges are used in many different applications. An H-bridge is an electronic circuit that can drive the motor in both directions. To control the direction of the spin of DC motor, without interchanging the leads, you can use a circuit called an H-Bridge. The DC motor will spin with different speeds according to the value (0 to 250) received via the serial port. The 'if' statement in the next line simply does an analog write with this number, if the number is between 0 and 255. In the 'loop' function, the command 'Serial.parseInt' is used to read the number entered as text in the Serial Monitor and convert it into an 'int'. You need to enter a value between 0 and 255 in the Serial Monitor. When the program starts, it prompts you to give the values to control the speed of the motor. Arduino pin 3 is used to turn the transistor on and off and is given the name 'motorPin' in the sketch. The transistor acts like a switch, controlling the power of the motor. Motor Speed Controlįollowing is the schematic diagram of a DC motor, connected to the Arduino board. Motor will spin in full speed when the Arduino pin number 3 goes high. The transistor acts like a switch, controlling the power to the motor. Second, the striped end of the diode should be towards the +5V power line according to the arrangement shown in the image. The flat side of the transistor should face the Arduino board as shown in the arrangement. Take the following precautions while making the connections.įirst, make sure that the transistor is connected in the right way.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |