Final Lab Report
Final Lab Report
Final Lab Report
5
(a) Interfacing of Temperature sensor with Arduino MKR1000. Write a program
to read the specific temperature of a room and display on the serial monitor.
(b) Interfacing of LDR with Arduino MKR1000. Write a program to control the
intensity of LED using LDR.
7 (a) Interfacing of a display device, i.e., LCD x2 with Arduino MKR1000. Write a
program to display “HELLO IOT” on LCD.
(b) Write a program to scroll the message “Welcome to IoT Lab.”
(c) Write a program to blink the message “Hello IoT.”
8 Write down the steps to connect Arduino MKR1000 with IoT cloud. Write a
program to blink an LED using Arduino IoT cloud.
9
Write a program to visualize data of temperature sensor on Arduino IoT cloud.
10 Design an interface to control the speed of DC motor using cloud services. Store
and visualize the data of speed of DC motor after every one sec.
IoT (CS-201)
EXPERIMENT 1
Aim of the Experiment: To Blink LED
Circuit Diagram:
Software program:
void setup()
{
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(13, HIGH);
Serial.println("LED : ON");
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(13, LOW);
Serial.println("LED : OFF");
delay(1000); // Wait for 1000 millisecond(s)
}
IoT (CS-201)
Circuit Diagram:
Circuit Diagram:
Software program:
int value=0;
void setup()
{
pinMode(A0, INPUT);
pinMode(11, OUTPUT);
}
void loop()
{
value = analogRead(A0);
digitalWrite(11,HIGH);
delay(value);
digitalWrite(11, LOW);
delay(value);
}
IoT (CS-201)
EXPERIMENT 4(a)
Aim of the Experiment: Measure the distance from obstacle and display on the serial
monitor using ultrasonic sensor
Circuit Diagram:
Software program:
const int trigpin =6;
const int echopin =7;
int distance;
int duration;
void setup()
{
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);
Serial.begin(9600);
}
IoT (CS-201)
void loop()
{
digitalWrite(trigpin, LOW);
delayMicroseconds(2);
digitalWrite(trigpin, HIGH);
delayMicroseconds(10);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
distance = (0.034*duration)/2;
Serial.print("Distance is =");
Serial.println(distance);
}
Circuit Diagram :
Software program:
int ir;
void setup()
{
pinMode(11,INPUT);
Serial.begin(9600);
}
void loop()
{
ir=digitalRead(11);
Serial.println(ir);
}
IoT (CS-201)
Screenshot of Serial monitor:
IoT (CS-201)
EXPERIMENT 5(a)
Circuit Diagram:
Software program:
#include <LiquidCrystal.h>
Serial.begin(9600);
lcd.begin(16,2);
}
void loop()
{
sensorInput = analogRead(A0);
temp = (double)sensorInput / 1024;
temp = temp * 5;
temp = temp - 0.5;
temp = temp * 100;
lcd.setCursor(0,0);
lcd.print("Temp:");
lcd.setCursor(6,0);
lcd.print(temp);
Serial.print("Current Temperature: ");
Serial.println(temp);
}
EXPERIMENT 5(b)
Aim of the Experiment: Controlling the intensity of LED using LDR.
Circuit Diagram:
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ldrPin, INPUT);
void loop()
{
IoT (CS-201)
int ldrStatus = analogRead(ldrPin);
if (ldrStatus <= 200)
{
digitalWrite(ledPin, HIGH);
Serial.print("Its DARK, Turn on the LED : ");
Serial.println(ldrStatus);
}
else
{
digitalWrite(ledPin, LOW);
Serial.print("Its BRIGHT, Turn off the LED : ");
Serial.println(ldrStatus);
}
}
EXPERIMENT 6(a)
Aim of the Experiment: Rotating a DC Motor in clockwise & anticlockwise direction using delay.
Components Used: Arduino UNO, DC Motor, H- Bridge Motor Driver, Tinkercad Stimulation.
Circuit Diagram:
pinMode(In1,OUTPUT);
pinMode(In2,OUTPUT);
Serial.begin(9600);
}
IoT (CS-201)
void loop()
{
digitalWrite(In1,HIGH);
digitalWrite(In2,LOW);
Serial.println(“Clockwise”);
delay(2000);
digitalWrite(In1,LOW);
digitalWrite(In2,HIGH);
Serial.println(“Anti Clockwise”);
delay(2000);
digitalWrite(In1,LOW);
digitalWrite(In2,LOW);
Serial.println(“Stop”);
delay(2000);
}
Circuit Diagram:
Software program:
int en=5;
int In1=12;
int In2=9;
void setup()
{
pinMode(en,OUTPUT);
pinMode(In1,OUTPUT);
pinMode(In2,OUTPUT);
Serial.begin(9600);
}
IoT (CS-201)
void loop()
{
analogWrite(en,255);
digitalWrite(In1,HIGH);
digitalWrite(In2,LOW);
Serial.println("Clockwise");
delay(2000);
analogWrite(en,255);
digitalWrite(In1,LOW);
digitalWrite(In2,HIGH);
Serial.println("Anti Clockwise");
delay(2000);
analogWrite(en,255);
digitalWrite(In1,LOW);
digitalWrite(In2,LOW);
Serial.println("Stop");
delay(2000);
}
Circuit Diagram:
Software program:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
lcd.setCursor(4,0);
lcd.print("Hello IoT");
delay(1000);
}
IoT (CS-201)
EXPERIMENT 7(b)
Circuit Diagram:
3
IoT (CS-201)
EXPERIMENT 7(c)
Circuit Diagram: