APEEJAY STYA UNIVERSITY
IOT PRACTICAL FILE
SUBMITED BY
Name: Diksha
Enrollment No.: Asu2022010200186
Programme: B.Tech (Cse)
Year : 3rd
SUBMITTED TO
Dr. Moin Uddin
SCHOOL OF ENGINEERING & TECHNOLOGY
Submitted Date: 07 MAY 2025
Lab 1 Buzzer
// Sketch Name : BUZZER
// Device : ARDUINO UNO
//
// Hardware description
// Buzzer Connection:
// PIN #2 (CN27) :-> IN (CN25)
//
// Software description
//
// This Program will turn ON-OFF BUZZER with a second delay.
//
#define BUZZER 2
void setup()
pinMode(BUZZER, OUTPUT);
void loop()
digitalWrite(BUZZER,HIGH);
delay(1000);
digitalWrite(BUZZER,LOW);
delay(1000);
}
Lab 2 LCD
// Sketch Name : LCD
// Device : ARDUINO UNO
//
// Hardware description
//
// LCD Connection:
// (CN31) (CN10)
// A4(SDA) :-> SDA
// A5(SCL) :-> SCL
//
// Software description
//
// This Program will display Excel Technologies on the LCD.
//
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7); // Set the LCD parameters (I2C Address, En, RW, RS,
D4, D5, D6, D7)
void setup()
{
Serial.begin(9600);
lcd.begin (16,2); // for 16 x 2 LCD module
void loop()
lcd.setCursor(5, 0); // Go to column 4, row 0
lcd.print("APEEJAY STYA");
lcd.setCursor(2, 1); // Go to column 0, row 1
lcd.print("UNIVERSITY");
}
Lab 3 LED
// Sketch Name : LED_BLINK
// Device : ARDUINO UNO
//
// Hardware description
// LED Coneections:
// PIN #2-5 (CN27) :-> 0-3 (CN11)
// PIN #6-9 (CN28) :-> 4-7 (CN12)
//
// Software description
// This Program will TURN ON-OFF LEDS with a second delay.
//
#define L0 2
#define L1 3
#define L2 4
#define L3 5
#define L4 6
#define L5 7
#define L6 8
#define L7 9
void setup() {
pinMode(L0, OUTPUT);
pinMode(L1, OUTPUT);
pinMode(L2, OUTPUT);
pinMode(L3, OUTPUT);
pinMode(L4, OUTPUT);
pinMode(L5, OUTPUT);
pinMode(L6, OUTPUT);
pinMode(L7, OUTPUT);}
void loop() {
digitalWrite(L0,HIGH);
digitalWrite(L1,HIGH);
digitalWrite(L2,HIGH);
digitalWrite(L3,HIGH);
digitalWrite(L4,HIGH);
digitalWrite(L5,HIGH);
digitalWrite(L6,HIGH);
digitalWrite(L7,HIGH);
delay(1000);
digitalWrite(L0,LOW);
digitalWrite(L1,LOW);
digitalWrite(L2,LOW);
digitalWrite(L3,LOW);
digitalWrite(L4,LOW);
digitalWrite(L5,LOW);
digitalWrite(L6,LOW);
digitalWrite(L7,LOW);
delay(1000);}
Lab 4 Bluetooth
// Sketch Name : BLUETOOTH
// Device : ARDUINO UNO
//
// Hardware description
//
// Bluetooth Module Connection:
// Pin #2 (CN27) :-> Rx (1st pin from top)(CN20)
// Pin #3 (CN27) :-> Tx (2nd pin from top)(CN20)
//
//
// CN20 PINS:
// 1st : Rx
// 2nd : Tx
// 3rd : State
// 4th : Enable
//
// Software description
//
// This Program will transmit data from Smartphone via Bluetooth to the Arduino Uno and
display it on Serial Monitor of Arduino IDE.
//
// Download and install a Bluetooth terminal application on your phone and use it to connect
to the HC-05 Bluetooth module.
// Default Bluetooth name of the device is “HC-05” and default PIN (password) for connection
is either “0000” or “1234”.
//
// Data is sent from the Smartphone using the Bluetooth terminal application.
//
#include<SoftwareSerial.h>
/* Create object named bt of the class SoftwareSerial */
SoftwareSerial bt(3,2); /* (Rx,Tx) */
void setup() {
bt.begin(9600); /* Define baud rate for software serial communication */
Serial.begin(9600); /* Define baud rate for serial communication */
void loop() {
if (bt.available()) /* If data is available on serial port */
Serial.write(bt.read()); /* Print character received on to the serial monitor */
}
Lab 5 DAC
// Sketch Name : DAC
// Device : ARDUINO UNO
//
// Hardware description
//
// AD-DA Connection:
// (CN30) (CN35)
// A4 (SDA) :-> SDA
// A5 (SCL) :-> SCL
//
// Triangle Wave Output can be observed on Aout Pin(CN34) and Aout socket.
//
// Software description
//
// This Program will make PCF8591 generate Triangle wave.
//
#include "Wire.h"
#define PCF8591 (0x9E >> 1) // I2C bus address; E, as address bits are pulled up
void setup()
Wire.begin();
}
void loop()
for (int i=0; i<256; i++)
Wire.beginTransmission(PCF8591); // wake up PCF8591
Wire.write(0x40); // control byte - turn on DAC (binary 1000000)
Wire.write(i); // value to send to DAC
Wire.endTransmission(); // end tranmission
for (int i=255; i>=0; --i)
Wire.beginTransmission(PCF8591); // wake up PCF8591
Wire.write(0x40); // control byte - turn on DAC (binary 1000000)
Wire.write(i); // value to send to DAC
Wire.endTransmission(); // end tranmission