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

C Experiment 4

This document provides instructions for an experiment on controlling the speed of a motor using an Arduino board. It includes the aim, objectives, required components, circuit diagram, steps to connect a servo motor to Arduino, sample code, additional tasks, and conclusions.

Uploaded by

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

C Experiment 4

This document provides instructions for an experiment on controlling the speed of a motor using an Arduino board. It includes the aim, objectives, required components, circuit diagram, steps to connect a servo motor to Arduino, sample code, additional tasks, and conclusions.

Uploaded by

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

Course Code - MC1030 Course Name - Arduino, IoT FAB Lab.

Experiment - 4

Aim - Speed control of motor using Arduino.

Objectives –

1. Speed control of a DC motor in a real-time environment as a DC motor is applicable in various


robotic applications.

Components Required –

1. Servo/Stepper Motor
2. Bread Board
3. 10K Ohm Resistance
4. Jumper Wire
5. Arduino Board
6. USB Cable
7. L293 Motor Driver (If motor is 12V)

Circuit Diagram and Theory –

A. Circuit Diagram:

Department of Mechatronics Engineering Page 1 | 3


Course Code - MC1030 Course Name - Arduino, IoT FAB Lab.

Figure. 1: Circuit diagram of a Arduino controlled servo motor.

B. Steps:

A servo motor has everything built in “a motor, a feedback circuit, and a motor driver”. It just needs
one power line, one ground, and one control pin.

Following are the steps to connect a servo motor to the Arduino:

1. The servo motor has a female connector with three pins. The darkest or even black one is
usually the ground. Connect this to the Arduino GND.
2. Connect the power cable that in all standards should be red to 5V on the Arduino.
3. Connect the remaining line on the servo connector to a digital pin on the Arduino.

C. Code:

• // Include the Servo library


• #include <Servo.h>
• // Declare the Servo pin
• int servoPin = 3;
• // Create a servo object

Department of Mechatronics Engineering Page 2 | 3


Course Code - MC1030 Course Name - Arduino, IoT FAB Lab.

• Servo Servo1;
• void setup()
• {
• // We need to attach the servo to the used pin number
• Servo1.attach(servoPin);
• }
• void loop()
• {
• // Make servo go to 0 degrees
• Servo1.write(0);
• delay(1000);
• // Make servo go to 90 degrees
• Servo1.write(90);
• delay(1000);
• // Make servo go to 180 degrees
• Servo1.write(180);
• delay(1000);
• }

Additional Tasks –

1. Control position of a servo motor using potentiometer. Also, provide circuit diagram for the
same.
2. Angle control of a steeper motor during clockwise (10 to 180) and anticlockwise (180 to 10)
rotation.

Conclusions –

The DC motor speed control is an important task to control various robotics systems. In this experiment
students have gained knowledge about how to interface Arduino and motor with PC. They have also
studied how to control the speed of a DC motors in a real-time world. To accomplish the experiment
markable safety measures have been taken care.

Department of Mechatronics Engineering Page 3 | 3

You might also like