0% found this document useful (0 votes)
43 views23 pages

ESIOT Manual

The document is a lab manual for the Embedded System and IoT Laboratory at M.A.M. School of Engineering, detailing various experiments for sixth-semester computer science students. It includes a syllabus of experiments involving 8051 Assembly Language, Arduino, Raspberry Pi, and IoT communication methods. Each experiment outlines the aim, required items, procedure, and programming code necessary for completion.

Uploaded by

ksathishkm
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)
43 views23 pages

ESIOT Manual

The document is a lab manual for the Embedded System and IoT Laboratory at M.A.M. School of Engineering, detailing various experiments for sixth-semester computer science students. It includes a syllabus of experiments involving 8051 Assembly Language, Arduino, Raspberry Pi, and IoT communication methods. Each experiment outlines the aim, required items, procedure, and programming code necessary for completion.

Uploaded by

ksathishkm
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/ 23

M.A.M.

SCHOOL OF ENGINEERING
(An Autonomous Institution)
(Approved by AICTE-New Delhi | Affiliated to Anna University-Chennai)
(Accredited by NAAC | Recognized under 2(f) section of UGC)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEEIRNG

SIXTH SEMESTER

CS3691
EMBEDDED SYSTEM AND IOT LABORATORY
LAB MANUAL

Trichy-Chennai Trunk Road, Siruganur, Tiruchirappalli -621 105


Website: www.mamse.in | Email: [email protected] | Mobile: 7708000972
SYLLABUS

SL.NO EXPERIMENT NAME

1. Write 8051 Assembly Language experiments using simulator.


2. Test data transfer between registers and memory.

3. Perform ALU operations.

4. Write Basic and arithmetic Programs Using Embedded C.

5. Introduction to Arduino platform and programming

6. Explore different communication methods with IoT devices (Zigbee, GSM, Bluetooth)

7. Introduction to Raspberry PI platform and python programming

8. Interfacing sensors with Raspberry PI

9. Communicate between Arduino and Raspberry PI using any wireless medium

10. Setup a cloud platform to log the data

11. Log Data using Raspberry PI and upload to the cloud platform

12. Design an IOT based system


LIST OF EXPERIMENTS
SL.
DATE NAME OF THE EXPERIMENTS MARKS SIGNATURE
NO

Interface and Program LED Array with


1.
Arduino Using Arduino platform

Interface and Program LED with


2.
Webserver Using Arduino platform

3. Interfacing Arduino to Zigbee module

4. Interfacing Arduino to GSM module

5. Interfacing Arduino to Bluetooth Module

Introduction to Raspberry PI platform and


6.
python programming

7. Interfacing sensors to Raspberry PI

Communicate between Arduino and


8.
Raspberry PI using any wireless medium

9. Setup a cloud platform to log the data

Log Data using Raspberry PI and upload


10.
to the cloud platform

Design an IOT based system –


11.
Environment Monitoring System

Write 8051 Assembly Language


12.
experiments using simulator.

Test data transfer between registers and


13.
memory.

14. Perform ALU operations

Write Basic and arithmetic Programs


15.
Using Embedded C.
Exp No.: 1 INTERFACE AND PROGRAM LED ARRAY WITH ARDUINO USING
ARDUINO PLATFORM
Date:

AIM:

To interface the 1X4 LED array with Arduino using Arduino IDE
[

REQUIRED ITEMS:

SL.NO ITEMS QUANTITY


1 PC / LAPTOP 1
2 Arduino (NodeMCU – ESP8266) 1
3 LED’s 4
4 Jumper Wires As Required
5 Resistors 4
6 USB Cable 1

PROCEDURE:

1. Open ARDUINO IDE Software


2. Click File >> New or CTRL+N to create New Project.
3. To Select Board, Click Tools >> Board > ESP8266 > NodeMCU 12E Module (1.0)
4. Click File >> Save or CTRL+S to Save Project where we Desire.
5. Type the Program.
6. Connect the Arduino NodeMCU with PC / Laptop by USB Cable
7. Select the COM PORT by Click Tools >> Port and Select Arduino's COM PORT
8. Number.
9. Click Sketch >> Verify / Compile or CTRL+R to compile the program (If any error present
debug the program)
10. Note : If COM PORT Number is Don't Know:
• Right Click My Computer Icon and Select Properties
• Click Device Manager
• Expand Ports (COM & LPT). COM PORT Number will be shown
11. Click Sketch >> Upload or CTRL+U to upload the program to Arduino NodeMCU.
12. Switch On the corresponding Units we need and Verify the Program.
PROGRAM:
int led1 = 2; LED_1 //connected with D2
int led2 = 3; LED_2 //connected with D3
int led3 = 4; LED_3 //connected with D4
int led4 = 5; LED_4 //connected with D5
void setup()
{
//Set up Loop Start
pinMode(led1 , OUTPUT); //Configure LED_1 as Output
pinMode(led2 , OUTPUT); //Configure LED_2 as Output
pinMode(led3 , OUTPUT); //Configure LED_3 as Output
pinMode(led4 , OUTPUT); //Configure LED_4 as Output
} //Set up Loop Close
void loop()
{
//Infinite Loop Start
digitalWrite(led1, HIGH); //LED_1 ON
delay(1000); //Delay 1 Second
digitalWrite(led2, HIGH); //LED_2 ON
delay(1000); //Delay Second
digitalWrite(led3, HIGH); //LED_3 ON
delay(1000); //Delay 1 Second
digitalWrite(led4, HIGH); //LED_4 ON
delay(1000); //Delay 1 Second
digitalWrite(led1, LOW); //LED_1 OFF
digitalWrite(led2, LOW);// LED_2 OFF
digitalWrite(led3, LOW);// LED_3 OFF
digitalWrite(led4, LOW);// LED_4 OFF
delay(1000); //Delay 1 Second
} //Infinite Loop Close
BLOCK DIAGRAM:

POWER SUPPLY ARDUINO NODEMCU LED ARRAY

CIRCUIT DIAGRAM:

RESULT:
Exp No.: 2 INTERFACE AND PROGRAM LED WITH WEBSERVER USING ARDUINO
PLATFORM
Date:

AIM:

To interface the LED With Webserver using Arduino IDE


[

REQUIRED ITEMS:

ITEMS QUANTITY
SL.NO
1 PC / LAPTOP 1
2 Arduino (NodeMCU – ESP8266) 1
3 LED’s 1
4 Jumper Wires As Required
5 USB Cable 1

PROCEDURE:

1. Open ARDUINO IDE Software


2. Click File >> New or CTRL+N to create New Project.
3. To Select Board, Click Tools >> Board > ESP8266 > NodeMCU 12E Module (1.0)
4. Click File >> Save or CTRL+S to Save Project where we Desire.
5. Type the Program.
6. Connect the Arduino NodeMCU with PC / Laptop by USB Cable
7. Select the COM PORT by Click Tools >> Port and Select Arduino's COM PORT
8. Number.
9. Click Sketch >> Verify / Compile or CTRL+R to compile the program (If any error present
debug the program)
10. Note : If COM PORT Number is Don't Know:
• Right Click My Computer Icon and Select Properties
• Click Device Manager
• Expand Ports (COM & LPT). COM PORT Number will be shown
11. Click Sketch >> Upload or CTRL+U to upload the program to Arduino NodeMCU.
12. Switch On the corresponding Units we need and Verify the Program.
PROGRAM:
#include <ESP8266WiFi.h>
const char* ssid = "Ps";
const char* password = "12345678";
int ledPin = 13; // GPIO13---D7 of NodeMCU
WiFiServer server(80);
void setup()
{
Serial.begin(115200);
delay(10);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.print("Use this URL to connect: ");
Serial.print("http://");
Serial.print(WiFi.localIP());
Serial.println("/");
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
Serial.println("new client");
while(!client.available()){
delay(1);
}
// Read the first line of the request
String request = client.readStringUntil('\r');
Serial.println(request);
client.flush();
// Match the request
int value = LOW;
if (request.indexOf("/LED=ON") != -1) {
digitalWrite(ledPin, HIGH);
value = HIGH;
}
if (request.indexOf("/LED=OFF") != -1) {
digitalWrite(ledPin, LOW);
value = LOW;
}
// Set ledPin according to the request
//digitalWrite(ledPin, value);
// Return the response
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println(""); // do not forget this one
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.print("Led is now: ");
if(value == HIGH) {
client.print("On");
} else {
client.print("Off");
}
client.println("<br><br>");
client.println("<a href=\"/LED=ON\"\"><button>On </button></a>");
client.println("<a href=\"/LED=OFF\"\"><button>Off </button></a><br />");
client.println("</html>");
delay(1);
Serial.println("Client disonnected");
Serial.println("");
}

BLOCK DIAGRAM:

CIRCUIT DIAGRAM:
RESULT:
Exp No.: 3
INTERFACING ARDUINO TO ZIGBEE MODULE
Date:

AIM:

To interface the ZIGBEE Module using Arduino IDE


[

REQUIRED ITEMS:

SL.NO ITEMS QUANTITY


1 PC / LAPTOP 1
2 Arduino (NodeMCU – ESP8266) 1
3 Zigbee Module 1
4 Jumper Wires As Required
5 USB Cable 1

PROCEDURE:

1. Open ARDUINO IDE Software


2. Click File >> New or CTRL+N to create New Project.
3. To Select Board, Click Tools >> Board > ESP8266 > NodeMCU 12E Module (1.0)
4. Click File >> Save or CTRL+S to Save Project where we Desire.
5. Type the Program.
6. Connect the Arduino NodeMCU with PC / Laptop by USB Cable
7. Select the COM PORT by Click Tools >> Port and Select Arduino's COM PORT
8. Number.
9. Click Sketch >> Verify / Compile or CTRL+R to compile the program (If any error present
debug the program)
10. Note : If COM PORT Number is Don't Know:
• Right Click My Computer Icon and Select Properties
• Click Device Manager
• Expand Ports (COM & LPT). COM PORT Number will be shown
11. Click Sketch >> Upload or CTRL+U to upload the program to Arduino NodeMCU.
12. Switch On the corresponding Units we need and Verify the Program.
PROGRAM:

CODE: Receiver side


#include<SoftwareSerial.h>
int led = 2;
int received = 0;
int i;
SoftwareSerial zigbee(13,12);
void setup() {
Serial.begin(9600);
zigbee.begin(9600);
pinMode(led, OUTPUT);
}
void loop() {
if (zigbee.available() > 0) {
received = zigbee.read();
if (received == '0'){
Serial.println("Turning off LED");
digitalWrite(led, LOW);
}
else if (received == '1'){
Serial.println("Turning on LED");
digitalWrite(led, HIGH);
}
}
}
CODE: Transmitter side
#include "SoftwareSerial.h"
SoftwareSerial XBee(2,3);
int BUTTON = 5;
boolean toggle = false;
void setup()
{
Serial.begin(9600);
pinMode(BUTTON, INPUT_PULLUP);
XBee.begin(9600);
}
void loop()
{
if (digitalRead(BUTTON) == LOW && toggle)
{
Serial.println("Turn on LED");
toggle = false;
XBee.write('1');
delay(1000);
}
else if (digitalRead(BUTTON) == LOW && !toggle)
{
Serial.println("Turn off LED");
toggle = true;
XBee.write('0');
delay(1000);
}
}
CIRCUIT DIAGRAM:

RESULT:
Exp No.: 4
INTERFACING ARDUINO TO GSM MODULE
Date:

AIM:

To interface the GSM Module using Arduino IDE


[

REQUIRED ITEMS:

SL.NO ITEMS QUANTITY


1 PC / LAPTOP 1
2 Arduino (NodeMCU – ESP8266) 1
3 GSM Module 1
4 Jumper Wires As Required
5 USB Cable 1

PROCEDURE:

1. Open ARDUINO IDE Software


2. Click File >> New or CTRL+N to create New Project.
3. To Select Board, Click Tools >> Board > ESP8266 > NodeMCU 12E Module (1.0)
4. Click File >> Save or CTRL+S to Save Project where we Desire.
5. Type the Program.
6. Connect the Arduino NodeMCU with PC / Laptop by USB Cable
7. Select the COM PORT by Click Tools >> Port and Select Arduino's COM PORT
8. Number.
9. Click Sketch >> Verify / Compile or CTRL+R to compile the program (If any error present
debug the program)
10. Note : If COM PORT Number is Don't Know:
• Right Click My Computer Icon and Select Properties
• Click Device Manager
• Expand Ports (COM & LPT). COM PORT Number will be shown
11. Click Sketch >> Upload or CTRL+U to upload the program to Arduino NodeMCU.
12. Switch On the corresponding Units we need and Verify the Program.
PROGRAM:
#define BLYNK_PRINT Serial
/* ESP & Blynk */
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
int VResistor = A0;
int vrdata = 0;
int Push_Button = D0;
int VRFlag = 0;
String textForSMS;
char auth[] = "LnMZlB1ZiT1kgYW1uGgc-yiPflg6BRav";
/* WiFi credentials */
char ssid[] = "AndroidAP7DF8";
char pass[] = "electroniclinic";
SimpleTimer timer;
void setup() {
randomSeed(analogRead(0));
Serial.begin(9600); // original 19200. while enter 9600 for SerialA
pinMode(VResistor,INPUT);
pinMode(Push_Button, INPUT_PULLUP);
delay(5000); // wait for 5 seconds
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, Sensors);
}
void loop() {
timer.run(); // Initiates SimpleTimer
Blynk.run();
}
void sendSMS(String message)
{
Serial.print("AT+CMGF=1\r"); // AT command to send SMS message
delay(200);
Serial.println("AT + CMGS = \"+923339218213\"");
// recipient's mobile number, in international format
delay(200);
Serial.println(message); // message to send
delay(200);
Serial.println((char)26); // End AT command with a ^Z, ASCII code 26
delay(200);
Serial.println();
delay(100); // give module time to send SMS
Blynk.begin(auth, ssid, pass);
}
void Sensors()
{
vrdata = analogRead(VResistor);
Blynk.virtualWrite(V2, vrdata);
if ((vrdata > 500) && (VRFlag == 0))
{
textForSMS = "\nValue Exceeded!!!\n";
textForSMS = textForSMS + " Sensor Value: ";
textForSMS = textForSMS + vrdata;
textForSMS = textForSMS + "\n";
sendSMS(textForSMS);
//Serial.println(textForSMS);
//Serial.println("message sent.");
textForSMS = "";
delay(200);
VRFlag = 1;
}
if ((vrdata < 500) && (VRFlag == 1))
{
textForSMS = "\nValue Got Normal\n";
textForSMS = textForSMS + " Sensor Value: ";
textForSMS = textForSMS + vrdata;
textForSMS = textForSMS + "\n";
sendSMS(textForSMS);
//Serial.println(textForSMS);
textForSMS = "";
delay(200);
VRFlag = 0;
}
if (digitalRead(Push_Button) == LOW)
{
textForSMS = "\nButton is pressed.\n";
textForSMS = textForSMS + " Project by: ";
textForSMS = textForSMS + "Electronic Clinic";
textForSMS = textForSMS + "\n";
sendSMS(textForSMS);
//Serial.println(textForSMS);
textForSMS = "";
delay(200);
}
}
CIRCUIT DIAGRAM:
RESULT:
Exp No.: 5
INTERFACING ARDUINO TO BLUETOOTH MODULE
Date:

AIM:

To interface the Bluetooth Module using Arduino IDE


[

REQUIRED ITEMS:

SL.NO ITEMS QUANTITY


1 PC / LAPTOP 1
2 Arduino (NodeMCU – ESP8266) 1
3 Bluetooth Module 1
4 Jumper Wires As Required
5 USB Cable 1

PROCEDURE:

1. Open ARDUINO IDE Software


2. Click File >> New or CTRL+N to create New Project.
3. To Select Board, Click Tools >> Board > ESP8266 > NodeMCU 12E Module (1.0)
4. Click File >> Save or CTRL+S to Save Project where we Desire.
5. Type the Program.
6. Connect the Arduino NodeMCU with PC / Laptop by USB Cable
7. Select the COM PORT by Click Tools >> Port and Select Arduino's COM PORT
8. Number.
9. Click Sketch >> Verify / Compile or CTRL+R to compile the program (If any error present
debug the program)
10. Note : If COM PORT Number is Don't Know:
• Right Click My Computer Icon and Select Properties
• Click Device Manager
• Expand Ports (COM & LPT). COM PORT Number will be shown
11. Click Sketch >> Upload or CTRL+U to upload the program to Arduino NodeMCU.
12. Switch On the corresponding Units we need and Verify the Program.
PROGRAM:
#include <SoftwareSerial.h>

#define LED_PIN D4 // GPIO2 on NodeMCU

SoftwareSerial BT(D7, D8); // RX, TX

void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);

BT.begin(9600); // Default baud rate of HC-05


Serial.begin(115200);

Serial.println("Bluetooth LED Control Ready");


}

void loop() {
if (BT.available()) {
char command = BT.read();
Serial.println(command);

if (command == '1') {
digitalWrite(LED_PIN, HIGH); // Turn LED ON
Serial.println("LED ON");
}
else if (command == '0') {
digitalWrite(LED_PIN, LOW); // Turn LED OFF
Serial.println("LED OFF");
}
}
}
CIRCUIT DIAGRAM:

RESULT:

You might also like