You are on page 1of 4

University Institute of Engineering

Department of Computer Science & Engineering

Experiment: 1.3

Student Name: Ayush raghbotra UID:21BCS3764


1.
Branch: Computer Science & Engineering Section/Group: A
Semester: 2nd Date of Performance: 02/03/22
Subject Name: Disruptive technologies
Subject Code: 21ECH-103

Aim of the practical: Develop a smart phone application for smart home voice-assistant.

2. Tool Used: LED, Connecting wires, Arduino Uno, Resistor, Tinkercad, MIT App Inventor,
ESP32, Stepper Motor.

3. Code:
/*
* Board: DOIT ESP32 DEVKIT v1
* Command: -
* 1 - TURN ON
* 0 - TURN OFF
*/

#include <UbidotsESPMQTT.h>

#define RELAY 25

#define TOKEN "BBFF-cWfYWnop4vYBFXbyAaiSo71BACfMPF" // Your Ubidots TOKEN


#define WIFISSID "Joker" // Your SSID
#define WIFIPASS "Joker@tenda" // Your Wifi Pass

Ubidots client(TOKEN);

void callback(char* topic, byte* payload, unsigned int length) {


Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
University Institute of Engineering
Department of Computer Science & Engineering

for (int i = 0; i < length; i++) {


Serial.print((char)payload[i]);
}
Serial.println();
Serial.print("Command: ");
bool command = *payload - 48;
Serial.println(command);
digitalWrite(RELAY, !command);
}

void setup() {
Serial.begin(9600);
Serial.println("Init... T4_Smart_Home");
pinMode(RELAY, OUTPUT);

Serial.print("Connecting to SSID: ");


Serial.print(WIFISSID);
Serial.print(", Password: ");
Serial.println(WIFIPASS);
client.wifiConnection(WIFISSID, WIFIPASS);
Serial.println("Done");

Serial.println(" Initializing Ubidots Connection...");


client.ubidotsSetBroker("industrial.api.ubidots.com"); // Sets the broker properly for the business
account
client.setDebug(true); // Pass a true or false bool value to activate debug messages
client.begin(callback);
client.ubidotsSubscribe("smart-home","bulb"); //Insert the Device and Variable's Labels
Serial.println("Done");
Serial.println("DONE");
}
void loop() {

// Establising connection with Ubidots


if (!client.connected()) {
client.reconnect();
client.ubidotsSubscribe("smart-home","bulb"); //Insert the Device and Variable's Labels
}
client.loop();
delay(1000);
}
University Institute of Engineering
Department of Computer Science & Engineering

5. Observations, Simulation Screen Shots and Discussions:

(Remote Access Pc) (Circuit )

( Graph in Ubidot site)


University Institute of Engineering
Department of Computer Science & Engineering

6. Result and Summary:

According to the code, we able to Develop a smart phone application for smart home voice-
assistant.

7. Additional Creative Inputs (If Any):

no

Learning outcomes (What I have learnt):

1. About working of Aruduino-Uno.

2.About how to automate things using Arduino.

3.Embedded Systems Introduction.

Evaluation Grid (To be filled by Faculty):


Sr. Parameters Marks Obtained Maximum Marks
No.
1. Worksheet completion including 10
writinglearning objectives/Outcomes.
(To besubmitted at the end of the day)
2. Post Lab Quiz Result. 5
3. Student Engagement in 5
Simulation/Demonstration/
Performance and Controls/Pre-Lab
Questions.
Signature of Faculty (with Date): Total Marks Obtained: 20

You might also like