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

C Experiment 4

Uploaded by

Rahul Rajagopal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

C Experiment 4

Uploaded by

Rahul Rajagopal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

MCE1030 - Arduino, IoT Fab Lab 1

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:
MCE1030 - Arduino, IoT Fab Lab 2

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
 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);
MCE1030 - Arduino, IoT Fab Lab 3

 // 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 of.

You might also like