ECEL LAB#3 Angelada
ECEL LAB#3 Angelada
Angelada BSECE-4A
One of the reasons DC motors are preferred over other types of motors
is their ability to precision control their speed, which is a necessity for
industrial machinery. DC motors are able to immediately start, stop, and
reverse—an essential factor for controlling the operation of production
equipment.
Types of DC Motors
Each type of DC motor has advantages that must be considered prior to purchase and use. Two of the most
significant advantages of DC motors over alternating current (AC) motors are their ease of installation and low
maintenance requirements.
The connections between the field winding and the armature distinguish DC motors from AC motors. Field windings
can be linked in series or parallel to the armature. The connection can be both parallel and sequential in various
instances.
DC motors are ubiquitous and have a wide range of uses. Every program has its own type. Brush or brushless DC
motors are available. Brushes drive the rotor in brush DC motors. A permanent magnet is used in a brushless DC
motor's rotor. Regardless of your requirement for DC motors, it's critical to grasp each type because they're used
in so many different applications.
DC Motors Types
Brushed DC Motor
A brush DC motor generates a magnetic field by passing
current via a commutator and brush linked to the rotor.
The stator is the container that houses the brush DC
motor's components as well as the magnetic field. Brushes
are constructed of carbon and can be stimulated singly or
simultaneously. A series-wound DC motor or a shunt
wound AC motor is formed by wrapping the coil on the
rotor in series or parallel.
Self-excited DC motors are further divided into shunt, series, and compound. The compound excited type is
separated into cumulative and differential with short and long shunts in each type.
Self-Excited DC Motor
In self-excited DC motors, the field and armature windings are connected and have a single supply source. The
connections are parallel or series with parallel made as shunt wound while the series version is series wound.
Shunt
The field and armature windings in a shunt wound DC motor are linked
parallel to each other. Instead of the opposite way around, the field winding
is exposed to terminal voltage. The speed of a Shunt DC motor remains
constant regardless of the mechanical load.
Series
A series motor is a universal motor since it can operate on both AC
and DC voltages. In spite of the voltage source, series motors always
rotate in the same direction. On a series DC motor, the field and
armature windings are connected in series to the power source.
Compound
The series and shunt field windings are used in a compound DC motor. The
shunting of the shunt field winding determines whether cumulative or
differential compound DC motors have long or short shunts. The flux in the
shunt fields assists the flux in the series field in cumulative DC motors.
Brushless DC Motor
A permanent magnet rotor and a coil wound stator are used in brushless DC motors. Brushes are not required with
this DC motor design. The benefit of a brushless DC motor is that it eliminates brush wear and tear because the
moving magnet produces very little heat.
Shaft
The shaft, which is at the core of the motor, is rotated by the windings and commutator. To endure the loads of the
application, the shaft is made of a hardened metal, usually steel. The torque generated by the winding is transferred
to the stator-supported shaft.
Terminals
Positive and negative terminals are found on a DC motor. The motor rotates clockwise when the positive wire is
attached to the positive terminal. The terminals are linked to brushes and brush arms inside the back cover of an
electric motor and provide electricity to the motor.
Magnets
Permanent magnets are the magnets utilized in DC motors. This implies that their magnetic field is constantly active.
Magnets with opposite ends attract, while magnets with similar ends repel. A DC motor has two magnets around the
rotor so that a strong magnetic field travels through it.
Rotor
The rotor is the motor's dynamic component that generates mechanical rotations. The rotor, also known as the
armature, is made up of several disks that are separated by laminated sheets. Eddy currents exist, but they are much
smaller and do not affect the motor's operation.
Coil Windings
Because two coils tend to jam and halt the motor, DC motors must have at least three to assure smooth rotation. A
strong and intense magnetic field is created by coiling the wire. Each coil is offset by 120 degrees from the one before
it. The rotor's rotation grows smoother as more coils are put to it.
Brushes
A DC motor's brushes give power to the coils and are metal components that behave as springs. Brushes are pressed
against the commutator by their spring action. The brush arms hold them in place, and they are directly attached to
the terminals or electrical supply.
Commutator
Small copper plates are attached on the shaft and rotate as the shaft rotates, forming the commutator. The poles of
the power supply shift due to the spinning of the rotor. Each coil is connected to two commutator plates that are
electrically isolated yet linked via the coils.
This L298N Motor Driver Module is a high power motor driver module for driving DC and Stepper Motors. This module
consists of an L298 motor driver IC and a 78M05 5V regulator. L298N Module can control up to 4 DC motors, or 2 DC
motors with directional and speed control.
L298N Module Pinout Configuration
IN1 & IN2 Motor A input pins. Used to control the spinning direction of Motor A
IN3 & IN4 Motor B input pins. Used to control the spinning direction of Motor B
The L298N Motor Driver module consists of an L298 Motor Driver IC, 78M05 Voltage Regulator, resistors,
78M05 Voltage regulator will be enabled only when the jumper is placed. When the power supply is
less than or equal to 12V, then the internal circuitry will be powered by the voltage regulator and the 5V pin
can be used as an output pin to power the microcontroller. The jumper should not be placed when the power
supply is greater than 12V and separate 5V should be given through 5V terminal to power the internal
circuitry.
ENA & ENB pins are speed control pins for Motor A and Motor B while IN1& IN2 and IN3 & IN4 are
direction control pins for Motor A and Motor B.
▪ To make a program using Arduino platform that will control the DC motor using PWM pin of the
Arduino
▪ To drive a DC motor with the use of Arduino PID controller
▪ To create a simple design application program either using the DC motor or PID controller.
▪ DC Motor
▪ Potentiometer
▪ Arduino Uno Board
▪ PicsimLab
▪ Arduino IDE
Software used:
▪ Picsimlab
▪ Virtual Serial Ports
▪ Arduino IDE
Materials used in Design Application:
▪ 9V battery
▪ L298N motor driver
▪ DC motor
▪ Arduino Board
▪ DHT22 temperature and humidity sensor
▪ Connecting wires
IV. Diagram
V. Procedure
▪ In this experiment, we re tasked to make a program using Arduino platform to control the DC motor
using the PWM pin of the Arduino Uno Board.
▪ The DC motor shaft must turn 15, 25, 50, 100 and 180 degrees that was set by the pulse width using
the pulse width modulation.
▪ The DC motor movement will base on the PWM and dependent on the PID controller, the Kp, Ki and
Kd will be set the potentiometer connected to the analog input of the Arduino board.
Before we can start with the simulation we need to establish the software and libraries needed in order to run the
experiment.
We need to create the connection in the Virtual Serial Ports since we are using virtual components that is
more convenient. Just like in the previous experiment the connection in the Virtual Serial ports is in COM 1
and COM 2.
Next, set up the needed components in the PicsimLab, go to “spare parts window” and choose the DC motor
as the “Output”, for the “Input” choose the potentiometer, and go to “Modules” menu and choose the
Oscilloscope to display the graph later on.
The “Properties” in the Picsimlab is shown below:
After that, we will now move on to creating the code based on the condition given start of the
procedure. After the code is compiled without error/s, upload the hex code. That can be done by clicking on
the “Sketch” menu in the Arduino IDE then choose “Export Compiled Binary”. Make sure to remember the file
location because that hex code will be used to run the simulation in the PicsimLab. The code for Arduino is
provided below.
// ECEL-12 LAB#3
//use standalone version of the L293 library
#define use_standalone
//import the library in sketch
#include <L293.h>
//initialize L293 control pins
const int speedPin = 3; //INPWM
const int forwardPin = 5; //INA
const int reversePin = 6; //INB
int pot; //potentiometer input
float DC; //create an instance of the L293 library
L293 DCmotor(speedPin, forwardPin, reversePin);
void DutyCycle() {
pot = analogRead(A0);
if (pot >= 0 && pot <= 205) { // the potentiometer is divided into five portions
DC = 255.0*0.15; //15% duty cycle
}
if (pot >= 205 && pot <= 510) { // the potentiometer is divided into five portions
DC = 255.0*0.25; //15% duty cycle
}
if (pot >= 510 && pot <= 715) { // the potentiometer is divided into five portions
DC = 255.0*0.50; //50% duty cycle
}
if (pot >= 715 && pot <= 920) { // the potentiometer is divided into five portions
DC = 255.0*0.75; //75% duty cycle
}
if (pot >= 715 && pot <= 1023) { // the potentiometer is divided into five portions
DC = 255.0*1; //100% duty cycle
}
}
void setup() {
}
void loop() {
DutyCycle();
DC = map(pot, 0, 1023, 0, 255);
DCmotor.forward(DC);
}
This time, go to the Picsimlab click the “File” menu and choose the ‘’Load Hex”, that is the hex code from
Arduino and observe the results.
The figures below show the results in various percentage of Duty Cycle.
Discussion:
After the simulation and observing the behaviour of the graph as the duty cycle varies it can be said that, to indicate
the speed and duration of each revolution, the total duration for a full rotation is displayed against the appropriate
duty cycle in seconds. It indicates that the speed is faster when the time to complete a full rotation is less, and
slower when the time to complete a full rotation is greater.
VII. Observations
By doing this experiment, observations can be made; like the relationship of the DC motor’s speed is directly
proportional to the Duty Cycle. It may not be linear, but it is observable that the speed of the DC motor
increases as the Duty Cycle is increased. This is because the motor's speed is determined by the PWM supplied
to the motor driver, as well as the speed at which it is operated.
VIII. Conclusions
Overall, we may draw the following conclusion from this experiment: the duty cycle applied to the driver
influences the speed of the DC motor; if the duty cycle is 0%, the speed is the lowest, and if it is 100%, the
speed is the highest.
IX. Recommendations
It is suggested that you use sensors when undertaking this type of activity in order to have a better
understanding or more detailed observation. Because the exact position and speed of the DC motor can be
determined or presented in this manner. These sensors can be used to detect the rotational parameters of a
DC motor as well as its acceleration and deceleration.
X. Design Applications
This design application regulates the motor's speed based on temperature. The speed of the motor increases as the
temperature rises, and the speed of the motor reduces as the temperature falls. This application can be a great start
in projects such as temperature regulation.
Components used:
▪ 9V battery
▪ L298N motor driver
▪ DC motor
▪ Arduino Board
▪ DHT22 temperature and humidity sensor
▪ Connecting wires
* Control Speed of Motor with Temperature using DHT22 Sensors with Motor driver L298N Module
// motor 1 settings
#define IN1 2
#define IN2 4
const int CW = 1;
#define motor1
const float tempMin = 30.0; // this can be changed to what min. temperature you want to set
const float tempMax = 65.0; // this corresponds to the max temp that will drive the motor in max. speed
#include "DHT.h"
#define DHTPIN 6
void setup() {
Serial.begin(9600);
Serial.println();
motor.begin();
dht.begin();
//L298N DC Motor
void loop() {
// Temperature to speed
tempToSpeed();
Serial.print("motorSpeed:");
Serial.println(motorSpeed);
delay(500);
// motor.brake(1);
*/
void tempToSpeed()
{
Serial.print("T:");
Serial.print(t,1);
Serial.println(" C");
if(t <tempMin)
motorSpeed=0;
motor.brake(1);
if (t >tempMax)
motorSpeed=100;
}//tempToSpeed() end
The result is provided below wherein the sensor reads the surrounding temperature at first.
In this result I’ve changed the minimum temperature to 26 degrees and the serial monitor is provided below.
Meanwhile, in the result provided below I’ve changed the min. temperature to 30 degrees. I did this just to
prove that the displayed temperature is the surrounding temperature. And, as you can see the DC motor is braked
because the desired temperature for it to activate is not yet reached.
What I’ve did next is I increased the temperature by applying heat near the sensor enough for it to sense
without damaging the component. This is the fastest way to observe if the design is really working. And as can be seen
in the result below, at 40. 1 degrees the DC motor rotates at 30 % CW direction that is because the temperature is
already increasing.
And as the temerature continues to increase, the speed of the DC motor also increases until the maximum speed is
reached wherein the DC motor speed will also be at its maximum. And if the temperature will decrease it will also
decrease. Actually, we can add a function in the code that can make the DC motor stop rotating if the temperature
is cold instead of putting it on brake.
XI. References