0% found this document useful (0 votes)
68 views20 pages

Harsh Patil

Uploaded by

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

Harsh Patil

Uploaded by

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

110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

EXPERIMENT NO: 1

AIM: Introduction to Arduino platform and programming


Components:

1. USB Power supply and communication cable


2. Arduino Board.
3. Bread board.
4. Internet connection for Wokwi open ware simulation software for virtual connection of circuitry.
5. Arduino Uno compiler for uploading programs.

Procedure:

1. Follow the examples in the Arduino compiler and edit them as logically required.

2. Use Wokwi Open ware simulator using internet for different set of hardware interfacing and
paste the Arduino example programme in the sketch mode of Wokwi and save. One can refer the
internet to explore different solution and execute the programs available on internet library.

3. Simulate the required program and virtually test the connections w.r.t. the programme coded.

4. Then connect the physical wires (through bread board) as designed on Wokwi with the Arduino
board and after checking and confirming the connection connect to the PC CPU for power
supply and communication between the software and hardware chip for physically executing the
program and field elements.

5. Edit the program code with added features for better functionality.

Page 1 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

Simulator picture (Wokwi): Architecture of Arduino Uno (pin configuration)

Types of Wires:
USB communicating and power cable, Male to Male, Male to female and Female to Female wires.

Types of Bread board:


Full board, half board and Mini board for quick circuit connections.

Program Code: Introduction hence no program code.

Page 2 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

EXPERIMENT NO: 2
Photo:

AIM: LED blink program.


Components:

1. USB Power supply and communication cable


2. Arduino Board.
3. Bread board.
4. Internet connection for Wokwi open ware simulation software for virtual connection of circuitry.
5. Arduino Uno compiler for uploading programs.
6. LED bulb

Procedure:

1. Follow the examples in the Arduino compiler and edit them as logically required.

2. Use Wokwi Open ware simulator using internet for different set of hardware interfacing and
paste the Arduino example programme in the sketch mode of Wokwi and save. One can refer the
internet to explore different solution and execute the programs available on internet library.

3. Simulate the required program and virtually test the connections w.r.t. the programme coded.

4. Then connect the physical wires (through bread board) as designed on Wokwi with the Arduino
board and after checking and confirming the connection connect to the PC CPU for power
supply and communication between the software and hardware chip for physically executing the
program and field elements.

5. Edit the program code with added features for better functionality.

Simulator picture (Wokwi):


Page 3 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

Program Code:
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever


void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

Page 4 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

EXPERIMENT NO: 3

Photo:

AIM: Building smart switch with PMW pulse width modulation

Components:

1. USB Power supply and communication cable


2. Arduino Board.
3. Bread board.
4. Internet connection for Wokwi open ware simulation software for virtual connection of circuitry.
5. Arduino Uno compiler for uploading programs.
6. Potentiometer
7. LED bulb

Procedure:

1. Follow the examples in the Arduino compiler and edit them as logically required.

2. Use Wokwi Open ware simulator using internet for different set of hardware interfacing and
paste the Arduino example programme in the sketch mode of Wokwi and save. One can refer the
internet to explore different solution and execute the programs available on internet library.

3. Simulate the required program and virtually test the connections w.r.t. the programme coded.

4. Then connect the physical wires (through bread board) as designed on Wokwi with the Arduino
board and after checking and confirming the connection connect to the PC CPU for power
supply and communication between the software and hardware chip for physically executing the
program and field elements.

5. Edit the program code with added features for better functionality.
Page 5 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

Simulator picture (Wokwi):

Program Code:

int LED_PIN = 3; // the PWM pin the LED is attached to

// the setup routine runs once when you press reset:


void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);

// declare LED pin to be an output:


pinMode(LED_PIN, OUTPUT);
}

// the loop routine runs over and over again forever:


void loop() {
// reads the input on analog pin A0 (value between 0 and 1023)
int analogValue = analogRead(A0);

// scales it to brightness (value between 0 and 255)


int brightness = map(analogValue, 0, 1023, 0, 255);

// sets the brightness LED that connects to pin 3


analogWrite(LED_PIN, brightness);

// print out the value


Serial.print("Analog: ");
Serial.print(analogValue);
Serial.print(", Brightness: ");
Serial.println(brightness);
delay(100);

Page 6 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

EXPERIMENT NO: 4
Photo:

AIM: Interfacing temperature/humidity sensor .


Components:

1. USB Power supply and communication cable


2. Arduino Board.
3. Bread board.
4. Internet connection for Wokwi open ware simulation software for virtual connection of circuitry.
5. Arduino Uno compiler for uploading programs.
6. Temperature & Humidity sensor
Procedure:

1. Follow the examples in the Arduino compiler and edit them as logically required.

2. Use Wokwi Open ware simulator using internet for different set of hardware interfacing and
paste the Arduino example programme in the sketch mode of Wokwi and save. One can refer the
internet to explore different solution and execute the programs available on internet library.

3. Simulate the required program and virtually test the connections w.r.t. the programme coded.

4. Then connect the physical wires (through bread board) as designed on Wokwi with the Arduino
board and after checking and confirming the connection connect to the PC CPU for power
supply and communication between the software and hardware chip for physically executing the
program and field elements.

5. Edit the program code with added features for better functionality.

Page 7 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

Simulator picture (Wokwi):

Program Code:
// DHT Temperature & Humidity Sensor
// Unified Sensor Library Example
// Written by Tony DiCola for Adafruit Industries
// Released under an MIT license.

// REQUIRES the following Arduino libraries:


// - DHT Sensor Library: https://github.com/adafruit/DHT-sensor-library
// - Adafruit Unified Sensor Lib: https://github.com/adafruit/Adafruit_Sensor

#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

#define DHTPIN 7 // Digital pin connected to the DHT sensor


// Feather HUZZAH ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 --
// Pin 15 can work but DHT must be disconnected during program upload.

// Uncomment the type of sensor in use:

#define DHTTYPE DHT22 // DHT 22 (AM2302)

// See guide for details on sensor wiring and usage:


// https://learn.adafruit.com/dht/overview

DHT_Unified dht(DHTPIN, DHTTYPE);

uint32_t delayMS;

Page 8 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

void setup() {
Serial.begin(9600);
// Initialize device.
dht.begin();
Serial.println(F("DHTxx Unified Sensor Example"));
// Print temperature sensor details.
sensor_t sensor;
dht.temperature().getSensor(&sensor);
Serial.println(F("------------------------------------"));
Serial.println(F("Temperature Sensor"));
Serial.print (F("Sensor Type: ")); Serial.println(sensor.name);
Serial.print (F("Driver Ver: ")); Serial.println(sensor.version);
Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("°C"));
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("°C"));
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("°C"));
Serial.println(F("------------------------------------"));
// Print humidity sensor details.
dht.humidity().getSensor(&sensor);
Serial.println(F("Humidity Sensor"));
Serial.print (F("Sensor Type: ")); Serial.println(sensor.name);
Serial.print (F("Driver Ver: ")); Serial.println(sensor.version);
Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("%"));
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("%"));
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("%"));
Serial.println(F("------------------------------------"));
// Set delay between sensor readings based on sensor details.
delayMS = sensor.min_delay / 1000;
}

void loop() {
// Delay between measurements.
delay(delayMS);
// Get temperature event and print its value.
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
Serial.println(F("Error reading temperature!"));
}
else {
Serial.print(F("Temperature: "));
Serial.print(event.temperature);
Serial.println(F("°C"));
}
// Get humidity event and print its value.
dht.humidity().getEvent(&event);
if (isnan(event.relative_humidity)) {
Serial.println(F("Error reading humidity!"));
}
else {
Page 9 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

Serial.print(F("Humidity: "));
Serial.print(event.relative_humidity);
Serial.println(F("%"));
}
}

Page 10 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

EXPERIMENT NO: 5
Photo:

AIM: Interfacing actuators (Solenoid and Relays)


Components:

1. USB Power supply and communication cable


2. Arduino Board.
3. Bread board.
4. Internet connection for Wokwi open ware simulation software for virtual connection of circuitry.
5. Arduino Uno compiler for uploading programs.
6. Relays
Procedure:

1. Follow the examples in the Arduino compiler and edit them as logically required.

2. Use Wokwi Open ware simulator using internet for different set of hardware interfacing and
paste the Arduino example programme in the sketch mode of Wokwi and save. One can refer the
internet to explore different solution and execute the programs available on internet library.

3. Simulate the required program and virtually test the connections w.r.t. the programme coded.

4. Then connect the physical wires (through bread board) as designed on Wokwi with the Arduino
board and after checking and confirming the connection connect to the PC CPU for power
supply and communication between the software and hardware chip for physically executing the
program and field elements.

5. Edit the program code with added features for better functionality.

Page 11 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

Simulator picture (Wokwi):

Program Code:
/*
Button

Turns on and off a light emitting diode(LED) connected to digital pin 13,
when pressing a pushbutton attached to pin 2.

The circuit:
- LED attached from pin 13 to ground through 220 ohm resistor
- pushbutton attached to pin 2 from +5V
- 10K resistor attached to pin 2 from ground

- Note: on most Arduinos there is already an LED on the board


attached to pin 13.

created 2005
by DojoDave <http://www.0j0.org>
modified 30 Aug 2011
by Tom Igoe

This example code is in the public domain.

https://www.arduino.cc/en/Tutorial/BuiltInExamples/Button
*/

// constants won't change. They're used here to set pin numbers:


Page 12 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

const int buttonPin = 3; // the number of the pushbutton pin


const int relayPin = 10; // the number of the LED pin

// variables will change:


int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(relayPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}

void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed. If it is, the buttonState is HIGH:


if (buttonState == HIGH) {
// turn LED on:
digitalWrite(relayPin, HIGH);
} else {
// turn LED off:
digitalWrite(relayPin, LOW);
}
}

Page 13 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

EXPERIMENT NO: 6

Photo:

AIM: Interfacing DC motor with L298N driver


Components:

1. USB Power supply and communication cable


2. Arduino Board.
3. Bread board.
4. Internet connection for Wokwi open ware simulation software for virtual connection of circuitry.
5. Arduino Uno compiler for uploading programs.
6. L298N DC Motor Driver module

Procedure:

1. Follow the examples in the Arduino compiler and edit them as logically required.

2. Use Wokwi Open ware simulator using internet for different set of hardware interfacing and
paste the Arduino example programme in the sketch mode of Wokwi and save. One can refer the
internet to explore different solution and execute the programs available on internet library.

3. Simulate the required program and virtually test the connections w.r.t. the programme coded.

4. Then connect the physical wires (through bread board) as designed on Wokwi with the Arduino
board and after checking and confirming the connection connect to the PC CPU for power
supply and communication between the software and hardware chip for physically executing the
program and field elements.

5. Edit the program code with added features for better functionality.

Page 14 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

Simulator picture (Wokwi):

Program Code:

// Motor A connections
int enA = 9;
int in1 = 8;
int in2 = 7;
// Motor B connections
int enB = 3;
int in3 = 5;
int in4 = 4;

void setup() {
// Set all the motor control pins to outputs
pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);

// Turn off motors - Initial state


digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}

Page 15 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

void loop() {
directionControl();
delay(1000);
speedControl();
delay(1000);
}

// This function lets you control spinning direction of motors


void directionControl() {
// Set motors to maximum speed
// For PWM maximum possible values are 0 to 255
analogWrite(enA, 255);
analogWrite(enB, 255);

// Turn on motor A & B


digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
delay(2000);

// Now change motor directions


digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
delay(2000);

// Turn off motors


digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}

// This function lets you control speed of the motors


void speedControl() {
// Turn on motors
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);

// Accelerate from zero to maximum speed


for (int i = 0; i < 256; i++) {
analogWrite(enA, i);
analogWrite(enB, i);
delay(20);
}

// Decelerate from maximum speed to zero


Page 16 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

for (int i = 255; i >= 0; --i) {


analogWrite(enA, i);
analogWrite(enB, i);
delay(20);
}

// Now turn off motors


digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}

Page 17 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

EXPERIMENT NO: 7
Photo:

AIM:
Components:

Procedure:

Simulator picture (Wokwi): and other informative photos/ pictures

Program Code:

Page 18 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

EXPERIMENT NO: 9
Photo:

AIM:
Components:

Procedure:

Simulator picture (Wokwi): and other informative photos/ pictures

Program Code:
Page 19 of 20
110DON BOSCO INSTITUTE OF TECHNOLOGY, (DBIT), MUMBAI, 400 070

Page 20 of 20

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy