EISD-TASK 2 From RAUNAK 2310994547

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

ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

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:

*Arduino Uno board

*Dc motor

*Dc motor board

*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 the A pin to pin 9 of Arduino board.

*Connect pin1 and pin2 of motor board to the pin7 and pin8 of Arduino.

*The connect ground and vcc pf motor board to Arduino board.

*Connect DC motor to motor board.

*Enter the code in Arduino.

int enA = 9; // Enable pin


int in1 = 8; // Input 1
int in2 = 7; // Input 2
void setup() {
// Set the motor control pins as outputs
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
}

void loop() {
// Rotate the motor forward
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

// Set the motor speed (0 to 255)


analogWrite(enA, 105); // Adjust the speed as needed

// Delay for a few seconds


delay(2000);

// Stop the motor


digitalWrite(in1, LOW);
digitalWrite(in2, LOW);

// Delay for a few seconds


delay(2000);

// Rotate the motor backward


digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);

// Set the motor speed (0 to 255)


analogWrite(enA, 90); // Adjust the speed as needed

// Delay for a few seconds


delay(2000);

// Stop the motor


digitalWrite(in1, LOW);
digitalWrite(in2, LOW);

// Delay for a few seconds


delay(2000);

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.

UPLOADING THE CODE:

*Open the Arduino IDE on your computer.

*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.

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

*Click the upload button to compile and upload the code to your Arduino board.

*After uploading the code,motor rotates according to the code.

OBSERVATION AND CONCLUSION: Motor rotates and delay a second according to our code.

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

EXPERIMENT- 2 LED(LIGHT EMITTING


DIODE)
AIM: Design a circuit to interface an LED with an Arduino board Write an Arduino program that
blinks the LED on and off on a regular interval of 1 second.

COMPONENTS: To interface an LED with an Arduino board and create a simple blinking Led project,
you‘ll need the following components:

*Arduino Uno board

*LED

*220-330 Ohm resistor

*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:

• Insert the led into the breadboard.

• 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 one end of the resistor to the anode of LED.

• Connect the shorter lead (cathode, negative) of the LED to the GND pin on the
Arduino.

Explanation:

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

• 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.

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

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(){

Serial.begin(9600); // Init Serial at 9600 Baud Rate.

Serial.println("Serial Working"); // Test to check if serial is working or not

pinMode(IRSensor, INPUT); // IR Sensor pin INPUT

void loop(){

int sensorStatus = digitalRead(IRSensor); // Set the GPIO as Input

if (sensorStatus == 1) // Check if the pin is high

Serial.println("Object Detected!"); // print object Detected! on the serial monitor


window

} 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.

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

- 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.

3. Upload the Code:


- Connect the Arduino board to your computer using a USB cable.
- Select the correct board and port in the Arduino IDE.
- Click the "Upload" button in the Arduino IDE to upload the code to the Arduino board.

OBSERVATION AND CONCLUSION: The IR sensor module in


action , you can notice the LED turn on both on the module and on the Arduino board as pointed
out by the red arrows. If you are working with an IR motion sensor module for the first time then
you should get a response similar to this.

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

Experiment-4 Buzzer Activation using a Push


Button
Aim: To create an Arduino circuit where a buzzer activates when a push button is pressed and
deactivates when the button is released.

Circuit Connections:

- Connect a push button to pin 10 (buttonPin) on the Arduino.


- Connect a buzzer to pin 8 (buzzerPin) on the Arduino.
- Ensure proper grounding connections for both the button and the buzzer.

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() {

int buttonState = digitalRead(buttonPin); // Read the state of the button

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

if (buttonState == HIGH) { // Button is pressed when it reads HIGH

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:

1. Connect the push button to pin 10 and the buzzer to pin 8.


2. Ensure proper grounding connections for the components.
3. Upload the provided Arduino code to the Arduino board.

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

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.

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

EXPERIMENT – 5 HUMIDITY AND


TEMPERATURE SENSOR
Aim: Design a circuit to interface an DHT11 sensor module with the Arduino board. Write an Arduino
program that reads the output of the DHT11 sensor.

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

Circuit Connections: Connect the IR sensor out port to in digital pin

2 of Arduino board

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

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:

• Firstly we need to download <DHT.h>library to use the DTH11 sensor as it


provides necessary functions to use the sensor. We need to download this from
Arduino’s)
• We define DHTPIN as the pin number to which the DHT Sensor is connected
(Pin 2).
• In the setup() function, we set Serial.begin 9600 Bauds to get readings at
9600 bauds.
• In the loop() function, we read the humidity data from the DTH11 using
dht.readHumidity(); and read the Temperature data from float
temperature =dht.readTemperature()store the output Float value in
respective variables (float humidity&float temperature) .
• Then we have a decision making statement which displays output in the serial
monitor using Serial.println() and
Serial.print()

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

Uploading the Code:

• Open the Arduino IDE on your computer.


• 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.
• 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.

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

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>

LiquidCrystal_I2C lcd(I2C_ADDRESS, 16, 2); // Change the dimensions if you have


a different LCD size
void setup() { lcd.init();
lcd.setCursor(0, 0); lcd.print("Bhupinder jogi ");

lcd.setCursor(0, 1); lcd.print("USA vala");


} void loop() {

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.

UPLOADING THE CODE:


Open the Arduino IDE on your computer. Download the library from include library and then
manage library (liquid Digital). 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 you Arduino board. After uploading the code, LCD
shows the output according to the code.

OUTPUT:

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR


ENGINEERING INFUSION FOR SKIL DEVELOPMENT (22EC002)

CONCLUSION: LCD displays according to our code.

Submitted By: RAUNAK, Roll No-2310994547, Branch- ECE 1ST YEAR

You might also like