Asim Iot 7

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Experiment 7

Student Name: MO.ASEEM UID:22BCS17170


Branch: BE CSE Section/Group: 643/B
Semester: 5th Date of Performance: 20/09/24

Subject Name: IOT LAB Subject Code: 22CSP-329

Aim:

To Assemble and Controlling of actuators using Arduino Uno.

Input/Equipment Used-
1. 1x Arduino
2. 2. 1x LED
3. 3. 1x Motor
4. 4. 1x Buzzer

Servo Motors: Servomotors have three wires: power, ground, and signal.
The power wire is typically red, and should be connected to the 5V pin on
the Arduino board. The ground wire is typically black or brown and should
be connected to a ground pin on the board. The signal pin is typically
yellow or orange and should be connected to PWM pin on the board. In
these examples, it is pin number 9.

Procedure-

• Prepare the Arduino and Servo Motor


• Make the Connections
• Verify Connections
• Upload the Code
• Power and Test the Setup

Connections:
 Servo Red Wire → Arduino 5V Pin

 Servo Black/Brown Wire → Arduino GND Pin


 Servo Yellow/Orange Wire → Arduino Pin 9 (or any digital pin)

CODE

const int ledPin1 = 2; // Connect first LED to digital pin 2


const int ledPin2 = 3; // Connect second LED to digital pin 3
const int motorPin = 4; // Connect motor to digital pin 4
void setup() {
pinMode(ledPin1, OUTPUT); // Set LED pin as output
pinMode(ledPin2, OUTPUT); // Set LED pin as output
pinMode(motorPin, OUTPUT); // Set motor pin as output
}
void loop() {
// Turn on LED 1 and motor
digitalWrite(ledPin1, HIGH);
digitalWrite(motorPin, HIGH);
delay(1000); // Wait for 1 second
// Turn off LED 1 and motor
digitalWrite(ledPin1, LOW);
digitalWrite(motorPin, LOW);
delay(1000); // Wait for 1 second
// Turn on LED 2
digitalWrite(ledPin2, HIGH);
delay(1000); // Wait for 1 second
// Turn off LED 2
digitalWrite(ledPin2, LOW);
delay(1000);
// Wait for 1 second
}
Result

Learning outcomes: -
1. Understanding Servo Motor Control
 Learn how to connect and control a servo motor using an Arduino.
 Gain knowledge of servo motor signal processing and how to generate pulse-width
modulation (PWM) signals to control the motor's angle.
2. Familiarization with Arduino Programming
 Develop skills in writing and uploading code using the Arduino IDE.
 Understand how to use the Servo library in Arduino to interface with motors and other
actuators.
 Learn basic programming constructs, such as loops and functions, to control hardware
devices.
3. Circuit Design and Connection Proficiency
 Acquire hands-on experience in connecting hardware components, including motors,
jumper wires, and power connections.
 Gain proficiency in interpreting and creating simple circuit diagrams, understanding the
importance of proper grounding, and avoiding electrical conflicts.
4. IoT Device Integration
 Understand the role of an Arduino as a control system in an IoT project.
 Learn how sensors and actuators (like servo motors) can be integrated to build smart,
connected devices capable of interacting with their environment.
5. Problem Solving and Debugging Skills
 Enhance troubleshooting skills by identifying and solving common issues, such as
improper wiring, power supply problems, and code errors.
 Learn how to systematically test hardware and software components to ensure reliable
operation of IoT projects.

You might also like