0% found this document useful (0 votes)
3 views

Chart Lab

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Chart Lab

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

AIM: -

Interfacing of DC Motor using Arduino.

Software and Components used:


Software:
1. Arduino IDE (Integrated Development Environment):- This software is used for writing,compiling, an
d
uploading code to the Arduino board.
Components:
1. Arduino board (e.g., Arduino Uno, Arduino Nano) - The micro controller platform that executes the
programmed instructions.

2.DC Motor- A DC motor converts electrical energy (direct current) into mechanical rotation.
3. Jumper wires - To make connections between components on the breadboard.
4. USB cable - To connect the Arduino board to the computer for programming and power.
5. Power Supply - A 5V regulated power supply or battery pack to power the Arduino and LCD
6. Bread Board

Theory and Description


Introduction to Arduino:
1. Download Arduino IDE:
Visit the official Arduino website at
https://www.arduino.cc/en/software.
2. Install Arduino IDE.
3. Launch Arduino IDE.
4. Configure Arduino IDE.
Upon launching Arduino IDE for the first time, you
may be prompted to select yourArduino board from
the "Tools" > "Board"menu.
Choose the appropriate board model that you are
using (e.g., Arduino Uno, Arduino Nano).
Next, select the port to which your Arduino board is
connected under the "Tools" > "Port" menu. The
port should be labeled with the Arduino board name.
5. Verify Installation.

DC Motor:
A DC motor is an engine that converts direct current into rotational motion. It uses electroma
gnetic forces generated by current flowing through coils and interacting with magnetic fields.
The most common types rely on permanent magnets and have a mechanism, often a comm
utator with brushes, to reverse the current direction in the rotating part, which keeps the mot
or spinning continuously.

H-Bridge Motor Driver:


Controlling the direction and speed of a DC motor requires an H-bridge motor driver. An
H-bridge is an electronic circuit that enables bidirectional control of a motor. It consists of
four switches arranged in an "H" configuration. By toggling the switches in various
combinations, the motor's direction of rotation can be reversed. Common H-bridge motor
driver ICs include L298N, L293D, and TB6612FNG. These ICs provide a convenient
interface between the Arduino and the DC motor.

Pulse-Width Modulation (PWM):
Arduino boards are equipped with Pulse-Width Modulation (PWM) pins, which can
simulate analog output by rapidly switching the output voltage between high and low
states. PWM allows for precise control of the motor's speed by varying the duty cycle of
the PWM signal. The average voltage applied to the motor is proportional to the duty
cycle of the PWM signal. By adjusting the duty cycle, the effective voltage and thus the
motor's speed can be controlled. PWM is particularly useful in applications where
continuous speed control is required.

Procedure:
Motor Driver Connection:

Connect motor driver's power supply pins (5V and GND) to Arduino's matching pins.
Connect motor terminals to motor driver's output pins.
Connect Arduino's digital pins to motor driver's control pins.
Code Functionality:

Control motor speed with PWM via Arduino's digital pins.


Control motor direction by setting motor driver control pins high or low

Setup:
Arduino Programming:
const int enablePin = 9;
const int in1Pin = 2;
const int in2Pin = 3;

void setup() {
pinMode(enablePin, OUTPUT);
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
Serial.begin(9600);
}

void forward() {
digitalWrite(in1Pin, HIGH);
digitalWrite(in2Pin, LOW);
}

void backward() {
digitalWrite(in1Pin, LOW);
digitalWrite(in2Pin, HIGH);
}

void stopMotor() {
analogWrite(enablePin, 0);
}

void setSpeed(int speed) {


analogWrite(enablePin, speed);
}

void delayMotor(int delayTime) {


delay(delayTime);
}

void loop() {
setSpeed(150);
forward();
delayMotor(1000);
backward();
delayMotor(1000);
stopMotor();
delayMotor(1000);
}
OUTPUT:

Conclusion: -
In conclusion, connecting a DC motor to your Arduino UNO opens doors to a world of interactive proje
cts. While the Arduino itself can't provide the muscle for most motors, a motor driver bridges the gap.
By incorporating a motor driver like the L293D on a breadboard, you can leverage the Arduino's contr
ol finesse to regulate the motor's speed and direction.

Name- Swapnil sinha


Roll-22053208
Group-11

You might also like