0% found this document useful (0 votes)
12 views68 pages

E&si Lab Manual

The document outlines the curriculum and laboratory exercises for the Embedded System and IoT Laboratory at Karpaga Vinayaga College of Engineering and Technology. It includes various assembly language and Embedded C programming tasks, such as addition, subtraction, multiplication, and division of 8-bit numbers, as well as data transfer between registers and memory. Additionally, it provides an introduction to Arduino and Raspberry Pi platforms, along with practical applications involving sensor interfacing and cloud data logging.

Uploaded by

Janani V
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)
12 views68 pages

E&si Lab Manual

The document outlines the curriculum and laboratory exercises for the Embedded System and IoT Laboratory at Karpaga Vinayaga College of Engineering and Technology. It includes various assembly language and Embedded C programming tasks, such as addition, subtraction, multiplication, and division of 8-bit numbers, as well as data transfer between registers and memory. Additionally, it provides an introduction to Arduino and Raspberry Pi platforms, along with practical applications involving sensor interfacing and cloud data logging.

Uploaded by

Janani V
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/ 68

KARPAGA VINAYAGA

COLLEGE OF ENGINEERING AND TECHNOLOGY


Chinna Kolambakkam, Madhurantakam Tk, 603308

DEPARTMENT OF
ARTIFICIAL INTELLIGENCE AND DATA SCIENCE

CS3691
EMBEDDED SYSTEM AND IOT LABORATORY

NAME

REGISTER NO :

BRANCH

SEM/YEAR
KARPAGA VINAYAGA
COLLEGE ENGINEERING & TECHNOLOGY
Chinnakolambakkam, Madurantakam Tk, 603308

Name ………………………………………………………………………………………………………………………………………………….

Year……………………….. Semester ……………… Branch ………………………………………………………………………………

University Registration No: …………………………………………………………………………………………………………………

Certified that this is a bonafide record of work done by the above student in the ………………………………
………………………………………………………………………………… Laboratory during the year ………………………………

Signature of Staff In-Charge Signature of Head of the Department

Submitted for the University Practical Examination held on …………………………………………………………….

Signature of Internal Examiner Signature of External Examiner


INDEX

SNO. DATE EXPERIMENT TITLE PAGE.NO. MARKS SIGN.


1. 1–2
Addition of two 8-bit numbers
2. 2–4
Subtraction of two 8-bit numbers
3. 5–6
Multiplications of two 8-bit numbers
4. 7–8
Division of two 8-bit numbers

5. Test data transfer between registers and 9 – 10


memory
6. 11 – 12
Programs using embedded c
7.
Programs using Embedded C 13 – 14

8. Introduction to the Arduino platform 15 – 27

9. Programs using Arduino uno 28 – 29

10. Programs using Arduino uno for led 30 – 31


blinking
11. Programs using Arduino uno for 32 – 34
Bluetooth
Communication
12. ZIGBEE Communication 35 – 38

13. Introduction to the Raspberry Pi Platform 39 – 41

14. Introduction to python programming 42 – 46

15. Interfacing sensors with raspberry pi 47 – 50

Communicate between Arduino and 51 – 53


16. Raspberry pi

17. Cloud platform to log the data 54 – 59

18. 60 – 62
Log data using raspberry pi and upload it
To the cloud platform
19. 63 - 65
Design an IoT based systems
EX.NO: 1
Addition of two 8-bit numbers.
DATE:

AIM:
To write and execute an Assembly language program to perform addition of two
8-bit numbers.

SOFTWARE REQUIRED:

S.No Software Requirements Quantity


1 Keil μvision5 IDE 1

PROCEDURE

1. Create a new project, go to “Project” and close the current project “Close

Project”.

2. Next Go to the Project New μVision Project and Create a New Project

Select Device for the Target.


3. Select the device AT89C51ED2 or AT89C51 or AT89C52

4. Add Startup file Next go to “File” and click “New”.

5. Write a program on the editor window and save it with .asm extension.

6. Add this source file to Group and click on “Build Target” or F7.

7. Go to debugging mode to see the result of the simulation by clicking Run or

Step run.

1
PROGRAM:

ORG 00H
SJMP START
ORG 30H
START:
CLR C

MOV A, #20H

MOV B, #21H

ADD A, B
MOV R0, A
END

INPUT:

A=20h
B=21h

OUTPUT:
R0=41h

RESULT:

Thus, the program for the addition of two 8-bit numbers is executed and the
results are verified successfully using Keil Software.

2
EX.NO: 2
Subtraction of two 8-bit numbers
DATE:

AIM:
To write and execute an Assembly language program to perform Subtraction of
two 8-bit numbers.

SOFTWARE REQUIRED:

S.No Software Requirements Quantity


1 Keil μvision5 IDE 1

PROCEDURE

1. Create a new project, go to “Project” and close the current project “Close

Project”.

2. Next Go to the Project New μVision Project and Create a New Project

Select Device for the Target.


3. Select the device AT89C51ED2 or AT89C51 or AT89C52

4. Add Startup file Next go to “File” and click “New”.

5. Write a program on the editor window and save it with .asm extension.

6. Add this source file to Group and click on “Build Target” or F7.

7. Go to debugging mode to see the result of the simulation by clicking Run or

Step run.

3
PROGRAM:

ORG 00H
SJMP START
ORG 30H
START:

CLR C
MOV A, #25H MOV
B, #04H SUBB A, B
MOV R0, A MOV
R1, B END

INPUT:

A=25h B=04h

OUTPUT:

R0=21h
R1=00h

RESULT:

Thus, the program for the subtraction of two 8-bit numbers is executed and the results
are verified successfully using Keil Software.

4
EX.NO: 3 Multiplications of two 8-bit numbers
DATE:

AIM:
To write and execute an Assembly language program to perform Multiplications
of two 8-bit numbers.

SOFTWARE REQUIRED:

S.No Software Requirements Quantity


1 Keil μvision5 IDE 1

PROCEDURE

1. Create a new project, go to “Project” and close the current project “Close

Project”.

2. Next Go to the Project New μVision Project and Create a New Project

Select Device for the Target.


3. Select the device AT89C51ED2 or AT89C51 or AT89C52

4. Add Startup file Next go to “File” and click “New”.

5. Write a program on the editor window and save it with .asm extension.

6. Add this source file to Group and click on “Build Target” or F7.

7. Go to debugging mode to see the result of the simulation by clicking Run or

Step run.

5
PROGRAM:

ORG 00H
SJMP START
ORG 30H
START:

CLR C //MULTIPLICATION
MOV A, #03H
MOV B, #04H
MUL AB
MOV R0, A
MOV R1, B
END

INPUT:

A=03h
B=04h

OUTPUT:

R0=0Ch
R1=00h

RESULT:

Thus, the program for the multiplication of two 8-bit numbers is executed and the
results are verified successfully using Keil Software.

6
EX.NO: 4
Division of two 8-bit numbers
DATE:

AIM:
To write and execute an Assembly language program to perform Division of
two 8-bit numbers.

SOFTWARE REQUIRED:

S.No Software Requirements Quantity


1 Keil μvision5 IDE 1

PROCEDURE

1. Create a new project, go to “Project” and close the current project “Close

Project”.

2. Next Go to the Project New μVision Project and Create a New Project

Select Device for the Target.


3. Select the device AT89C51ED2 or AT89C51 or AT89C52

4. Add Startup file Next go to “File” and click “New”.

5. Write a program on the editor window and save it with .asm extension.

6. Add this source file to Group and click on “Build Target” or F7.

7. Go to debugging mode to see the result of the simulation by clicking Run or

Step run.

7
PROGRAM:

ORG 00H
SJMP START
ORG 30H
START:

CLR C //DIVISION
MOV A, #45H
MOV B, #04H
DIV AB
MOV R0, A
MOV R1, B
END

INPUT:

A=45h
B=04h

OUTPUT:

R0 = 17

R1 = 1

RESULT:
Thus, the program for the multiplication of two 8-bit numbers is executed and
the results are verified successfully using Keil Software.

8
EX.NO: 5
Test data transfer between registers and memory
DATE:

AIM:
To write and execute an Assembly language program to transfer data between
registers and memory.

SOFTWARE REQUIRED:

S.No Software Requirements Quantity

1 Keil μvision5 IDE 1

PROCEDURE

1. Create a new project, go to “Project” and close the current project “Close
Project”.
2. Next Go to the Project New μVision Project and Create a New Project

Select Device for the Target.


3. Select the device AT89C51ED2 or AT89C51 or AT89C52
4. Add Startup file Next go to “File” and click “New”.
5. Write a program on the editor window and save it with .asm extension.
6. Add this source file to Group and click on “Build Target” or F7.
7. Go to debugging mode to see the result of the simulation by clicking Run or
Step run.

9
PROGRAM:

ORG 0000H

CLR C

MOV R0, #30H

MOV R1, #40H

MOV R2, #05H

BACK: MOV A, @R0

MOV @R1, A

INC R0

INC R1

DJNZ R2, BACK

END

INPUT DATA:
Source
Destination
S.NO Memory Data’s Data’s
Location Memory Location

1 30 11 40 11

2 31 22 41 22

3 33 33 42 33

4 34 44 43 44

5 35 55 44 55

RESULT:

Thus, the execution of program to transfer the data between memories is done
successfully.

10
EX.NO: 6
PROGRAMS USING EMBEDDED C
DATE:

AIM:

Write program to load three numbers into Accumulator and sending them to port1
using Embedded C Language.

SOFTWARE REQUIRED:

S.No Software Requirements Quantity

1 Keil μvision5 IDE 1

PROCEDURE

1. Create a new project, go to “Project” and close the current project “Close

Project”.

2. Next Go to the Project New μvision Project and Create New Project
Select Device for Target.
3. Select the device AT89C51ED2 or AT89C51 or AT89C52

4. Add Startup file Next go to “File” and click “New”.

5. Write a program on the editor window and save it with the .c extension.

6. Add this source file to Group and click on “Build Target” or F7.

7. Go to debugging mode to see the result of the simulation by clicking Run or

8. Step run.

11
PROGRAM:

#include <reg51.h> void main


()
{ ACC=0x25;
P1=ACC;
ACC=0x46;
P1=ACC;
ACC=0x92;
P1=ACC;
}

INPUT DATA and OUTDATA:

A=25h
0 0 1 0 0 1 0 1

A=46h
0 1 0 0 0 1 1 0

A=92h
1 0 0 1 0 0 1 0

RESULTS:
Thus, the program to load three numbers into Accumulator and sending them to
PORT1 is done successfully.

12
EX.NO: 7
PROGRAMS USING EMBEDDED C
DATE:

AIM:

To write an embedded C program to send values 00 – FF to port P1.


using the Keil software.

SOFTWARE REQUIRED:

S.No Software Requirements Quantity


1 Keil μvision5 IDE 1

PROCEDURE

1. Create a new project, go to “Project” and close the current project “Close
Project”.

2. Next Go to the Project New μvision Project and Create New Project

Select Device for Target.


3. Select the device AT89C51ED2 or AT89C51 or AT89C52

4. Add Startup file Next go to “File” and click “New”.

5. Write a program on the editor window and save it with the .c extension.

6. Add this source file to Group and click on “Build Target” or F7.

7. Go to debugging mode to see the result of the simulation by clicking Run or

Step run.

13
PROGRAM:

#include <reg51.h>
void main ()
{
unsigned char z;
for (z = 0; z <= 255; z++)
P1=Z;
}

INPUT DATA:

Z= 0 to 255

OUTPUT DATA at
PORT 1Z=00H
0 0 0 0 0 0 0 0

Z=01H
0 0 0 0 0 0 0 1

Z=02H
0 0 0 0 0 0 2 0
.
.
.
Z=FFH
1 1 1 1 1 1 1 1

RESULT:
Thus, the embedded C program to send values 00 – FF to port P1 using the Keil
software is executed and verified the values successfully.

14
EXP NO: 08 INTRODUCTION TO THE ARDUINO PLATFORM
DATE:

AIM:
To study the basics of Arduino Uno board and Arduino IDE 2.0 software.

Hardware & SOFTWARE TOOLS REQUIRED:

S.No. Hardware & Software Requirements Quantity


1 Arduino IDE 2.0 1
2 Arduino Uno Board 1

INTRODUCTION TO ARDUINO:

The Arduino UNO is a standard board of Arduino. Here UNO means 'one' in Italian. It was named
UNO to label the first release of Arduino Software. It was also the first USB board released
by Arduino. It is considered a powerful board used in various projects. Arduino. cc developed
the Arduino UNO board. Arduino UNO is based on an ATmega328P microcontroller. It is easy to use
compared to other boards, such as the Arduino Mega board, etc. The board consists of digital and
analog Input/Output pins (I/O), shields, and other circuits. The Arduino UNO includes 6 analog pin
inputs, 14 digital pins, a USB connector, a power jack, and an ICSP (In-Circuit Serial Programming)
header. It is programmed based on IDE, which stands for Integrated Development Environment. It
can run on both online and offline platforms. The IDE is common to all available boards of Arduino.

The Arduino board is shown below:

15
The components of Arduino UNO board are shown below:

Let's discuss each component in detail.


o ATmega328 Microcontroller- It is a single-chip Microcontroller of the ATmel family. The processor
code inside it is of 8-bit. It combines Memory (SRAM, EEPROM, and Flash), Analog to Digital
Converter, SPI serial ports, I/O lines, registers, timers, external and internal interrupts, and
oscillator.
o ICSP pin - The In-Circuit Serial Programming pin allows the user to program using the firmware of
the Arduino board.
o Power LED Indicator- The ON status of the LED shows the power is activated. When the power is
OFF, the LED will not light up.
o Digital I/O pins- The digital pins have the value HIGH or LOW. The pins numbered from D0 to D13
are digital pins.
o TX and RX LED's- The successful flow of data is represented by the lighting of these LED's.
o AREF- The Analog Reference (AREF) pin is used to feed a reference voltage to the Arduino UNO
board from the external power supply.
o Reset button- It is used to add a Reset button to the connection.
o USB- It allows the board to connect to the computer. It is essential for the programming of the
Arduino
UNO board.
o Crystal Oscillator- The Crystal oscillator has a frequency of 16MHz, which makes the Arduino UNO
a powerful board.
o Voltage Regulator- The voltage regulator converts the input voltage to 5V.
o GND- Ground pins. The ground pin acts as a pin with zero voltage.
o Vin- It is the input voltage.
o Analog Pins- The pins numbered from A0 to A5 are analog pins. The function of Analog pins is to
read the analog sensor used in the connection. It can also act as GPIO (General Purpose Input Output)
pin.

16
TECHNICAL SPECIFICATIONS OF ARDUINO UNO
The technical specifications of the Arduino UNO are listed below:
o There are 20 Input/Output pins present on the Arduino UNO board. These 20 pins include 6 PWM
pins, 6 analog pins, and 8 digital I/O pins.
o The PWM pins are Pulse Width Modulation capable.
o The crystal oscillator present in Arduino UNO comes with a frequency of 16MHz.
o It also has an Arduino-integrated WIFI module. Such Arduino UNO board is based on the Integrated
WIFI ESP8266 Module and ATmega328P microcontroller.
o The input voltage of the UNO board varies from 7V to 20V.
o Arduino UNO automatically draws power from the external power supply. It can also draw power
from the USB.

ARDUINO UNO PINOUT


The Arduino UNO is a standard board of Arduino, which is based on an
ATmega328P microcontroller. It is easier to use than other types of Arduino Boards.
The Arduino UNO Board, with the specification of pins, is shown below:

17
Let's discuss each pin in detail.
ATmega328 Microcontroller- It is a single chip Microcontroller of the ATmel family. The processor core
inside it is of 8-bit. It is a low-cost, low powered, and a simple microcontroller. The Arduino UNO and Nano
models are based on the ATmega328 Microcontroller.
Voltage Regulator: The voltage regulator converts the input voltage to 5V. The primary function of voltage
regulator is to regulate the voltage level in the Arduino board. For any changes in the input voltage of the
regulator, the output voltage is constant and steady.
GND - Ground pins. The ground pins are used to ground the circuit.
TXD and RXD: TXD and RXD pins are used for serial communication. The TXD is used for transmitting the
data, and RXD is used for receiving the data. It also represents the successful flow of data.

USB Interface: The USB Interface is used to plug-in the USB cable. It allows the board to connect to the
computer. It is essential for the programming of the Arduino UNO board.
RESET: It is used to add a Reset button to the connection.
SCK: It stands for Serial Clock. These are the clock pulses, which are used to synchronize the transmission
of data.
MISO: It stands for Master Input/ Slave Output. The save line in the MISO pin is used to send the data to
the master.
VCC: It is the modulated DC supply voltage, which is used to regulate the IC's used in the connection. It is
also called as the primary voltage for IC's present on the Arduino board. The Vcc voltage value can be negative
or positive with respect to the GND pin.
Crystal Oscillator- The Crystal oscillator has a frequency of 16MHz, which makes the Arduino UNO a
powerful board.
ICSP: It stands for In-Circuit Serial Programming. The users can program the Arduino board's firmware
using the ICSP pins. The program or firmware with the advanced functionalities is received by microcontroller
with the help of the ICSP header. The ICSP header consists of 6 pins.
The structure of the ICSP header is shown below:

SDA: It stands for Serial Data. It is a line used by the slave and master to send and receive data. It is called

18
as a data line, while SCL is called as a clock line.
SCL: It stands for Serial Clock. It is defined as the line that carries the clock data. It is used to synchronize
the transfer of data between the two devices. The Serial Clock is generated by the device and it is called as
master.
SPI: It stands for Serial Peripheral Interface. It is popularly used by the microcontrollers to communicate
with one or more peripheral devices quickly. It uses conductors for data receiving, data sending,
synchronization, and device selection (for communication).
MOSI: It stands for Master Output/ Slave Input. The MOSI and SCK are driven by the Master.
SS: It stands for Slave Select. It is the Slave Select line, which is used by the master. It acts as the enable line.
I2C: It is the two-wire serial communication protocol. It stands for Inter Integrated Circuits. The I2C is a serial
communication protocol that uses SCL (Serial Clock) and SDA (Serial Data) to receive and send data between
two devices.

3.3V and 5V are the operating voltages of the board.

INTRODUCTION TO ARDUINO IDE 2.0:

The Arduino IDE 2.0 is an open-source project, currently in its beta-phase. It is a big step from it's
sturdy predecessor, Arduino IDE 2.0, and comes with revamped UI, improved board & library
manger, autocomplete feature and much more.
In this tutorial, we will go through step by step, how to download and install the software.
Download the editor
Downloading the Arduino IDE 2.0 is done through the Arduino Software page. Here you will also
find information on the other editors available to use.

Requirements
Windows - Win 10 and newer, 64 bits
Linux - 64 bits
Mac OS X - Version 10.14: "Mojave" or newer, 64 bits

Installation
Windows
Download URL: https://www.arduino.cc/en/software
To install the Arduino IDE 2.0 on a Windows computer, simply run the file downloaded from the
software page.

19
Follow the instructions in the installation guide. The installation may take several minutes

You can now use the Arduino IDE 2.0 on your windows computer!

How to use the board manager with the Arduino IDE 2.0
The board manager is a great tool for installing the necessary cores to use your Arduino boards. In
this quick tutorial, we will take a look at how to install one, and choosing the right core for your
board!
Requirements
Arduino IDE 2.0 installed.
Why use the board manager?
The board manager is a tool that is used to install different cores on your local computer. So what
is a core, and why is it necessary that I install one?
Simply explained, a core is written and designed for specific microcontrollers. As Arduino have
several different types of boards, they also have different type of microcontrollers.

20
For example, an Arduino UNO has an ATmega328P, which uses the AVR core, while an Arduino
Nano 33 IoT has a SAMD21 microcontroller, where we need to use the SAMD core.
In conclusion, to use a specific board, we need to install a specific core.
Installing a core
Installing a core is quick and easy, but let's take a look at what we need to do.
1. Open the Arduino IDE 2.0.

2. With the editor open, let's take a look at the left column. Here, we can see a couple of icons.
Let's click the on the "computer chip" icon.

3. A list will now appear of all available cores. Now let's say we are using an Nano
33 IoT board, and we want to install the core. Simply enter the name in the search field,
and the right core (SAMD) will appear, where the Nano 33 IoT features in the description.
Click on the "INSTALL" button.

4. This will begin an installation process, which in some cases may take several minutes.

21
5. When it is finished, we can take a look at the core in the boards manager column, where it
should say "INSTALLED".

You have now successfully downloaded and installed a core on your machine, and you can start
using your Arduino board!
How to upload a sketch with the Arduino IDE 2.0
In the Arduino environment, we write sketches that can be uploaded to Arduino boards. In
this tutorial, we will go through how to select a board connected to your computer, and how to upload
a sketch to that board, using the Arduino IDE 2.0.
Requirements
Arduino IDE 2.0 installed.
Verify VS Upload
There are two main tools when uploading a sketch to a board: verify and upload. The verify tool

22
simply goes through your sketch, checks for errors and compiles it. The upload tool does the same,
but when it finishes compiling the code, it also uploads it to the board.
A good practice is to use the verifying tool before attempting to upload anything. This is a quick
way of spotting any errors in your code, so you can fix them before actually uploading the code.
Uploading a sketch
Installing a core is quick and easy, but let's take a look at what we need to do.
1. Open the Arduino IDE 2.0.
With the editor open, let's take a look at the navigation bar at the top. At the very left,
there is a checkmark and an arrow pointing right. The checkmark is used to verify, and
the arrow is used to upload.

2. Click on the verify tool (checkmark). Since we are verifying an empty sketch, we can be sure
it is going to compile. After a few seconds, we can see the result of the action in the console
(black box in the bottom).

1. Now we know that our code is compiled, and that it is working. Now, before we can upload the
code to our board, we will first need to select the board that we are using. We can do this by
navigating to Tools > Port > {Board}. The board(s) that are connected to your computer

23
should appear here, and we need to select it by clicking it. In this case, our board is
displayed as COM44 (Arduino UNO).

5. With the board selected, we are good to go! Click on the upload button, and it will start
uploading the sketch to the board.
6. When it is finished, it will notify you in the console log. Of course, sometimes there are
some complications when uploading, and these errors will be listed here as well.

you have now uploaded a sketch to your Arduino board!

How to install and use a library with the Arduino IDE 2.0
A large part of the Arduino programming experience is the use of libraries. Thousands of libraries
can be found online, and the best-documented ones can be found and installed directly through the
editor. In this tutorial, we will go through how to install a library using the library manager in the
Arduino IDE 2.0. We will also show how to access examples from a library that you have installed.
Requirements
Arduino IDE 2.0 installed.

24
Why use libraries?
Libraries are incredibly useful when creating a project of any type. They make our development
experience much smoother, and there almost an infinite amount out there. They are used to interface
with many different sensors, RTCs, Wi-Fi modules, RGB matrices and of course with other
components on your board.
Arduino has many official libraries, but the real heroes are the Arduino community, who develop,
maintain and improve their libraries on a regular basis.
Installing a library
Installing a library is quick and easy, but let's take a look at what we need to do.
1. Open the Arduino IDE 2.0.
2. With the editor open, let's take a look at the left column. Here, we can see a couple of icons.
Let's click the on the "library" icon.

3. A list will now appear of all available libraries, where we can also search for the library we
want to use. In this example, we are going to install the RTCZero library. Click on the
"INSTALL" button to install the library.

25
1. This process should not take too long, but allow up to a minute to install it.

2. When it is finished, we can take a look at the library in the library manager column, where it
should say "INSTALLED".

You have now successfully downloaded and installed a library on your machine.
Including a library
To use a library, you first need to include the library at the top of the sketch.

Almost all libraries come with already made examples that you can use. These are accessible
through

26
File > Examples > {Library} > {Example}. In this example, we are choosingthe RTCZero
> SimpleRTC.

The chosen example will now open up in a new window, and you can start using it however you
want to.

RESULT:

Thus, the Arduino program was executed and sensor readings were verified successfully.

27
EX.NO: 09
PROGRAMS USING ARDUINO UNO
DATE:

AIM:
To write an Arduino program to making a sequential LED blinking circuit with Arduino Uno

SOFTWARE REQUIRED:

S.No Software Requirements Quantity


1 ARDUINO UNO IDE 1

1. Arduino Uno r3
2. Data cable to connect Arduino with laptop or pc
3. 3 LEDs (Color of your choice)
4. 1 Breadboard
5. 16 male to male jumper wires
6. A 5v power source
7. Arduino IDE Software

Procedure:

1. Connect the digital GND pin of the Arduino to any power rail on the breadboard.
2. Place the LEDs on the breadboard, with the Negative (-) legs towards the left.
3. Connect the Negative (-) legs of all the LEDs to the power rail (where the GND pin of
Arduino is connected) using jumper wires.
4. Connect the LEDs to the Arduino:
• 1st LED to pin 8
• 2nd LED to pin 3
• 3rd LED to pin 2, using jumper wires.
5. Open the Arduino IDE on your laptop or PC.
6. Copy and paste the code into the Arduino IDE and upload it to the Arduino board.

28
PROGRAMS:

This is the code: (above the void setup) int LED1 = 8;

int LED2 = 3; int LED3 =


2; void setup ()
{
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);

}
void loop()
{
digitalWrite(LED1, HIGH); delay(200);
digitalWrite(LED2, HIGH); delay(200);
digitalWrite(LED3, HIGH); delay(200);
digitalWrite(LED1, LOW); delay(300);
digitalWrite(LED2, LOW); delay(300);
digitalWrite(LED3, LOW); delay(300);
}

RESULTS:

Thus, the Arduino program to making a sequential LED blinking circuit with Arduino Uno
is executed and results are verified at LED’s.

29
EX.NO: 10
PROGRAMS USING ARDUINO UNO FOR LED
DATE: BLINKING

AIM:

To write an Arduino program to making a LED blinking circuit with Arduino Uno

SOFTWARE REQUIRED:

S.No Software Requirements Quantity

1 ARDUINO UNO IDE 1

Components Required
1. 1 X LED
2. 1 X Resistor, 330 Ohm
3. Breadboard
4. Arduino UNO R4 or earlier versions.
5. Jumper wires
Components Description
1. 1 X LED: We are controlling only one LED in this program.
2. 1 X Resistor, 330 Ohm: For every LED, we need one current limiting resistor.
3. Breadboard: A breadboard is a fundamental tool used in electronics and prototyping
to build and test circuits without soldering.
4. Arduino UNO R4 or earlier versions.
5. Jumper wires: Jumper wires are simple electrical wires with connectors on both ends
used to create connections between various electronic components or points on a circuit
on a breadboard.

30
PROGRAMS:

int LEDpin = 13;


int delayT = 1000;

void setup()
{

// put your setup code here, to run once:

pinMode(LEDpin, OUTPUT);

void loop()

{ // put your main code here, to run repeatedly:

digitalWrite(LEDpin, HIGH);

delay(delayT);

digitalWrite(LEDpin, LOW);

delay(delayT);

RESULTS:

Thus, the Arduino program to making a sequential LED blinking circuit with Arduino Uno

is executed and results are verified at LED’s.

31
EX.NO: 11 PROGRAMS USING ARDUINO UNO FORBLUETOOTH
DATE: COMMUNICATION

AIM:
To write an Arduino program to making a light ON/OFF with Bluetooth module
circuit with Arduino Uno

SOFTWARE REQUIRED:

S.No Software Requirements Quantity

1 ARDUINO UNO IDE 1

2 Bluetooth App

Components Required

1. Arduino UNO Board-1

2. Bluetooth module-1

3. Relay 10A-1

4. Bulb and switch

5. Jumper wires

Procedure:

• Connect the HC-05 Bluetooth module to Arduino Uno (TX to RX, RX to TX, VCC to 5V, GND to
GND).
• Upload the Arduino code using Serial communication commands (e.g., Serial.begin(9600)).
• Pair the Bluetooth module with a smartphone or PC using a Bluetooth terminal app.
• Send and receive data wirelessly between Arduino and the device via Bluetooth.

32
Figure: Arduino based home light ON/OFF ushing Bluetooth

PROGRAM:
This is the code: (above the void setup) char val;
void setup()
{
pinMode(5, OUTPUT);
Serial.begin(9600);
digitalWrite(5, HIGH);
}
void loop()
{
if(Serial.available())
{
val = Serial.read();
Serial.println(val);
}
if(val=='1')
{
digitalWrite(5, LOW);
}
else if(val=='3')
{
digitalWrite(5, HIGH);
}
delay(100);
}

33
Bluetooth:
Bluetooth is a short-range wireless communication technology that operates on the 2.4
GHz frequency band. It is commonly used for connecting IoT devices to smartphones, tablets,
and other nearby devices. Bluetooth Low Energy (BLE) is a power-efficient version of
Bluetooth that is idealfor battery-powered IoT devices. Bluetooth is widely used in applications
such as wearable devices,healthcare monitoring, and home automation.

Each communication method has its advantages and limitations, and the choice depends
on the specific requirements of the IoT application. Factors to consider include range, power
consumption, data rate, security, and interoperability with other devices or systems.

RESULTS:

Thus, Bluetooth communication using Arduino Uno and HC-05 was successfully tested.

34
EXP NO:12
ZIGBEE COMMUNICATION
DATE

AIM:
To write a program to control an LED using a Zigbee module.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity


1 Arduino IDE 2.0 1
2 Arduino UNO Development Board 2
3 Jumper Wires few

4 Arduino USB Cable 2

5 Zigbee Module 2

PROCEDURE

Follow the following instructions to configure the Zigbee series 1 module :


Sure, here’s the corrected version:
1. Connect your Zigbee module to the computer’s serial port using a serial adapter.
2. Download a virtual terminal program like PuTTY for Windows.
3. Configure your computer’s serial port settings to a baud rate of 9,600, 8 data bits, no parity, and 1
stop bit.
4. Enable the “Local Echo” option.
5. Click “OK” to save the session settings.
6. Click the “Connect” button in the virtual terminal program.
7. Once connected to the Zigbee module, give your session a name.
8. Utilize AT commands to configure your module as needed.
After that, type +++ on the virtual terminal. After a few seconds, it will respond with “OK”. Then, type
these commands:

35
CONNECTIONS:

TRANSMITTER:

Arduino UNO Pin Zigbee Module


VCC 5V
GND G
2 Tx
3 Rx

CONNECTIONS:

RECEIVER:

Arduino UNO Pin Zigbee Module Arduino Development


Board
- 5V 5V
- G GND
2 Tx -
3 Rx -
4 - LED1

PROGRAM: TRANSMITTER SIDE:

#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
mySerial.begin(9600);
Serial.begin(9600);
}

void loop() {
mySerial.write('A');
Serial.println('A');
delay(100);
mySerial.write('B');
Serial.println('B');
delay(100);
}

36
RECEIVER SIDE:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
mySerial.begin(9600);
Serial.begin(9600);
pinMode(4, OUTPUT);
}

void loop() {
if(mySerial.available()>0)
{
char data=mySerial.read();
Serial.println(data);
if(data=='A')
digitalWrite(4,HIGH);
else if(data=='B')
digitalWrite(4,LOW);
}
}

TRANSMITTER SECTION

37
RECEIVER SECTION

Applications of Zigbee

Some of the famous applications are:

Wireless communication
wirelessly controlled robot
remote monitoring system
Wireless home automation system
wireless temperature sensor and many others.

RESULT:

Thus, Zigbee communication using Arduino Uno and XBee modules was successfully implemented
and tested.

38
EXP NO:13 INTRODUCTION TO THE RASPBERRY PI
DATE PLATFORM

Introduction to Raspberry Pi Pico W:

The Raspberry Pi Pico W is a compact and affordable microcontroller board developed


by the Raspberry Pi Foundation. Building upon the success of the Raspberry Pi Pico, the Pico W
variant brings wireless connectivity to the table, making it an even more versatile platform for
embedded projects. In this article, we will provide a comprehensive overview of the Raspberry Pi
Pico W, highlighting its key features and capabilities.
Features:
RP2040 microcontroller with 2MB of flash memory
On-board single-band 2.4GHz wireless interfaces (802.11n)
Micro USB B port for power and data (and for reprogramming the flash)
40 pins 21mmx51mm ‘DIP’ style 1mm thick PCB with 0.1″ through-hole pins also with
edge castellations
Exposes 26 multi-function 3.3V general purpose I/O (GPIO)
23 GPIO are digital-only, with three also being ADC-capable
Can be surface mounted as a module
3-pin ARM serial wire debug (SWD) port
Simple yet highly flexible power supply architecture
Various options for easily powering the unit from micro-USB, external supplies, or batteries
High quality, low cost, high availability
Comprehensive SDK, software examples, and documentation
Dual-core Cortex M0+ at up to 133MHz
On-chip PLL allows variable core frequency
264kByte multi-bank high-performance SRAM

Raspberry Pi Pico W:
The Raspberry Pi Pico W is based on the RP2040 microcontroller, which was designed by Raspberry
Pi in-house. It combines a powerful ARM Cortex-M0+ processor with built-in Wi-Fi connectivity,
opening up a range of possibilities for IoT projects, remote monitoring, and wireless communication.
The Pico W retains the same form factor as the original Pico, making it compatible with existing Pico
accessories and add-ons.

39
RP2040 Microcontroller:
The Raspberry Pi Pico W is powered by the RP2040 microcontroller, featuring a dual-core ARM
Cortex-M0+ processor running at 133MHz, 264KB of SRAM, and 2MB of flash memory for
sample processing and storage capabilities.

Wireless Connectivity:
The Pico W integrates the Cypress CYW43455 Wi-Fi chip, supporting dual-band Wi-Fi
(2.4GHz and 5GHz) and 802.11b/g/n/ac, enabling seamless wireless communication and making it
ideal for IoT projects and remote control applications.

GPIO and Peripherals:


With 26 GPIO pins, including 3 analog inputs, and support for UART, SPI, I2C, and PWM
protocols, the Pico W offers extensive flexibility for interfacing with external devices. It also
includes onboard LED indicators and a micro-USB port for power and data.

MicroPython and C/C++ Programming:


The Pico W can be programmed using MicroPython for rapid prototyping or C/C++ for
advanced development, providing an accessible environment for beginners and a robust
ecosystem for experienced developers.

Programmable Input/Output (PIO) State Machines:


The RP2040 features PIO state machines, allowing for custom protocol handling, precise
waveform generation, and offloading tasks from the main processor to enhance system performance.

Open-Source and Community Support


As with all Raspberry Pi products, the Pico W benefits from the vibrant and supportive Raspberry
Pi community. Raspberry Pi provides extensive documentation, including datasheets, pinout
diagrams,and programming guides, to assist developers in understanding the board’s capabilities.
The community offers forums, online tutorials, and project repositories, allowing users to seek help,
shareknowledge, and collaborate on innovative projects.

40
The Raspberry Pi Pico W brings wireless connectivity to the popular Raspberry Pi Pico
microcontroller board. With its powerful RP2040 microcontroller, built-in Wi-Fi chip, extensive
GPIO capabilities, and compatibility with MicroPython and C/C++ programming, the Pico W offers
a versatile and affordable platform for a wide range of embedded projects. Whether you are
a beginner or an experienced developer, the Raspberry Pi Pico W provides a user-friendly and flexible
platform to bring your ideas to life and explore the exciting world of wireless IoT applications.

RESULT:
Thus, the Raspberry Pi platform was successfully used for programming and hardware
interfacing, demonstrating its capability in developing IoT and automation projects.

41
EXP NO:14
INTRODUCTION TO PYTHON PROGRAMMING
DATE

Getting Started with Thonny MicroPython (Python) IDE:


If you want to program your ESP32 and ESP8266 with MicroPython firmware, it’s very handy
to use an IDE. you’ll have your first LED blinking using MicroPython and Thonny IDE.

What is MicroPython?
MicroPython is a Python 3 programming language re-implementation targeted for
microcontrollers and embedded systems. MicroPython is very similar to regular Python. Apart from
a few exceptions, the language features of Python are also available in MicroPython. The most
significant difference between Python and MicroPython is that MicroPython was designed to work
under constrained conditions.
Because of that, MicroPython does not come with the entire pack of standard libraries. It
only includes a small subset of the Python standard libraries, but it includes modules to easily control
and interact with the GPIOs, use Wi-Fi, and other communication protocols.

Thonny IDE:
Thonny is an open-source IDE which is used to write and upload MicroPython programs to
different development boards such as Raspberry Pi Pico, ESP32, and ESP8266. It is extremely
interactive and easy to learn IDE as much as it is known as the beginner-friendly IDE for new
programmers. With the help of Thonny, it becomes very easy to code in Micropython as it has a
built-in debugger that helps to find any error in the program by debugging the script line by line.

You can realize the popularity of Thonny IDE from this that it comes pre-installed in Raspian
OS which is an operating system for a Raspberry Pi. It is available to install on r Windows, Linux,
and Mac OS.

42
A) Installing Thonny IDE – Windows PC
Thonny IDE comes installed by default on Raspbian OS that is used with the Raspberry Pi board.
To install Thonny on your Windows PC, follow the next instructions:
1. Go to https://thonny.org
2. Download the version for Windows and wait a few seconds while it downloads.

3. Run the .exe file.

43
4. Follow the installation wizard to complete the installation process. You just need to click “Next”.

5. After completing the installation, open Thonny IDE. A window as shown in the following figure
should open.

CONNECTIONS:

Pin Development Board

GP16 LED

57

44
PROGRAM

LED:
from machine import Pin
import time
LED = Pin(16, Pin.OUT)
while True:
LED.value(1)
time.sleep(1)
LED.value(0)
time.sleep(1)

CONNECTIONS:

Raspberry Pi Pico Raspberry Pi Pico


Pin Development Board
(RGB)
GP16 R
GP17 G
GP18 B
GND COM

RGB:
from machine import Pin
from time import sleep_ms,sleep
r=Pin(16,Pin.OUT)
y=Pin(17,Pin.OUT)
g=Pin(18,Pin.OUT)

while True:
r.value(1)
sleep_ms(1000)
r.value(0)
sleep_ms(1000)
y.value(1)
sleep(1)
y.value(0)
sleep(1)
g.value(1)
sleep(1)
g.value(0)
sleep(1)

57

45
CONNECTIONS:

Raspberry Pi Pico Raspberry Pi Pico


Pin Development Board
GP16 LED
GP15 SW1

SWITCH CONTROLLED LED:


from machine import Pin
from time import sleep
led=Pin(16,Pin.OUT)
sw=Pin(15,Pin.IN)
while True:
bt=sw.value()if
bt== True:
print("LED ON")
led.value(1) sleep(2)
led.value (0) sleep(2)
led.value (1) sleep(2)
led.value(0) sleep(2)
else:
print("LED OFF")
sleep(0.5)

RESULT:

Thus, Python programming was successfully learned and applied, demonstrating its simplicity and
effectiveness in solving problems and building applications.

46
EXP NO:15
INTERFACING SENSORS WITH RASPBERRY PI
DATE

AIM:
To interface the IR sensor and Ultrasonic sensor with Raspberry Pico.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity

1 Thonny IDE 1
2 Raspberry Pi Pico Development Board 1
3 Jumper Wires few

4 Micro USB Cable 1

5 IR Sensor 1

6 Ultrasonic sensor 1

PROCEDURE

To interface sensors with Raspberry Pi, you need to:


1. Identify which GPIO pins to use. Most sensors will connect to the Raspberry Pi GPIO directly or
through an analog-to-digital converter (ADC).
2. Wire the circuit. The sensor needs to be wired to the GPIO to form a circuit.
3. Write code to read from the sensor.
4. Enable UART communication on the Raspberry Pi if you are using an ultrasonic sensor to read
serial data.
5. Supply external power to the sensor when using an XL-Max Sonar or WR ultrasonic sensor with
aRaspberry Pi

47
CONNECTIONS:

Pin Development Board IR Sensor Module

GP16 BUZZER -
GP15 - OUT
- 5V VCC
- GND GND

PROGRAM:

IR Sensor:
from machine import Pin
from time import sleep
buzzer=Pin(16,Pin.OUT)
ir=Pin(15,Pin.IN)
while True:
ir_value=ir.value()
if ir_value== True:
print("Buzzer OFF")
buzzer.value(0)
else:
print("Buzzer ON")
buzzer.value (1)
sleep(0.5)

48
CONNECTIONS:

Pin Development Board Ultrasonic Sensor Module

GP16 BUZZER -
GP15 - ECHO
GP14 - TRIG
- 5V VCC
- GND GND

ULTRASONIC SENSOR:
from machine import Pin, PWM
import utime
trigger = Pin(14, Pin.OUT)
echo = Pin(15, Pin.IN)
buzzer = Pin(16, Pin.OUT)

def measure_distance():
trigger.low()
utime.sleep_us(2)
trigger.high()
utime.sleep_us(5)
trigger.low()
while echo.value() == 0:
signaloff = utime.ticks_us()
while echo.value() == 1:
signalon = utime.ticks_us()

timepassed = signalon - signaloff


distance = (timepassed * 0.0343) / 2
return distance

while True:
dist = measure_distance()
print(f"Distance : {dist} cm")
if dist <= 10:
buzzer.value(1)
utime.sleep(0.01)
else:
buzzer.value(0)
utime.sleep(0.01)
utime.sleep(0.5)

49
Figure. the connection diagram of Interfacing IR Sensor with Raspberry Pi

RESULT:

Thus, IR and Ultrasonic sensors were successfully interfaced with the Raspberry Pi Pico and tested.

50
EXP NO:16 COMMUNICATE BETWEEN ARDUINO AND
DATE RASPBERRY PI

AIM:
To write and execute the program to Communicate between Arduino and Raspberry PI
using any wireless medium (Bluetooth)

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity

1 Thonny IDE 1
2 Raspberry Pi Pico Development Board 1
3 Arduino Uno Development Board 1
4 Jumper Wires few
5 Micro USB Cable 1
6 Bluetooth Module 2

PROCEDURE

To communicate between Arduino and Raspberry Pi, you can follow these steps:
1. Connect the Arduino to the Raspberry Pi through a USB cable.
2. On the Raspberry Pi side, use a simple USB connector.
3. On the Arduino side, use the USB port that you use to upload code from your computer to
your board.
4. Use simple serial communication over USB cable to communicate between the two boards.
5. Upload the serial_test.ino code to your Arduino and run the serial_test.py Python code in
Raspberry Pi.

51
Figure: Communicate between Arduino and Raspberry Pi

CONNECTIONS:

Arduino UNO Pin Arduino Development Board Bluetooth Module


2 - Tx
3 - Rx
- GND GND
- 5V 5V

PROGRAM:
MASTER
ARDUINO:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup()
{
mySerial.begin(9600);
}

void loop()
{
mySerial.write('A');
delay(1000);
mySerial.write('B');
delay(1000);
}

52
CONNECTIONS:

Pin Development Board

GP16 LED -
VCC - +5V
GND - GND
GP1 - Tx
GP0 - Rx

SLAVE
RASPBERRY PI PICO
from machine import Pin, UART
uart = UART(0, 9600)
led = Pin(16, Pin.OUT)

while True:
if uart.any() > 0:
data = uart.read()
print(data)
if "A" in data:
led.value(1)
print('LED on \n')
uart.write('LED on \n')
elif "B" in data:
led.value(0)
print('LED off \n')
uart.write('LED off \n')

RESULT:

Thus, communication between Arduino and Raspberry Pi was successfully established and verified.

53
EXP NO:17
CLOUD PLATFORM TO LOG THE DATA
DATE

AIM:
To set up a cloud platform to log the data from IoT devices.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No. Software Requirements Quantity

1 Blynk Platform 1

CLOUD PLATFORM-BLYNK:

Blynk is a smart platform that allows users to create their Internet of Things applications without the
need for coding or electronics knowledge. It is based on the idea of physical programming & provides
a platform to create and control devices where users can connect physical devices to the Internet and
control them using a mobile app.

Setting up Blynk 2.0 Application


To control the LED using Blynk and Raspberry Pi Pico W, you need to create a Blynk project and
set up a dashboard in the mobile or web application. Here’s how you can set up the dashboard:

Step 1: Visit blynk.cloud and create a Blynk account on the Blynk website. Or you can simply sign
in using the registered Email ID.

Step 2: Click on +New Template.

54
Step 3: Give any name to the Template such as Raspberry Pi Pico W. Select ‘Hardware Type’ as
Other and ‘Connection Type’ as WiFi.

So a template will be created now.

55
Step 4: Now we need to add a ‘New Device’ now.

Select a New Device from ‘Template’.

Select the device from a template that you created earlier and also give any name to the device.
Click on Create.

56
A new device will be created. You will find the Blynk Authentication Token Here. Copy it as it is
necessary for the code.

Step 5: Now go to the dashboard and select ‘Web Dashboard’.

From the widget box drag a switch and place it on the dashboard screen.

57
Step 6:

On the switch board click on Settings and here you need to set up the Switch. Give any title to it and
Create Datastream as Virtual Pin.

Configure the switch settings as per the image below and click on create.

Configure the final steps again.

58
With this Blynk dashboard set up, you can now proceed to program the Raspberry Pi Pico W board
to control the LED.

Step 7:
To control the LED with a mobile App or Mobile Dashboard, you also need to setup the Mobile
Phone Dashboard. The process is similarly explained above.

Install the Blynk app on your smartphone The Blynk app is available for iOS and Android. Download
and install the app on your smartphone. then need to set up both the Mobile App and the Mobile
Dashboard in order to control the LED with a mobile device. The process is explained above.

1. Open Google Play Store App on an android phone


2. Open Blynk.App
3. Log In to your account (using the same email and password)
4. Switch to Developer Mode
5. Find the “Raspberry Pi Pico Pico W” template we created on the web and tap on it
6. Tap on the “Raspberry Pi Pico Pico W” template (this template automatically comes because we
created it on our dashboard).
7. tap on plus icon on the left-right side of the window
8. Add one button Switch
9. Now We Successfully Created an android template
10. it will work similarly to a web dashboard template

RESULT:
Thus, a cloud platform was successfully set up to log and monitor data from IoT devices in real time.

59
EXP NO:18 Log Data using Raspberry PI and upload it to the cloud
DATE platform

AIM:
To write and execute the program Log Data using Raspberry PI and upload it to the cloud
platform

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware & Software Requirements Quantity


1 Thonny IDE 1
2 Raspberry Pi Pico Development Board few

3 Jumper Wires 1

4 Micro USB Cable 1

PROCEDURE:

1. Connect the sensors (e.g., DHT11, MQ2) to the GPIO pins of the Raspberry Pi.

2. Enable necessary interfaces like I2C, SPI, or Serial using Raspberry Pi Configuration.

3. Write a Python script to read data from the connected sensors.

4. Format the data into JSON or CSV as needed for logging and transmission.

5. Choose a cloud platform (e.g., ThingSpeak, Google Firebase, AWS IoT) and set up your

account and data channel.

6. Generate API keys or credentials required to send data securely to the cloud.

7. Upload the data at regular intervals using HTTP POST or MQTT protocol in the Python script.

60
CONNECTIONS:

Raspberry Pi Pico Raspberry Pi Pico


LCD Module
Pin Development Board

-
5V VCC
- GND GND
GP0 - SDA
GP1 - SCL

PROGRAM:
from machine import Pin, I2C, ADC
from utime import sleep_ms
from pico_i2c_lcd import I2cLcd
import time
import network
import BlynkLib
adc = machine.ADC(4)
i2c=I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
I2C_ADDR=i2c.scan()[0]
lcd=I2cLcd(i2c,I2C_ADDR,2,16)
wlan = network.WLAN() wlan.active(True)
wlan.connect("Wifi_Username","Wifi_Password")

BLYNK_AUTH = 'Your_Token'

# connect the network


wait = 10
while wait > 0:
if wlan.status() < 0 or wlan.status() >= 3:
break
wait -= 1
print('waiting for connection...')
time.sleep(1)
# Handle connection error
if wlan.status() != 3:
raise RuntimeError('network connection failed')
else: print('connected')
ip=wlan.ifconfig()[0]
print('IP: ', ip)
"Connection to Blynk"
# Initialize Blynk

61
blynk = BlynkLib.Blynk(BLYNK_AUTH)
lcd.clear()
while True:
ADC_voltage = adc.read_u16() * (3.3 /
65536)
temperature_celcius = 27 -
(ADC_voltage - 0.706) / 0.001721
temp_fahrenheit = 32 + (1.8 *
temperature_celcius)

print("Temperature in C:
{}".format(temperature_celcius))
print("Temperature in F:
{}".format(temp_fahrenheit))

lcd.move_to(0, 0)
lcd.putstr("Temp:")

lcd.putstr(str(round(temperature_celcius,
2)))
lcd.putstr("C ")

lcd.move_to(0, 1)
lcd.putstr("Temp:")
lcd.putstr(str(round(temp_fahrenheit,
2)))
lcd.putstr("F ")

blynk.virtual_write(3,
temperature_celcius)
blynk.virtual_write(4, temp_fahrenheit)
blynk.log_event("temp_alert", "Temp:
{:.2f}C".format(temperature_celcius))

blynk.run()
time.sleep(5)

RESULT:

Thus, the data from the Raspberry Pi was successfully logged and uploaded to the cloud platform,
enabling real-time monitoring and analysis.

62
Ex No: 19 DESIGN AN IOT BASED SYSTEMS
Date:

IOTbased Health Monitoring System using Arduino

AIM:
In this project, a system for 24×7 human health monitoring is designed and
implemented.

DESCRIPTION:

In this system, the Arduino Uno board is used for collecting and processing all
data. Different sensors are used for measuring different parameters. All this data is
uploaded to thingspeak for remote analysis. An ESP8266 module is used for
connecting to the internet. A solar power system is provided for powering all the
sensors.

Abstract

This project introduces a wireless health monitoring system that can monitor a
human 24×7. This system consists of a number of the part. Controlling and data
processing is done through the Arduino Uno board, all the sensors are connected to
Arduino UNO.
Through this system, we can measure ECG, heartbeat, BP, and spo2. Through
sensors, it is possible to measure all these values. Here all the sensors are powered
using a solar power system. All these analog sensors can be connected to Arduino
through any of the six analog pins. These values are then used for detecting any
critical situation. In the case of a critical situation, an alert can be given as a message.
Also, it is possible to monitor the person’s health from any location in the
world through the Thingspeak cloud. Data from sensors is uploaded to the Thingspeak
periodically without any interruption if the internet is available. Here ESP8266 wifi
module is used for connecting Arduino to the internet.

Introduction

Health is the most important part of any human’s life without health it is
useless to any treasure of life. Most humans live a busy life in which going to a doctor
for weekly or even monthly checkup is an impossible task. Without monitoring your

63
health it is not possible to whether you are a healthy or sick person. This problem
leads to the design of a product which monitors your health every day without going
to a doctor. In this paper, a system is designed as a prototype for monitoring alerting
based on the health of a person. This system is fully automated little or no human help
is needed. Any doctor can monitor this person from anywhere through the internet.

Existing System

• Diagnosing with the help of a doctor


• Conventional devices that can only measure a particular parameter
• Devices that have to be connected invasively to get measurements
• No automated system exists
• Smart watches are expensive and not specifically for healthcare

Proposed System

• In this project, a system for 24×7 human health monitoring is designed and
implemented
• In this system, the Arduino Uno board is used for collecting and processing all
data
• Different sensors are used for measuring different parameters
• All this data is uploaded to thingspeak for remote analysis
• An ESP8266 module is used for connecting to the internet
• A solar power system is provided for powering all the sensors

BLOCK DIAGRAM

64
BLOCK DIAGRAM DESCRIPTION

• Arduino Uno is the controller board which is a heart-whole system


• All the different analog sensors are connected to Arduino through analog pins
• Here the ESP8266 WiFi module connects the whole system to a WiFi network
• Data from sensors are uploaded to the cloud.

HARDWARE REQUIRED
• Arduino Uno
• ECG SENSOR
• Heartbeat Sensor
• BP sensor

SOFTWARE REQUIRED

• Arduino IDE

CIRCUIT DIAGRAM

CONCLUSION

This system is very effective in monitoring a person’s health continuously because it is


fully automated. It can be tested very easily with any person. This system is a very good
example of remote health monitoring.

RESULT:
Thus, the 24×7 human health monitoring system was successfully designed and
implemented, providing continuous tracking of health parameters.

65

You might also like