A DC motor is often operated by direct present. It converts {the electrical} vitality into mechanical vitality. This rotational motion is the supply of required energy to run many purposes in Business. Velocity management is the important perform for motor operation. With pace management of the motor, we will alter the pace of the motor in keeping with the will of the applying. It’s deployed in lots of real-time purposes like controlling robotic autos, paper mills, and elevators.
DC Motor
DC motor is a rotational system which converts electrical vitality within the type of Direct Present into mechanical vitality within the type of rotational movement of the motor shaft. The pace of the DC motor might be managed by various DC voltage. For making use of altering voltage, the PWM approach is beneficial.
Building and Working
This circuit is constructed on a breadboard. This design relies on Arduino Nano Expertise. It includes Arduino Nano, L298 Motor Driver, Potentiometer 10K,1 Seven section show, BO Motor 100 RPM, GearBox, Shaft, Battery Holder, Battery 18650 Li-on Cell 3.7V 2000mah (2 cell). Potentiometer has 3 pins – one is related to GND, one is related to 5V and the center pin is related to A1(analog pin). Seven section pins a to g related from pin 13 to Pin 7 and the decimal pin related to six. It is a frequent cathode 7-segment show with 2 frequent pins related to GND. Pin 5 of Arduino Nano is related to Allow Pin A of the L298 Motor Driver. Pin 3, and Pin 4 are related to IN1 and IN2 of L298 Motor Driver. Connect BO Motors to motor pins of L298 Motor Driver and put wheels inside gearboxes. Motors might be managed by a potentiometer and pace is displayed on a seven-segment show in RPM.
Arduino Nano
The Arduino Nano is a micro-size, full, and breadboard-compatible board primarily based on the ATmega328. The Arduino Nano might be powered by way of the Mini-B USB connection. The facility supply is mechanically chosen to the best voltage supply. The ATmega328 has 32 KB. Every of the 14 digital pins on the Nano can be utilized as an enter or output, utilizing pinMode(), digitalWrite(), and digitalRead() capabilities. They function at 5 volts. Every pin can present or obtain a most of 40 mA and has an inner pull-up resistor.
L298 Driver:
This L298N Primarily based Motor Driver Module – 2A is a high-power motor driver excellent for driving DC Motors and Stepper Motors. It makes use of the favored L298 motor driver IC and has the onboard 5V regulator which it might provide to an exterior circuit. It may management as much as 4 DC motors, or 2 DC motors with directional and pace management. This L298N Motor Driver Module – 2A is ideal for robotics and mechatronics tasks and ideal for controlling motors from microcontrollers, switches, relays, and so on. Good for driving DC and Stepper motors for micro mouse, line-following robots, robotic arms, and so on.
Potentiometer 10K
Potentiometers are useful in controlling the varied electrical parameters of a circuit. It is a one-turn 10k Potentiometer with a rotating knob facility. This potentiometer is used to vary the resistance between 0 to 10k ohms worth by merely rotating the knob. The shaft is 15mm in size with a complete resistance of 10K ohm.
Seven Phase Show
In fashionable occasions, seven-segment shows are generally utilized in show techniques for varied purposes. Seven-segment shows are made up of LEDs. These are used to show numbers just like the standing of petrol in autos, time in digital watches, show pace of autos, pace of washing machines, AC and varied sorts of panels. The seven-segment show comprises 7 leds to show numbers. You’ll be able to show numbers from 0 to 9 on a single seven-segment.
Frequent Cathode Seven-Phase Show
- For the frequent cathode, join frequent pins of seven segments to the GNDpin of Arduino Nano.
- Join +5 volts pin of Arduino Nano to decimal level pin in sequence to a 470 ohm- resistor to restrict the present. It is going to glow.
- Within the Frequent cathode, a,b,c,d,e,f,g, and h pins of the section show are related to Arduino Nano pins which might be managed by way of programming by assigning values.
Half Checklist
Arduino Nano, L298 Driver, BO Motor 100 RPM, Frequent cathode Seven Phase Show, Potentiometer 10K,Tyre, Bread Board, Jumper Wires, USB Cable, Cardboard Field, Battery Holder, Battery Module 18650 3.7V 2000mah (2 cell)
Software program
Programming of the undertaking is finished on an Arduino 1.8.19 software. The Potentiometer 10k module is related to an Arduino Nano analog pin A1, 1 pin related to 5V of Arduino Nano, 1 pin is related to GND of Arduino Nano. Pin 5 of Arduino Nano is related to Allow Pin A of L298 Motor Driver. Pin 3, Pin 4 are related to IN1 and IN2 of L298 Motor Driver. Connect BO Motor 100 RPM to motor pins of L298 Motor Driver and put wheel inside gearbox. By way of Software program, Potentiometer sends analog sign to A1 pin and accordingly Arduino Nano sends instructions to L298 Motor Driver which in flip sends instructions to Motor to run in keeping with the worth of potentiometer.
Testing
Make connections as per the circuit diagram. Give voltage from Battery Holder 18650 Li-on Cell 3.7 V 2000 mah(2 cell – 7.4V). Verify the standing of seven-segment show if zero is displaying on it. Transfer the knob of potentiometer 10K and document the pace displayed in RPM from 0 to 9 RPM. Right here 0 means 0 RPM and 9 means 90 RPM and a single dot on seven-segment show means most pace 100 RPM. Observe the pace of BO DC Motor in keeping with the rotation of Knob (0-255). Worth 0 from potentiometer means 0 RPM(revolution per minute-minimum pace), worth 255 refers – 100RPM(most pace). This prototype might be prolonged to 2 or extra motors with extra seven-segment show or LCD show with path management of DC motor for varied robotics and industrial utility.
int seg_Pins[] = {13, 12, 11, 10, 9, 8, 7, 6}; // { a b c d e f g . )
int pot_map;
int pot_input;
////MOTOR1 PINS
int ena = 5;
int in1 = 3;
int in2 = 4;
byte seg_Code[11][8] = {
// a b c d e f g .
{ 1, 1, 1, 1, 1, 1, 0, 1}, // 0
{ 0, 1, 1, 0, 0, 0, 0, 0}, // 1
{ 1, 1, 0, 1, 1, 0, 1, 0}, // 2
{ 1, 1, 1, 1, 0, 0, 1, 0}, // 3
{ 0, 1, 1, 0, 0, 1, 1, 0}, // 4
{ 1, 0, 1, 1, 0, 1, 1, 0}, // 5
{ 1, 0, 1, 1, 1, 1, 1, 0}, // 6
{ 1, 1, 1, 0, 0, 0, 0, 0}, // 7
{ 1, 1, 1, 1, 1, 1, 1, 0}, // 8
{ 1, 1, 1, 1, 0, 1, 1, 0}, // 9
{ 0, 0, 0, 0, 0, 0, 0, 1} // .
};
void setup()
{
pinMode(A1, INPUT);
pinMode(ena, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
for (int i = 0; i < 8; i++)
{
pinMode(seg_Pins[i], OUTPUT);
}
Serial.start(9600);
}
void loop()
{
pot_input = analogRead(A1);
pot_map= map(pot_input, 0, 1023, 0 , 255);
//Serial.println(pot_input);
Serial.println(pot_map);
delay(300);
if ((pot_map > 1) && (pot_map <= 25))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 1; n < 2; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
else if ((pot_map > 25) && (pot_map <= 50))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 2; n < 3; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
else if ((pot_map > 50) && (pot_map <= 75))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 3; n < 4; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
else if ((pot_map > 75) && (pot_map <= 100))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 4; n < 5; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
else if ((pot_map > 100) && (pot_map <= 125))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 5; n < 6; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
else if ((pot_map > 125) && (pot_map <= 150))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 6; n < 7; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
else if ((pot_map > 150) && (pot_map <= 175))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 7; n < 8; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
else if ((pot_map > 175) && (pot_map <= 200))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 8; n < 9; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
else if ((pot_map > 200) && (pot_map <= 225))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 9; n < 10; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
else if ((pot_map > 225) && (pot_map <= 255))
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
analogWrite(ena, pot_map);
for (int n = 10; n < 11; n++)
{
display_Digit(n);
delay(2000); ///1 second delay
}
}
else
{
for (int n = 0; n < 1; n++)
{
display_Digit(n);
delay(2000); ///2 second delay
}
}
}
void display_Digit(int digit)
{
for (int i = 0; i < 8; i++)
{
digitalWrite(seg_Pins[i], seg_Code[digit][i]);
}
}