EISD-TASK 2 From RAUNAK 2310994547
EISD-TASK 2 From RAUNAK 2310994547
EISD-TASK 2 From RAUNAK 2310994547
EXPERIMENT – 1 DC MOTOR
AIM: Design a circuit to interface an Dc module with the the dc motor.
COMPONENTS: To interface an dc motor with an Arduino board and create a simple dc motor
project,you will need the following components:
*Dc motor
*Jumper wires
THEORY: This is the circuit in which Arduino gives signal to the motor board and motor rotates
according to the signal receive to show arduino program works.
PROCEDURE: Here’s a step-by-step procedure to connect the dc motor to the Arduino and write a
program to give output:
CIRCUIT CONNECTIONS:
*Connect pin1 and pin2 of motor board to the pin7 and pin8 of Arduino.
void loop() {
// Rotate the motor forward
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
EXPLANATION:
*We define motor board pin as the pin number to which the sensor is connected (pin9,8and 7).
*In the setup function, we set moto Pin as an output using pin mode()to ensure that the Arduino
known its controlling an output device.
*In the loop()function ,we turn the motor output on by setting the to its output come from Arduino
board then motor rotates.
*select the Arduino Uno board and port from the Tools menu.
*Copy and paste the code above into a new sketch in the Arduino IDE.
*Click the upload button to compile and upload the code to your Arduino board.
OBSERVATION AND CONCLUSION: Motor rotates and delay a second according to our code.
COMPONENTS: To interface an LED with an Arduino board and create a simple blinking Led project,
you‘ll need the following components:
*LED
*Jumper wires
*Breadboard
THEORY: In this experiment, the Led is interfaced with the Arduino microcontroller using digital
output pins. The microcontroller can output a high voltage signal, usually around 5 volts, and a
LOW voltage signal, which is effectively 0 volts. These voltage signals control the flow of electric
current through the LED.
To protect the LED from damage due to excessive current limiting resistor is incorporated in the
circuit. This resistor restricts the amount of current passing through the LED, ensuring it operates
within its specified limits. By appropriately limiting the current, the LED emits light without being
overloaded, maintaining its functionality and longevity.
PROCEDURE: Here’s a step by step procedure to connect the LED to the Arduino and write a
program to blink it at a 1second interval:
A. CIRCUIT CONNECTIONS:
• Connect the longer lead (anode, positive) of the LED to digital pin 12 on the
Arduino. Place a current limiting resistor (220-330 ohms) in series with the LED’s
anode.
• Connect the shorter lead (cathode, negative) of the LED to the GND pin on the
Arduino.
Explanation:
• const int led Pin = 13; declares a constant integer variable for the LED pin (pin 13 on the
Arduino).
• PinMode (ledPin, OUTPUT); configures the LED pin as an output.
• Inside the loop() function, digitalWrite() turns the LED on (HIGH) and off (LOW), with
delay(1000) creating a one-second delay between each state change.
Upload this code to your Arduino board, and you should see the LED connected to pin 13 blinking on
and off at a one-second interval.
OBSERVATION AND CONCLUSION; Creating a circuit to interface an LED with an Arduino and
programming it to blink at regular intervals is a fundamental project in electronics and
microcontroller programming. By connecting the LED to the Arduino and writing a simple
program, you can control the LED's behavior.
EXPERIMENT- 3 IR SENSOR
Aim: Design a circuit to interface an IR sensor module with the Arduino board. Write an Arduino
program that reads the output of the IR sensor.
Program:
int IRSensor = 9; // connect IR sensor module to Arduino pin D9
void setup(){
void loop(){
} else
{
Serial.println("object detection Ended!"); // print object detection Ended! on the serial
monitor window
1. Circuit Connection:
- Connect the IR sensor to pin 9 (IRSensor) of the Arduino.
- Ensure the power (VCC) and ground (GND) connections for the IR sensor are correctly
wired to the Arduino.
2. Arduino Code:
- Open the Arduino IDE on your computer.
- Copy and paste the provided code into the Arduino IDE.
- Verify and upload the code to the Arduino board.
Circuit Connections:
Arduino Code:
const int buttonPin = 10; // Pin connected to the push button const int buzzerPin = 8; // Pin
connected to the buzzer
void setup() {
pinMode(buttonPin, INPUT);
pinMode(buzzerPin, OUTPUT);
void loop() {
digitalWrite(buzzerPin, HIGH);
} else {
digitalWrite(buzzerPin, LOW);
Explanation: The setup() function configures the pin modes for the button and the buzzer. The
buttonPin is set as an input, utilizing the internal pull-up resistor, and the buzzerPin is set as an
output.
The loop() function continuously checks the state of the button using digitalRead() on the
buttonPin. If the button is pressed and its state is HIGH, the buzzer activates by setting the
buzzerPin to HIGH using digitalWrite(). When the button is not pressed, the buzzer is turned off
by setting the buzzerPin to LOW.
Setup of Arduino:
Observation:
- Pressing the push button should activate the buzzer, and releasing the button should
deactivate the buzzer.
Conclusion:
The experiment successfully demonstrated the activation and deactivation of a buzzer using a
push button with the Arduino. When the button is pressed, the buzzer activates, and when the
button is released, the buzzer deactivates. This simple circuit and code showcase the basic
functionality of using a button to control a buzzer.
Theory: The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a
capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital
signal on the data pin.
Procedure: Here's a step-by-step procedure to connect the DHT11 sensor to the Arduino and write a
program to give output in serial monitor
2 of Arduino board
Program:
1. #include<DHT.h>
2. int DHTPIN =2
3. int DHTTYPE = DHT11; 4. DHT dht(DHTPIN, DHTTYPE);
5.
6. void setup(){
7. Serial.begin(9600);
8. dht.begin();
9. }
10.
11. void
loop(){ 12.
delay(1000);
13.
14. float humidity
=dht.readHumidity(); 15. float
temperature
=dht.readTemperature(); 16.
17. if(isnan(humidity)||isnan(temperature)){
18. Serial.println("Failed to read from DHT sensor"); 19.
}else{
20. Serial.print("Humidity: ",humidity);
21.
22. Serial.print("%\tTemperature:
",temperature); 23.
24. Serial.println("°C");
25. } 26. }
Explanation:
• Copy and paste the code above into a new sketch in the Arduino IDE.
• Click the "Upload" button to compile and upload the code to your Arduino
board.
• After uploading the code, serial monitor starts to show the output.
•
EXPERIMENT- 6 (LCD)
Aim: Design a circuit to interface an LCD module with the Arduino board. Write an Arduino
program that shows output whatever you written.
COMPONENTS: To interface an DC motor with an Arduino board and create a simple DC
motor project, you will need the following components: Arduino Uno board ,Jumper wires
,LCD
THEORY: This is the circuit in which Arduino gives the signal to the LCD shows the output
whatever we written in code.
PROCEDURE: Here’s a step by step procedure to connect the LCD to the Arduino and write a
program to give output. Connect the pin of lcd to pin 9 of Arduino board.
CIRCUIT CONNECTIONS:
1. Connect the pin of lcd to pin 9 of Arduino board.
2. Connect pin of lcd to the pin 7 of Arduino boared.
3. Then connect ground and VCC of LCD to Arduino board.
4. Enter the code in Arduino.
Arduino Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
EXPLANATION:
WE define LCD pin as the pin number to which the LCD is connected (pin 9,7) .In the setup ()
functions, we set LCD pin as an output using pin mode to ensure that the Arduino knows
its’s controlling an output device and write the output that we want to show on LCD.
OUTPUT: