![]() ![]() 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. Control the direction of the spin of DC motorįollow the circuit diagram and make the connections as shown in the image given below.We will divide this chapter into three parts − Warning − Do not drive the motor directly from Arduino board pins. If you switch the leads, the motor will rotate in the opposite direction. If you connect these two leads directly to a battery, the motor will rotate. DC motors normally have just two leads, one positive and one negative. There are three different type of motors −Ī DC motor (Direct Current motor) is the most common type of motor. In this chapter, we will interface different types of motors with the Arduino board (UNO) and show you how to connect the motor and drive it from your board. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |