Arduino DC motorThe DC motor is considered as the simplest motor, which has various applications ranging from households to industries. Example includes an electric window in cars, electric vehicles, elevators, etc. The principle of the DC motors is based on Electromagnetic Induction. It means that the rotation of the motor depends on the force generated by the magnetic fields. It converts electrical energy into mechanical energy. Such motors can be powered from the direct current. Let's discuss how the DC motor works. Working of DC MotorThe DC motor consists of a stator, rotor, armature, and a commutator. The commutator comes with brushes. There are two stationary magnets in the stator that are responsible for producing the magnetic field. The armature present in the DC motor carries the alternating current. Electrical energy is converted into mechanical energy in the form of torque by the armature. It further transfers this mechanical energy via shaft. The commutator is defined as the electrical switch. It can also reverse the direction of the current between the external circuit and the motor. The brushes act as an intermediate between the external power supply and the rotating coils. The iron core at the center is wrapped with insulated wires concentrating on the magnetic field when current passes through the wires. The windings of insulated wire have many turns around the core of the motor. The wire ends are connected to the commutator. The commutator further energizes the armature coils and connects the power supply and the rotating coils through brushes. Advantages of DC motorsThe advantages of using DC motors are listed below:
The DC motor looks like the image shown below: Let's start with the project. We will discuss two projects of the DC motor. Project 1:Here, we will discuss the simple connection of a DC motor with the Arduino board using diode, transistor, and resistor. Hardware RequiredThe components required in the project are listed below:
Structure of the projectThe structure of the project is shown below: SketchConsider the below code: Steps to upload the code to the boardThe steps are listed below:
ConnectionThe steps to set up the connection are listed below:
Connection DiagramWe will show the connection using the Simulator so that the connections become clearer and more precise. We can make the same connection using the hardware devices. After making connections, the motor will rotate. Project 2:Here, we will discuss the connection of a DC Gear motor with the Arduino board using the L293D H-Bridge motor driver. Let's discuss the need to use the L293D H-Bridge motor driver with the DC motor. L293 is defined as the motor driver IC that permits the DC motor to drive in any direction. It can also simultaneously control two DC motors. It is a 16-pin Integrated Circuit (IC). It receives signals from the microprocessor present on the Arduino board and transmits this signal to the motor. It has two VCC or voltage pins, where one pin draws current for its working and another is used to provide voltage to the DC motor. The motor usually requires high current for its operation. We can use the microcontroller present on the Arduino, but high current might damage the microcontroller. To overcome this, the motor driver is used. L293D is one of the most popular motor drivers used to drive the DC motors. It can run DC motors up to 1 Ampere current load. The four outputs present on the L293D driver makes it suitable for driving the 4-wire stepper motor as well. We can also drive servo motors using the L293D driver. L293D PinoutThe pinout of L293D is shown below: Hardware RequiredThe components required in the project are listed below:
SketchConsider the below code: ConnectionThe steps to set up the connection are listed below:
Connection DiagramWe will show the connection using the Simulator so that the connections become clearer and more precise. We can make the same connection using the hardware devices. The 'Slow' mode of speed will cause the motor to rotate at a slow speed. We can also change the mode to fast or normal, as explained in the code. We can also add more speed parameters to the code as per our requirements. Next TopicArduino Nano |