Iot 7
Iot 7
Iot 7
Experiment 7
Student Name:Harinder Singh UID -22BCS10280
Branch:CSE Section/Group-606-A
Semester: 5th Date of Performance:
Subject Name: IOT LAB Subject Code: 22CSP-329
1. Aim:
To Assemble and Controlling of actuators using Arduino Uno.
2. Objective:
The goal of this project is to assemble and control various actuators (LED,
motor, and buzzer) using an Arduino Uno. This project will involve
connecting the components to the Arduino and writing a program to control
their behavior, such as blinking the LED, turning the motor on and off, and
sounding the buzzer.
3. Input/Equipment Used:
1. 1x Arduino
2. 1x LED
3. 1x Motor
4. 1x Buzzer
4. Theory:
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.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
5. Procedure:
• Place the Arduino Uno on a working surface or connect it to a
breadboard for easier wiring
• Connect the LED to the breadboard. Attach the longer leg (anode) of the
LED to pin 8 of the Arduino and the shorter leg (cathode) to ground
(GND) through a 220 ohm resistor.
• If using a motor driver (L298N or similar), connect the control pins of
the driver to pin 9 of the Arduino, the power pins to a 5V external power
supply, and the motor output pins to the motor.
• Connect the Buzzer to pin 10 of the Arduino, with the other terminal
connected to ground.
• Install the Arduino IDE on your computer.
• Open the Arduino IDE
• Open a new sketch in Arduino IDE and write the code.
• Connect the Arduino to your computer using a USB cable
• Select the correct board and port in the Arduino IDE. Upload the code
to the Arduino.
• Once the code is uploaded, the LED will blink, the motor will spin, and
the buzzer will sound simultaneously for 1 second and then turn off for
1 second in a loop.
Connections:
• Connect the LED anode to pin 8 and cathode to GND
• Connect motor driver: Motor + and - terminals connected to the motor,
and input pins connected to Arduino Pin 9.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(motorPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
}
void loop() {
// Turn on LED
digitalWrite(ledPin, HIGH);
// Turn on Motor
digitalWrite(motorPin, HIGH);
// Turn on Buzzer
digitalWrite(buzzerPin, HIGH);
delay(1000); // Wait for 1 second
// Turn off LED
digitalWrite(ledPin, LOW);
// Turn off Motor
digitalWrite(motorPin, LOW);
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Figure 1: Output
8. Conclusions:
we successfully controlled multiple actuators (LED, motor, and buzzer)
using an Arduino Uno. By setting the appropriate pin modes and controlling
the output signals with code, we were able to blink the LED, control the
motor, and sound the buzzer in a synchronized pattern. This experiment
demonstrates how Arduino can be used to control various electronic
components in automation or robotics applications.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING