0% found this document useful (0 votes)
17 views71 pages

10.4 Embedded IoT Manual

The document is a laboratory manual for the CS3691 Embedded Systems and IoT Laboratory course at Ramco Institute of Technology, outlining the vision, mission, objectives, and outcomes of the Electronics and Communication Engineering department. It includes detailed course objectives, expected outcomes, and practical experiments using the 8051 microcontroller, focusing on arithmetic and logical operations. The manual serves as a guide for students to understand and implement various concepts in embedded systems and IoT.

Uploaded by

harinipsp4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views71 pages

10.4 Embedded IoT Manual

The document is a laboratory manual for the CS3691 Embedded Systems and IoT Laboratory course at Ramco Institute of Technology, outlining the vision, mission, objectives, and outcomes of the Electronics and Communication Engineering department. It includes detailed course objectives, expected outcomes, and practical experiments using the 8051 microcontroller, focusing on arithmetic and logical operations. The manual serves as a guide for students to understand and implement various concepts in embedded systems and IoT.

Uploaded by

harinipsp4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 71

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

LABORATORY MANUAL

Regulation–2021
(As per Anna University, Chennai Syllabus)

CS3691 Embedded Systems and IoT Laboratory

AcademicYear2023-2024 (Even Semester)

IIIYEAR VI SEMESTER

Prepared by Approved By
Mr.G.Sivakumar -AP/ECE Dr.C.ArunachalaPerumal
Mr.R.Ramasamy-AP/ECE Professor & Head
Department of ECE
RAMCOINSTITUTEOFTECHNOLOGY
Department of Electronics and Communication engineering
Department Vision, Mission, PEOs, Pos & PSO

VISION
Develop futuristic technologist in Electronics and Communication Engineering to meet the
global challenges and the societal needs of our nation.

MISSION
 Educate students to become enlightened engineers with the latest know-how to take on the
challenges concerned with the society.
 EquipthestudentswiththecurrenttrendsandlatesttechnologiesinthefieldofElectronicsandCommu
nicationEngineeringtomakethemtechnicallystrongandethicallysound.
 ConstantlymotivatethestudentsandfacultymemberstoachieveexcellenceinElectronicsandComm
unicationEngineeringandResearch&Developmentactivities

Program Educational Objectives (PEOs)


 Graduateswillgainknowledgethroughcontinuouslearningtoenhancecorecompetencyandcareerp
rospects.
 Graduates will be technically competent to design, analyze, develop and implement
Electronic and Communication Systems.
 Graduates will apply the basic fundamental concepts in Electronic and related fields to solve
general engineering Problems related to societal needs.
 Graduates will be professionals with attributes, passion, positive attitude, ethics and moral
values for a successful career
 Graduates will Communicate effectively and interact responsibly with colleagues, employees,
team members, clients and the society.

Program Outcomes (POs)


 PO1: Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization for the solution of complex engineering
problems.
 PO2: Problem analysis: Identify, formulate, review research literature, and
analyzecomplexengineeringproblemsreachingsubstantiatedconclusionsusingfirstprinciplesofm
athematics, natural sciences and engineering sciences.
 PO3:Design / Development of Solutions: Design solutions for complex engineering
problems and design system components or processes that meet the specified needs with
appropriate consideration for public health and safety, and cultural, societal, and
environmental considerations.
 PO4: Conduct investigations of complex problems: Use research-based knowledge and
research methods including design of experiments, analysis and interpretation of data and
synthesis of the information to provide valid conclusions.
 PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex engineering
activities with an understanding of the limitations.
 PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal, and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
 PO7: Environment and sustainability: Understand the impact of the professional
engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and the need for sustainable development.
 PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities
and norms of the engineering practice.
 PO9: Individual and team work: Function effectively as an individual, and as a member or
leader in diverse teams, and in multidisciplinary settings.
 PO 10: Communication: Communicate effectively on complex engineering activities with
the engineering community and with the society at large, such as being able to comprehend
and write effective reports and design documentation, make effective presentations, and give
and receive clear instructions.
 PO 11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
 PO12:Life-long learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological change.

Program Specific Outcomes(PSOs)


After successful completion of the degree, the students will be able to:

 Adapt to emerging trends in Information and Communication Technology by innovating


new ideas to solve existing/ novel problems.
 Excel in latest technologies of Embedded Systems.
 Design, analyze and develop electronic products in the area of VLSI Design and
Communication Systems.
 Contribute as Entrepreneurs in building electronic products.
RAMCO INSTITUTE OF TECHNOLOGY

Department of Electronics and Communication Engineering

Course Objectives and Outcomes

Degree, Semester & Branch: VI Semester B.E.CSE, AI&DS

Course Code& Title: CS3691 Embedded Systems and IoT Laboratory

COURSE OBJECTIVES:

1. To equip the students to learn the various cellular architectures.


2. To familiarize the students to learn about the characteristics of wireless channels.
3. To enable the students to be familiar with the concepts of Modulation, Equalization and
Diversity.
4. To make the students to understand the concepts of various Multiple Access Schemes.
5. To enable the students to learn about the concepts of various Wireless Networks.

COURSE OUTCOMES:
After completion of the course, it is expected that:
The students will be able to:
1. Apply the various cellular concepts like frequency reuse, channel assignments, handoff strategies
etc., in mobile communication.
2. Elaborate the characteristics of a wireless channel and evolve the system design specifications.
3. Analyze the performance of various digital signalling schemes, equalization and diversity for
fading channels.
4. Examine the performance of various multiple access schemes.
5. Explore the knowledge of various wireless networks in telecommunication field.
Assessment Methods followed:

Model Practical Examination


Expt.No.:
Write 8051 Assembly Language experiments using simulator.
Date:

AIM:
To write a program to perform arithmetic and logical operations between two 8-bit numbers
using a microcontroller.
OBJECTIVE:
To make the student to perform basic arithmetic and logic operation using 8051
microcontroller.

Hardware/Software Required:

 MCU8051 IDLE

PROCEDURE:
 Ensure that you have the MCU8051 Idle Simulator software installed on your system.
 Set up the simulation environment. Prepare the input data or program that you want to
simulate on the 8051 microcontroller.
 Open new project -> Type program and save as .asm extension
 Click Start simulation icon -> click Run Icon

FLOW CHART: ADDITION/SUBTRACTION/MULTIPLICATION/DIVISION OPERATION

START

GET THE INPUTS

PERFORM ADDITION/
SUBTRACTION/MULTIPLICATION/
DIVISION

STORE THE RESULT

STOP
I. ADDITION PROGRAM :

LABEL PROGRAM COMMENTS


MOV A,#56H Initialize the A value
MOV B,#95H Initialize the B value
ADD A, B Add A & B
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
56H
95H

II) SUBTRACTION PROGRAM:

LABEL PROGRAM COMMENTS


MOV A,#50 Initialize the A value
MOV A,#10 Initialize the B value
SUBB A,B Subtract A & B
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
50 4500

III) MULTIPLICATION PROGRAM:


LABEL PROGRAM COMMENTS
MOV A,#50 Initialize the A value
MOV B,#10 Initialize the B value
MUL A,B Multiplication A & B
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
INC DPTR Increment DPTR
MOV A, B Move B register value to accumulator
MOVX @DPTR, A Move accumulator to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
4500
DIVISION PROGRAM:
LABEL PROGRAM COMMENTS
MOV A,#50 Initialize the A value
MOV A,#10 Initialize the B value
DIV A,B Division A by B
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
INC DPTR Increment DPTR
MOV A, B Move B register value to accumulator
MOVX @DPTR,A Move accumulator to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
50
4500
10

AND OPERATION PROGRAM:


LABEL PROGRAM COMMENTS
MOV A,#02 Initialize the A value
MOV A,#06 Initialize the B value
ANL A ,B AND operation between A & B
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
02 4500

OR OPERATION PROGRAM:
LABEL PROGRAM COMMENTS
MOV A,#02 Initialize the A value
MOV A, #06 Initialize the B value
ORL A,B OR operation between A & B
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
02
4500
06
III.NOT OPERATION PROGRAM:
LABEL PROGRAM COMMENTS
MOV A,#06 Initialize the A value
CPL A Complement of A
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
06 4500

INFERENCE AND DISCUSSIONS:

RESULT:
Thus the assembly language program for arithmetic and logical operation was executed successfully.
Expt.No.:
TEST DATA TRANSFER BETWEEN REGISTERS AND MEMORY.
Date:

AIM:
To write a program to test data transfer between registers and memory using microcontroller.

APPARATUS REQUIRED

Sl.No. COMPONENTS RANGE QUANTITY

1. MCU8051 IDLE - 1

2. 8051 Microcontroller Kit - 1

3. Power Cable - 1

4. Keyboard - 1

PROCEDURE:

 Ensure that the MCU8051 Idle Simulator software installed on your system.
 Set up the simulation environment. Prepare the input data or program that you want to
simulate on the 8051 microcontroller.
 Open new project -> Type program and save as .asm extension
 Click Start simulation icon -> click Run Icon
Program:
MOV RO,#34H
MOVR1,#12H
MOV R2 ,#DCH
MOV R3,#FEH
CLR C
MOV A, R0
ADD A, R2
MOV A, R1
ADDC A, R3
MOV 21H, A
MOV 22H, C
END

OBSERVATION:
INPUT OUTPUT
06 4500
Transfer data from external memory to internal RAM

MOV DPTR, #4100 ; Load the address of external memory


MOVX A, @DPTR ; Move data from external memory to accumulator
MOV R0, A; Move data from accumulator A to register R0

OBSERVATION:

INPUT OUTPUT
External
memory Register Data
Data
Location
4100 R0

Transfer data from internal RAM to external memory

MOV A, R1 ; Move data from register R1 to accumulator A


MOV DPTR, #4100 ; Load the address of external memory
MOVX @DPTR, A ; Move data from accumulator A to external memory

OBSERVATION:

INPUT OUTPUT
External
Register Data memory
Data
Location
R1 4100
RESULT:
Thus the data transfer between registers and memory are executed successfully.
Expt.No.:
BASIC ARITHMETIC AND LOGICAL OPERATION
Date:

AIM:
To write a program to perform arithmetic and logical operation between two 8-bit numbers
using8051 microcontroller.

OBJECTIVE:
To make the student to perform basic arithmetic and logic operation using 8051
microcontroller.

APPARATUS REQUIRED
Sl.No. COMPONENTS RANGE QUANTITY

1. 8051 Microcontroller Kit - 1

2. Power Cable - 1

3. Keyboard - 1

ALGORITHM:
a. Arithmetic Operation
Step1: Initialize memory pointer to data location.
Step2: Get the first number from memory in accumulator.
Step3: Get the second number and add/sub/mul/div it to the accumulator.
Step4: Store the answer at another memory location.

b. Logical Operation
Step1: Get the two numbers in mentioned registers using MOV instruction
Step2: AND/OR/NOT these two numbers using AND/OR/NOT instruction store the coming
output from these AND/OR/NOT operation using MOV instructions
Step3: AND/OR/NOT operation is used for masking particular bits in a byte
FLOW CHART: ADDITION/SUBTRACTION/MULTIPLICATION/DIVISION OPERATION
START

GET THE INPUTS

PERFORM ADDITION/ SUBTRACTION/MULTIPLICATION/


DIVISION

STORE THE RESULT

STOP

I. ADDITION PROGRAM:
ADDRESS OPCODE LABEL PROGRAM COMMENTS
4100 MOV A,#50 Initialize the A value
MOV A,#10 Initialize the B value
ADD A, B Add A & B
MOV DPTR, #4500 Initialize the DPTR value
MOVX @DPTR, A Move the accumulator value to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
50
4500
10
II. SUBTRACTION PROGRAM:
ADDRESS OPCODE LABEL PROGRAM COMMENTS
4100 MOV A,#50 Initialize the A value
MOV A,#10 Initialize the B value
SUBB A,B Subtract A & B
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
50
4500
10

III. MULTIPLICATION PROGRAM:


ADDRESS OPCODE LABEL PROGRAM COMMENTS
4100 MOV A,#50 Initialize the A value
MOV A,#10 Initialize the B value
MUL A,B Multiplication A & B
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
INC DPTR Increment DPTR
MOV A, B Move B register value to accumulator
MOVX @DPTR, A Move accumulator to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
4500
IV. DIVISION PROGRAM:
ADDRESS OPCODE LABEL PROGRAM COMMENTS
4100 MOV A,#50 Initialize the A value
MOV A,#10 Initialize the B value
DIV A,B Division A by B
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
INC DPTR Increment DPTR
MOV A, B Move B register value to accumulator
MOVX @DPTR,A Move accumulator to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
50
4500
10

I.AND OPERATION PROGRAM:


ADDRESS OPCODE LABEL PROGRAM COMMENTS
4100 MOV A,#02 Initialize the A value
MOV A,#06 Initialize the B value
ANL A ,B AND operation between A & B
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
02
4500
06
II.OR OPERATION PROGRAM:
ADDRESS OPCODE LABEL PROGRAM COMMENTS
4100 MOV A,#02 Initialize the A value
MOV A, #06 Initialize the B value
ORL A,B OR operation between A & B
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
02
4500
06

III.NOT OPERATION PROGRAM:


ADDRESS OPCODE LABEL PROGRAM COMMENTS
4100 MOV A,#06 Initialize the A value
CPL A Complement of A
MOV DPTR,#4500 Initialize the DPTR value
MOVX @DPTR,A Move the accumulator value to DPTR
Loop SJMP Loop End of the program

OBSERVATION:
INPUT OUTPUT
06 4500
RESULT:
Thus the assembly language program for arithmetic and logical operation was executed successfully.
Expt.No.: WRITE BASIC AND ARITHMETIC PROGRAMS USING
Date: EMBEDDED C

AIM:
To write 8051 Assembly Language Program for an 8-bit addition using Keil simulator and execute
it.
SOFTWARE REQUIRED:
 Keilμvision5 IDE

INTRODUCTION TO 8051 SIMULATORS:


A simulator is software that will execute the program and show the results exactly
tothe program running on the hardware, if the programmer finds any errors in the program while
simulating the program in the simulator, he can change the program and re-simulate the code and
get the expected result, before going to the hardware testing. The programmer can confidently
dump the program in the hardware when he simulates his program in the simulator and gets the
expected results.8051 controller is a most popular 8-bit controller which is used in a large number
of embedded applications and many programmers write programs according to their application. So
testing their programs in the software simulators is a way. Simulators will help the programmer to
understand the errors easily and the time taken for the testing is also decreased.These simulators are
very useful for students because they do need not to build the complete hardware for testing their
program and validate their program very easily in an interactive way.

KEIL µVision:
KEIL is the most popular software simulator. It has many features like interactive IDE
and supports both C and assembly languages for compilation and simulation.

Set up Keil IDE for Programming:


Keil µVision IDE is a popular way to program MCUs containing the 8051 architectures. It
supports over 50 microcontrollers and has good debugging tools including logic analyzers and watch
windows.In this article, we will use the AT89C51ED2 microcontroller, which has:
 64 KB FLASH ROM
 On-chip EEPROM
 256 Bytes RAM
 In-System programming for uploading the program Timer/counters
 SPI, UART, PWM
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 .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
PROGRAM:

ADDITION:
#include<reg51.h>
void main(void)
{
unsigned a,b,c;
a=0x08;
b=0x02;
P0=0X00;
c=a+b;
P0=c;
}

OUTPUT :

SUBTRACTION:
#include<reg51.h>
void main(void)
{
unsigned a,b,c;
a=0x0a;
b=0x02;
P0=0X00;
c=a-b;
P0=c;
}
OUTPUT:

MULTIPLICATION:
#include<reg51.h>
void main(void)
{
unsigned a,b,c;
a=0x05;
b=0x02;
P0=0X00;
c=a*b;
P0=c;
}

OUTPUT:

DIVISION:
#include<reg51.h>
void main(void)
{
unsigned a,b,c;
a=0x08;
b=0x02;
P0=0X00;
c=a/b;
P0=c;
}
OUTPUT:
Result:
Thus embedded C program for the arithmetic operation was executed successfully.

Expt.No.: 5
INTRODUCTION TO THE ARDUINO PLATFORM
Date:

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

INTRODUCTION TO ARDUINO:
Arduino is a project, open-source hardware, and software platform used to design and build
electronic devices. It designs and manufactures microcontroller kits and single-board interfaces for
building electronics projects. The Arduino boards were initially created to help students with the non-
technical background. The designs of Arduino boards use a variety of controllers and
microprocessors. Arduino is an easy-to-use open platform for creating electronic projects.
Arduino boards play a vital role in creating different projects. It makes electronics accessible to
non-engineers, hobbyists, etc. The various components present on the Arduino boards are a
Microcontroller, Digital Input/output pins, USB Interface and Connector, Analog Pins, reset buttons,
Power buttons, LEDs, Crystal oscillators, and Voltage regulators. Some components may differ
depending on the type of board. The most standard and popular board used over time is Arduino
UNO. The ATmega328Microcontroller present on the UNO board makes it rather powerful than
other boards. There are various types of Arduino boards used for different purposes and projects. The
Arduino Boards are organized using the Arduino (IDE), which can run on various platforms. Here,
IDE stands for Integrated Development Environment. Let's discuss some common and best Arduino
boards.

TYPES OF ARDUINO BOARDS:


1) Arduino UNO: 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 Arduino UNO includes 6 analog
pin inputs, 14digital pins, a USB connector, a power jack, and an ICSP (In-Circuit Serial
Programming) header. Itis the most used and of standard form from the list of all available Arduino
Boards.

2) Arduino Nano :
The Arduino Nano is a small Arduino board based on ATmega328P or ATmega628
Microcontroller.The connectivity is the same as the Arduino UNO board. The Nano board is defined
as a sustainable,small, consistent, and flexible microcontroller board. It is small in size compared to
the UNO board.The devices required to start our projects using the Arduino Nano board are Arduino
IDE and mini-USB. The Arduino Nano includes an I/O pin set of 14 digital pins and 8 analog pins. It
also includes6 Power pins and 2 Reset pins.

The Arduino board is shown below:

The components of Arduino UNO board are shown below:Let's discuss each component in detail.
3) Arduino Mega:
The Arduino Mega is based on the ATmega2560 Microcontroller. The ATmega2560 is an 8-
bitmicrocontroller. We need a simple USB cable to connect to the computer and the AC to DC
adapteror battery to get started with it. It has the advantage of working with more memory space.
TheArduino Mega includes 54 I/O digital pins and 16 Analog Input/Output (I/O), ICSP header, a
resetbutton, 4 UART (Universal Asynchronous Reciever/Transmitter) ports, USB connection, and a
power jack.

4) Arduino Micro :
The Arduino Micro is based on the ATmega32U4 Microcontroller. It consists of 20 sets of pins.
The7 pins from the set are PWM (Pulse Width Modulation) pins, while 12 pins are analog input
pins.The other components on board are a reset button, a 16MHz crystal oscillator, an ICSP header,
anda micro-USB connection. The USB is built in the Arduino Micro board.

5) Arduino Leonardo:
The basic specification of the Arduino Leonardo is the same as the Arduino Micro. It is also basedon
the ATmega32U4 Microcontroller. The components present on the board are 20 analog and digital
pins, a reset button, a 16MHz crystal oscillator, an ICSP header, and a micro USB connection.

Arduino UNO :

The Arduino UNO is a standard board of Arduino. Here UNO means 'one' in Italian. It was
named as UNO to label the first release of Arduino Software. It was also the first USB board released
by Arduino. It is considered as the 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.

 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, timer, external and internal interrupts,
and oscillator.
 ICSP pin - The In-Circuit Serial Programming pin allows the user to program using the
firmware of the Arduino board.

 Power LED Indicator- The ON status of LED shows the power is activated. When the power
is OFF, the LED will not light up.

 Digital I/O pins- The digital pins have the value HIGH or LOW. The pins numbered from D0
to D13 are digital pins.
 TX and RX LED's- The successful flow of data is represented by the lighting of these LED's.

 AREF- The Analog Reference (AREF) pin is used to feed a reference voltage to the Arduino
UNO board from the external power supply.

 Reset button- It is used to add a Reset button to the connection.

 USB- It allows the board to connect to the computer. It is essential for the programming of the
Arduino UNO board.

 Crystal Oscillator- The Crystal oscillator has a frequency of 16MHz, which makes the Arduino
UNO a powerful board.

 Voltage Regulator- The voltage regulator converts the input voltage to 5V.

 GND- Ground pins. The ground pin acts as a pin with zero voltage.

 Vin- It is the input voltage.

 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) pins.

Open your first sketch

 Open the LED blink example sketch: File > Examples >01.Basics > Blink.
 Select your board type and port

 Need to select the entry in the Tools > Board menu that corresponds to your Arduino board.

 Select the serial device of the board from the Tools | Serial Port menu. This is likely to be
COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find
out, you can disconnect your board and re-open the menu; the entry that disappears should be
the Arduino board. Reconnect the board and select that serial port.

 Now, simply click the "Upload" button in the environment. Wait a few seconds - you should
see the RX and TX leds on the board flashing. If the upload is successful, the message "Done
uploading." will appear in the status bar.

RESULT:

Expt.No. 5(B)
INTRODUCTION TO ARDIUNO PROGRAMING
Date:

AIM:
To write and execute different Arduino programming for analog, digital signals and serial
Communication.
APPARATUSREQUIRED:

SL No. COMPONENT SPECIFICATION QTY


1. Arduino board - 1
2. USB cable for Arduino - 1
3. Breadboard - 1
4. DHT11 sensor - 1
6. Jumper wires - 1

THEORY:

The DHT11 sensor is a low-cost digital temperature and humidity sensor that provides reliable and
accurate readings of temperature and humidity with a relatively simple interface. The DHT11 sensor
utilizes a capacitive humidity sensor and a thermistor to measure humidity and temperature,
respectively. The capacitive humidity sensor consists of a moisture-sensitive capacitor whose
capacitance changes with variations in humidity. When the relative humidity increases, moisture is
absorbed by the sensor, causing the dielectric constant of the sensing material to change, thereby altering
the capacitance of the capacitor. By measuring this change in capacitance, the humidity level can be
determined. The DHT11 sensor also incorporates a thermistor, which is a type of resistor whose
resistance varies with temperature.

The thermistor's resistance decreases as the temperature increases and vice versa. By measuring the
resistance of the thermistor, the temperature can be calculated using a known relationship between
resistance and temperature. The DHT11 sensor has a temperature measurement range of 0°C to 50°C
with an accuracy of ±2°C and a humidity measurement range of 20% to 90% RH with an accuracy of
±5%. The DHT11 sensor operates on a wide range of voltages (typically 3.3V to 5V) and consumes very
low power, making it suitable for battery-powered applications.

PROCEDURE:

1. Connect the Arduino Uno to your computer using the USB cable.
2. Launch the Arduino IDE software on your computer.
3. Place the DHT11 or DHT22 sensor on the breadboard.
4. Connect the power and ground pins of the sensor to the 5V and GND pins on the Arduino Uno,
respectively.
5. Connect the out pin of the sensor to analog pin A0 on the Arduino Uno.
6. Write the code in the Arduino IDE to read temperature and humidity values from the sensor.
7. Upload the code to the Arduino Uno.
8. Open the serial monitor in the Arduino IDE to observe the temperature and humidity readings.
PROGRAM:

BUZZER:

int buzzerPin = 8; //Assign Pin 8 to the relay control/signal pin


void setup() {
// put your setup code here, to run once:
pinMode(buzzerPin, OUTPUT); //Setting the Relay pin as an Output Pin
}
void loop() {
digitalWrite(buzzerPin, HIGH); //Turn the relay ON for 1 second
delay(1000);
digitalWrite(buzzerPin,LOW); //Turn the relay OFF for 1 second
delay(1000);

LED BLINKING:

void setup() {

pinMode(LED_BUILTIN, OUTPUT); // initialize digital pin LED_BUILTIN as an output.


}

void loop() {

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)

delay(1000); // wait for a second

digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW

delay(1000); // wait for a second

CIRCUIT DIAGRAM:
CODE:
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11 // Other possibilities DHT21, DHT22
DHT dht(DHTPIN, DHTTYPE);

void setup()
{
Serial.begin(9600);
dht.begin();
}

void loop()
{
float temp = dht.readTemperature();
float humidity = dht.readHumidity();
if (isnan(temp) || isnan(humidity))
{
Serial.println("Failed to read from DHT11");
}
else
{
Serial.print("Temperature: ");
Serial.print(temp);
Serial.print(" °C, ");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
}
delay(5000);
}

RESULT

Thus the interfacing of a LED, Buzzer, temperature and humidity sensor with an
Arduino board successfully completed and measured real time temperature and humidity values
using DHT 11 Sensor.

Expt.No. 6
EXPLORE DIFFERENT COMMUNICATION METHODS
Date: WITH IOT DEVICES (ZIGBEE, GSM, BLUETOOTH)
AIM:

To explore different communication methods with IoT devices (Zigbee, GSM, Bluetooth).

DIFFERENT COMMUNICATION METHODS:

IoT devices require reliable and efficient communication methods to transmit data and interact
with other devices or systems. Here are three commonly used communication methods for IoT
devices:

Zigbee:

Zigbee is a low-power wireless communication protocol designed for short-range


communication between devices. It operates on the 2.4 GHz frequency band and supports mesh
networking, allowing devices to communicate with each other through intermediate nodes. Zigbee is
commonly used in home automation, industrial control, and smart energy applications.

GSM (Global System for Mobile Communications):

GSM is a widely used cellular network technology that enables IoT devices to connect to the
internet using SIM cards. It operates on various frequency bands and provides wide coverage, making
it suitable for applications that require long-range communication. GSM is commonly used in
applications such as asset tracking, remote monitoring, and smart cities.

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 ideal
for 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.

Expt.No. 6(a)
BLUETOOTH COMMUNICATION
Date:

AIM:
To control an LED wirelessly using a Bluetooth module HC-05 and an Arduino board.

HARDWARE & SOFTWARE TOOLS REQUIRED:

Hardware & Software


S.No Quantity
Requirements
1 Arduino IDE 2.0 1

2 Arduino UNO Development 1


Board

3 Jumper Wires few

4 Arduino USB Cable 1

5 HC-05 Bluetooth Module 1

THEORY:

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 ideal
for 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.

PROCEDURE

1. Connect the components as shown below.

Arduino DHT11

Pin 12 Data
Arduino HC-05

Tx Rx

Rx Tx

2. Upload the Arduino code to your Arduino board (Note: Before uploading the code, remove Tx, Rx
pins from the Arduino board and after uploading the code, connect the pins at Tx and Rx.

3. Use Bluetooth Receiver Controller application (Android) to receive the transmitted data wirelessly.

4. Pair HC-05 Bluetooth module with the smartphone application and open the terminal window.

5. Send the character '1' to turn on the LED and '0' to turn it off.
PROGRAM:

#define ledPin 12
int data = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
Serial.begin(9600);
}
void loop()
{
if(Serial.available() > 0)
{
data = Serial.read();
if (data == '0')
{
digitalWrite(ledPin, LOW);
Serial.println("LED: OFF");
}
else if (data == '1')
{
digitalWrite(ledPin, HIGH);
Serial.println("LED: ON");
}
}
}

RESULT:

The experiment successfully demonstrated the interfacing of a LED and bluetooth module
with an Arduino board, enabling turning on/off the LED from the smartphone application terminal
window.
Expt.No. 6(b)
ZIGBEE COMMUNICATION
Date:

AIM:

The aim of this experiment is to demonstrate the interfacing of an Arduino microcontroller with a
Zigbee module to establish wireless communication between devices.

HARDWARE & SOFTWARE TOOLS REQUIRED:

Hardware & Software


S.No Quantity
Requirements
1 Arduino IDE 2.0 1

2 Arduino UNO Development 1


Board

3 Jumper Wires few

4 Arduino USB Cable 2

5 Zigbee Module 2

THEORY:

Zigbee is a wireless communication protocol designed for low-power, low-data-rate


applications. It operates on the IEEE 802.15.4 standard and is characterized by its low energy
consumption, short-range communication, and ability to form mesh networks. Zigbee modules
typically consist of a microcontroller with integrated Zigbee firmware and a radio transceiver. They
are widely used in applications such as home automation, industrial monitoring and control,
healthcare, and smart energy management. Zigbee offers reliable and secure communication, making
it suitable for environments where interference and network congestion are concerns. Additionally, its
mesh networking capability allows for scalability and robustness in large-scale deployments. Overall,
Zigbee modules provide a cost-effective and efficient solution for wireless communication in various
Internet of Things (IoT) and embedded systems applications.
PROGRAM:
ZIGBEE – TRANSMIT:

#include "SoftwareSerial.h"
SoftwareSerialXBee(2,3);
int BUTTON = 5;
boolean toggle = false; //this variable keeps track of alternative click of the button
void setup()
{
Serial.begin(9600);
pinMode(BUTTON, INPUT_PULLUP);
XBee.begin(9600);
}
void loop()
{
//When button is pressed (GPIO pulled low) send 1
if (digitalRead(BUTTON) == LOW && toggle)
{
Serial.println("Turn on LED");
toggle = false;
XBee.write('1');
delay(1000);
}
//When button is pressed second time (GPIO pulled low) send 0
else if (digitalRead(BUTTON) == LOW && !toggle)
{
Serial.println("Turn off LED");
toggle = true;
XBee.write('0');
delay(1000);
}
}
PROCEDURE:

1. Connect Zigbee module's TX pin to Arduino's digital pin 2 (RX) and RX pin to digital pin 3 (TX).

2. Write Arduino sketch to initialize Software Serial for Zigbee communication.

3. Upload the sketch to Arduino using Arduino IDE.

4. Open Serial Monitor in Arduino IDE to monitor communication.

5. Power Arduino with external source and place it in one location.

6. Take another Arduino with Zigbee module to another location.

7. Test wireless communication by sending and receiving messages between Arduinos.


ZIGBEE –RECEIVER:
#include<SoftwareSerial.h>
int led = 6;
int received = 0;
inti;
//For communicating with zigbee
SoftwareSerialzigbee(2,3);
void setup()
{
Serial.begin(9600);
zigbee.begin(9600);
pinMode(led, OUTPUT);
}
void loop()
{
//check if the data is received
if (zigbee.available() > 0)
{
received = zigbee.read();
//if the data is 0, turn off the LED
if (received == '0')
{
Serial.println("Turning off LED");
digitalWrite(led, LOW);
}
else if (received == '1') //if the data is 1, turn on the LED
{
Serial.println("Turning on LED");
digitalWrite(led, HIGH);
}
}
}
RESULT:

Thus the experiment, interfacing of a Zigbee module with an Arduino board has been
successfully completed, facilitating communication between two Zigbee devices connected via
Arduino.
Expt.No. 6(b)
GSM COMMUNICATION
Date:

AIM:

The objective of this experiment is to demonstrate the interfacing of an Arduino


microcontroller with a GSM module to send and receive messages.

APPARATUS REQUIRED:

SL No. COMPONENT SPECIFICATION QTY


1. IOT Trainer Kit - 1
2. USB cable for Arduino - 1
3. Jumper wires - 1
Personal Computer with
4. - 1
Arduino IDE

THEORY:

GSM SIM module is an ultra-compact and reliable wireless module. It provides a complete
Dual-band GSM/GPRS solution in a Surface Mount Technology (SMT) module, which can be easily
integrated into customer applications. This module offers an industry- standard interface and delivers
excellent performance for voice, SMS, Data, and Fax over GSM/GPRS 900/1800 MHz frequencies.
The SIM module is a GSM/GPRS modem that allows devices to communicate over cellular networks.
It works by integrating the necessary hardware and software to establish a connection to the GSM
network and facilitate data transmission.

PROCEDURE:

In this section we have listed the steps to successfully boot our SIM GSM Module:

• Insert the SIM card into the GSM module and lock it.

• Connect the adapter to the GSM module and turn it ON!

• Now wait for some time (say 1 minute) and see the blinking rate of the status LED’ or ‘network
LED’ (the GSM module will take some time to establish a connection with the mobile network).

• Once the connection is established successfully, the status/network LED will blink continuously
every 3 seconds. You may try making a call to the mobile number of the SIM card inside the GSM
module. If you hear a ring back, the GSM module has successfully established a network connection.
Pin of SIM GSM Module Pin of Arduino Board
Tx 10 as Rx
Rx 9 as Tx
GND GND
Program:

#include <SoftwareSerial.h> SoftwareSerial mySerial(9, 10);


void setup()
{
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
}
void loop()
{
if (Serial.available() > 0)
{
switch (Serial.read())
{
case 's':
SendMessage(); break;
case 'd':
DialCall(); break;

}
}
if (mySerial.available() > 0)
{
Serial.write(mySerial.read());
}
}
void SendMessage()
{
mySerial.println("AT+CMGF=1"); // Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milliseconds or 1 second
mySerial.println("AT+CMGS=\"+xxxxxxxxxxx\"\r"); //Replace x with mobile number
delay(1000);
mySerial.println("I am SMS from GSM Module"); // The SMS text you want to send delay(100);
mySerial.println((char)26); // ASCII code of CTRL+Z delay(1000);
}
void DialCall()
{
mySerial.println("ATD+xxxxxxxxxxxx;"); // ATDxxxxxxxxxx; -- watch out here for semicolon at the
end!!
delay(100);
}

Output:

RESULT

The experiment successfully demonstrated the interfacing of a GSM module with an Arduino board,
enabling sending and receiving messages between devices.
Expt.No. 7
INTRODUCTION TO RASPBERRY PI PLATFORM AND
Date: PYTHON PROGRAMMING

AIM :

The objective of this experiment is to introduce the Raspberry Pi platform and Python
programming.

APPARATUS REQUIRED:

SL No. COMPONENT SPECIFICATION QTY


1. IOT Trainer Kit with power adapter - 1
2. Thonny IDE - 1
3. Necessary cables - 1
4. Jumper wires - 1

5. Personal Computer - 1

THEORY:

Introduction to Raspberry Pi 3 B+:

The Raspberry Pi 3 Model B+ is a versatile single-board computer renowned for its compact
size and powerful performance. Released in 2018 as an upgrade to its predecessor, it boasts a 64-bit
quad-core processor running at 1.4 GHz, offering enhanced processing capabilities for various
computing tasks. Notable improvements include dual-band wireless LAN supporting 2.4GHz and
5GHz frequencies, along with Bluetooth 4.2/BLE, ensuring faster and more reliable networking.
Gigabit Ethernet over USB 2.0 further enhances connectivity options, complementing its array of
USB ports, HDMI, and GPIO pins. With 1GB LPDDR2 SDRAM and support for microSD storage,
the Raspberry Pi 3 Model B+ accommodates a wide range of projects, from home automation to IoT
applications. The official operating system for the Raspberry Pi is called Raspberry Pi OS (formerly
known as Raspbian). Raspberry Pi OS is a Debian-based Linux distribution optimized for the
Raspberry Pi hardware.

Features:
 Quad Core 1.2GHz Broadcom BCM2837 64bit CPU.
 1GB RAM.
 BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board.
 100 Mbps Base Ethernet.
 40-pin extended GPIO.
PIN DIAGRAM:
 4 USB 2.0 ports.
 4 Pole stereo output and composite video port.
 Full size HDMI.
 CSI camera port for connecting a Raspberry Pi 3 B+ camera.
 DSI display port for connecting a Raspberry Pi 3 B+ touchscreen display.
 Micro SD port for loading your operating system and storing data.
 Upgraded switched Micro USB power source up to 2.5A.

Raspberry Pi mainly consists of the following blocks:

Processor: Raspberry Pi uses Broadcom BCM2835 system on chip which is an ARM processor and
Video core Graphics Processing Unit (GPU). It is the heart of the Raspberry Pi which controls the
operations of all the connected devices and handles all the required computations.

HDMI: High Definition Multimedia Interface is used for transmitting video or digital audio data to a
computer monitor or to digital TV. This HDMI port helps Raspberry Pi to connect its signals to any
digital device such as a monitor digital TV or display through an HDMI cable.

GPIO ports: General Purpose Input Output ports are available on Raspberry Pi which allows the user
to interface various I/P devices.

Audio output: An audio connector is available for connecting audio output devices such as
headphones and speakers.

USB ports: This is a common port available for various peripherals such as a mouse, keyboard, or
any other I/P device. With the help of a USB port, the system can be expanded by connecting more
peripherals.

SD card: The SD card slot is available on Raspberry Pi. An SD card with an operating system
installed is required for booting the device.

Ethernet: The ethernet connector allows access to the wired network, it is available only on the
model B of Raspberry Pi.

Power supply: A micro USB power connector is available onto which a 5V power supply can be
connected.

Camera module: Camera Serial Interface (CSI) connects the Broadcom processor to the Pi camera.

Display: Display Serial Interface (DSI) is used for connecting LCD to Raspberry Pi using 15 15-pin
ribbon cables. DSI provides a high-resolution display interface that is specifically used for sending
video data.
A powerful feature of the Raspberry Pi is the row of GPIO (general-purpose input/output) pins along
the top edge of the board. A 40-pin GPIO header is found on all current Raspberry Pi boards

Voltages:

Two 5V pins and two 3.3V pins are present on the board, as well as a number of ground pins (GND),
which can not be reconfigured. The remaining pins are all general-purpose 3.3V pins, meaning
outputs are set to 3.3V and inputs are 3.3V-tolerant.

Outputs:

A GPIO pin designated as an output pin can be set to high (3.3V) or low (0V).

Inputs :

A GPIO pin designated as an input pin can be read as high (3.3V) or low (0V). This is made easier
with the use of internal pull-up or pull-down resistors. Pins GPIO2 and GPIO3 have fixed pull-up
resistors, but for other pins this can be configured in software.

Other functions :

As well as simple input and output devices, the GPIO pins can be used with a variety of alternative
functions, some are available on all pins, others on specific pins.

PWM (pulse-width modulation):

Pulse width modulation (PWM) is a modulation technique that generates variable-width pulses to
represent the amplitude of an analog input signal.

 Software PWM available on all pins


 Hardware PWM available on GPIO12, GPIO13, GPIO18, GPIO19
SPI:

A serial peripheral interface (SPI) is an interface commonly used in computers and


embedded systems to facilitate short-distance communication between a microcontroller and
one or more peripheral integrated circuits (ICs). Serial Peripheral Interface (SPI) is a full-duplex serial
protocol for communicating with high-speed peripherals.

 SPI0: MOSI (GPIO10); MISO (GPIO9); SCLK (GPIO11); CE0 (GPIO8), CE1 (GPIO7)
 SPI1: MOSI (GPIO20); MISO (GPIO19); SCLK (GPIO21); CE0 (GPIO18); CE1 (GPIO17);
CE2 (GPIO16)
I2C :

I2C stands for Inter-Integrated Circuit. It is a bus interface connection protocol incorporated into
devices for serial communication. I2C stands for Inter-Integrated Circuit. It is a bus interface
connection protocol incorporated into devices for serial communication.

 Data: (GPIO2); Clock (GPIO3)


EEPROM :

Data: (GPIO0); EEPROM Clock (GPIO1)

Serial:

 TX (GPIO14); RX (GPIO15)
GPIO pinout :

A GPIO reference can be accessed on your Raspberry Pi by opening a terminal window and running
the command pinout. This tool is provided by the GPIO Zero Python library, which is installed by
default in Raspberry Pi OS.

Serial interface:
The serial interface on Raspberry Pi has received (Rx) and transmit (Tx) pins for
communication with serial peripherals.

Raspberry Pi has multiple serial ports. The first two are called primary and secondary. By default,
primary appears on GPIO 14 (transmit) and 15 (receive) of the J8. Secondary is used by bluetooth, on
Raspberry Pi that support bluetooth. Each port is driven by a UART. On every Raspberry Pi there are
at least two of them: UART0 and UART1. The assignment of which UART drives which port
depends on the model and its configuration.

Thonny IDE :

Thonny is an open-source IDE which is used to write and upload programs to different
development boards such as Raspberry Pi Pico, Raspberry Pi 1 , Raspberry Pi 2, Raspberry Pi 3,
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.
PROCEDURE:

1. Connect the components as shown below.

GPIO Pin Components


GPIO17 LED

2. Open the Thonny IDE and create new file. Type the program, save and run.

3. As the code is executed, the LED is turned ON and vice-versa.


PROGRAM:

import RPi.GPIO as GPIO import time

# Set the GPIO mode to BCM

GPIO.setmode(GPIO.BCM)

# Set the GPIO pin to an output

LED_PIN = 17

GPIO.setup(LED_PIN, GPIO.OUT)

try:

while True:

# Turn the LED on

GPIO.output(LED_PIN, GPIO.HIGH)

time.sleep(1) # 1 second delay

# Turn the LED off

GPIO.output(LED_PIN, GPIO.LOW)

time.sleep(1) # 1 second delay

except KeyboardInterrupt:

# Clean up GPIO settings on keyboard interrupt GPIO.cleanup()


RESULT :
Expt.No. 8
INTERFACING SENSORS WITH RASPBERRY PI
Date:

AIM:

To interface the Temperature sensor and IR sensor with Raspberry PI.

HARDWARE & SOFTWARE TOOLS REQUIRED

S.No Hardware & Software Requirements Quantity

1 Thonny IDE 1

2 Raspberry PI Development Board 1

3 Jumper Wires few

4 Micro USB Cable 1

5 IR sensor 1

6 Temperature sensor 1

Theory:

An infrared (IR) sensor is a device that detects infrared radiation emitted or reflected by
objects in its field of view. It typically consists of an IR emitter and an IR detector. The emitter emits
infrared radiation, while the detector detects the radiation reflected or emitted by objects. IR sensors
are commonly used for various applications such as motion detection, proximity sensing, and
temperature measurement. They work based on the principle that different materials emit and reflect
different amounts of infrared radiation at different temperatures. By measuring the intensity of
infrared radiation, IR sensors can determine the presence or absence of objects, as well as their
temperature.

The DHT11 sensor is a digital temperature and humidity sensor that utilizes a capacitive
humidity sensor and a thermistor to measure environmental conditions. It can detect temperature in
the range of 0°C to 50°C with an accuracy of ±2°C, and humidity in the range of 20% to 80% with an
accuracy of ±5%. The sensor outputs data in a digital format, making it easy to interface with
microcontrollers like Arduino. The DHT11 sensor is widely used in applications requiring precise
monitoring of temperature and humidity levels, such as weather stations, HVAC systems, and
environmental monitoring devices.
PROCEDURE:

1. Once Raspberry Pi 3 B+ is booted up to GUI, Connect the keyboard and Mouse to USB slots.

2. Now you can write your programs at Thonny Python IDE. Menu → Programming → Thonny
Python IDE. File → New. You can write your Program here and save.

3. Make the connections as given below:

IR Sensor
GPIO Pin Components
GP16 IR sensor
DHT11 Sensor
GP4 DHT11 Sensor
4. Execute the program at terminal only by following command

cd \Downloads - Press Enter key

sudo python <program-name>.py

5. Check the temperature and humidity values and the presence of objects in the screen.
PROGRAM FOR DHT Sensor:

import time
import board
import adafruit_dht
dhtDevice = adafruit_dht.DHT11(board.D4, use_pulseio=False) ## Raspberry pi 4 - gpio4
while True:
try:
# Print the values to the serial port
temperature_c = dhtDevice.temperature
temperature_f = temperature_c * (9 / 5) + 32humidity = dhtDevice.humidity
print("Temp: {:.1f} F / {:.1f} C Humidity: {}% ".format(temperature_f, temperature_c, humidity))
except RuntimeError as error:
# Errors happen fairly often, DHT's are hard to read, just keep going
print(error.args[0])
time.sleep(2.0)
continue
except Exception as error:
dhtDevice.exit()
raise error
time.sleep(2.0)
OUTPUT:
PROGRAM FOR IR SENSOR:

import RPi.GPIO as gpio

from time import sleep

gpio.setmode(gpio.BOARD)

gpio.setup(36, gpio.IN) # Raspberry pi 4 -GPIO16

while True:

sensor=gpio.input(36)

if sensor==1:

print(" not detect")

sleep(0.1)

elif sensor==0:

print(" detect")

OUTPUT :

RESULT
Thus the experiment, interfacing of IR and DHT11 sensors with Raspberry PI board using
python programming was implement successfully. Real-time temperature and humidity readings were
obtained as a result.
Expt.No. 9
COMMUNICATE BETWEEN ARDUINO AND RASPBERRY PI
Date: USING ANY WIRELESS MEDIUM

AIM:

To establish communication between Arduino and Raspberry PI using wireless medium.

HARDWARE & SOFTWARE TOOLS REQUIRED

SL No. COMPONENT SPECIFICATION QTY


1. IOT Trainer Kit with power adapter - 1
2. Thonny IDE - 1
3. Necessary cables - 1
4. Jumper wires - 1

5. Personal Computer - 2

Theory:

The experiment aims to establish wireless communication between an Arduino


microcontroller and a Raspberry Pi single-board computer using Bluetooth technology. Bluetooth
modules are integrated into both devices to facilitate the wireless data exchange. The Arduino is
programmed to initialize the Bluetooth module and establish a serial communication link. On the
Raspberry Pi side, the onboard Bluetooth functionality is enable and the device is configured to pair
with the Arduino's Bluetooth module. Python code is then written to establish a serial connection with
the Arduino and exchange data. The protocol for data exchange is defined, typically involving
sending and receiving strings of data. Testing ensures the successful transmission and reception of
data between the two devices, validating the effectiveness of the wireless Bluetooth communication
setup. This experiment not only demonstrates the integration of hardware components and software
programming but also highlights the versatility of Bluetooth technology for wireless communication
between different embedded systems.

Procedure

1. Open Arduino IDE in a PC and type the Master code.

2. Open Thonny IDE in another PC and write slave code and save.

3. Make the connections as given below:


Program:

Arduino :

int led=13;
void setup()
{
pinMode(led, OUTPUT);
Serial.begin(9600); //default baud rate for bt 38400
}
void loop()
{
if(Serial.available())
{
int a=Serial.parseInt();
Serial.println(a);
if (a==1)
{
digitalWrite(led, HIGH);
}
if (a == 0)
{
digitalWrite(led, LOW);

}
}
}

Raspberry Pi Bluetooth:
import serial
import time
bluetooth=serial.Serial("/dev/rfcomm7",9600)
while True:
a=input("enter:-")
string='X{0}'.format(a)
bluetooth.write(string.encode("utf-8"))
Arduino
UNO Pin Bluetooth Module
D2 Tx
D3 Rx
D13 LED

4. Arduino:

Write the arduino program and upload it

As per connection bluetooth to arduino TX-RX , RX-TX

5. Raspberry :

edit the DOS Promt

sudo Bluetooth ctl ## Bluetooth path

agent on ## agent registered

scan on ## our bluetooth will display copy the mac address

6. To view your current bluetooth mac address:

CTRL + Z

sudo rfcomm help ## rfcomm command will display

sudo rfcomm bind 7 mac address ## enter command paste your mac ad

Connect the Bluetooth on raspberry pi ,right corner click Bluetooth icon and pair

RESULT

The experiment successfully executed the communication between Arduino and Raspberry PI
using Bluetooth wireless medium to blink a LED with Raspberry PI board using python
programming.
Expt.No. 10
SETUP A 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:

SL No. Name SPECIFICATION QTY


1. ThingSpeak Account Website or Application 1

Theory:

ThingSpeak is an IoT platform facilitating the seamless collection, transmission, storage,


analysis, and visualization of data from sensors and actuators. IoT devices send data to Thing Speak's
cloud servers, where it's stored and made accessible for real-time analysis using MATLAB analytics
or custom code. Visualizations such as charts and graphs help users interpret the data, which can be
shared publicly or privately. ThingSpeak also integrates with various services like IFTTT and
MATLAB, offering automation capabilities and extending its functionality for diverse IoT
applications, from home automation to industrial monitoring and beyond.

Procedure

Step1: Navigate to the Thing Speak website using your web browser
(Link: https://thingspeak.com/login?skipSSOCheck=true).

Step 2: Login using the credentials if an existing account is present or else create a new account.

Step 3: Once Logged in, create new channel. Give a channel name and required field names and save
channel.

Step 4: Go to the Sharing tab and select ‘Share channel view with everyone’.

Step 5: Under API Keys tab, note the ‘Write API Key’ for enabling communication from any device.
RESULT

The experiment successfully set up a cloud platform in Things Speak to log the data from IoT
devices.
Expt.No. 11
LOG DATA USING RASPBERRY PI AND UPLOAD TO THE
Date: CLOUD PLATFORM

AIM:

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

HARDWARE & SOFTWARE TOOLS REQUIRED

S.No Hardware & Software Quantity


Requirements

1 Thonny IDE 1

2 Raspberry Pi Pico Development Board 1

3 Jumper Wires few Few

4 Micro USB Cable 1

Theory:

To log data using a Raspberry Pi and upload it to a cloud platform utilizing the Raspberry Pi
CPU temperature, begin by setting up your Raspberry Pi and writing a Python script to read the CPU
temperature from the appropriate system file. Modify the script to upload the CPU temperature data
to the chosen cloud platform using their respective APIs or SDKs, ensuring proper authentication and
data formatting for security. To ensure continuous monitoring, schedule the script to run at regular
intervals using a cron job or system d service. Implement security measures, such as encryption, to
protect the data during transmission, and set up monitoring for error detection and performance
optimization.

Procedure:
Step 1: Signup for ThingSpeak
For creating your channel on ThingSpeak you first need to sign up on ThingSpeak. In case if you
already have account on ThingSpeak just sign in using your id and password.For creating your
account go to www.thinspeak.com. Click on signup if you don’t have account and if you already
have account click on sign in. After clicking on signup fill your details. Shown in Fig. 1. After this
verifies your E-mail id and click on continue.
Figure 1: Signup for ThingSpeak

Figure 2: Create a Channel for Your Data

Step 2: Create a Channel for Data


Once you Sign in after your account verification, Create a new channel by clicking “New Channel”
button. Shown in Fig. 2. After clicking on “New Channel”, enter the Name and Description of the
data you want to upload on this channel. Now enter the name of your data (like Temperature or
pressure) in Field1. If you want to use more than one Field you can check the box next to Field option
and enter the name and description of your data.

After this click on save channel button to save your details.

Step 3: Getting API Key in ThingSpeak

To send data to ThingSpeak, we need an unique API key, which we will use later in our python code
to upload our CPU data to Thing Speak Website. Click on “API Keys” button to get your unique API
key for uploading your CPU data.Shown in Fig. 3. Now copy your “Write API Key”. We will use this
API key in our code.

Step 4: Python Code for Raspberry Pi


Open Thonny IDE write the code and save the file with any name and .py extension Don’t forget to
add your channel API key in program.
cd \Downloads -----Press Enter key
sudo python CPUTEMP.py -----Press Enter key
Figure 3: Create a Channel for Data
Program:
import httplib
import urllib
import time
key = "ABCD" # Put your API Key here
def thermometer():
while True:
#Calculate CPU temperature of Raspberry Pi in Degrees C
temp = int(open('/sys/class/thermal/thermal_zone0/temp').read()) / 1e3 # Get Raspberry Pi CPU
temp
params = urllib.urlencode({'field1': temp, 'key':key })
headers = {"Content-typZZe": "application/x-www-form-urlencoded","Accept": "text/plain"}
conn = httplib.HTTPConnection("api.thingspeak.com:80")
try:
conn.request("POST", "/update", params, headers)
response = conn.getresponse()
print temp
print response.status, response.reason
data = response.read()
conn.close()
except:
print "connection failed"
break
if __name__ == "__main__":
while True:
thermometer()
Step 5: Check ThingSpeak site for Data Logging
After completing these steps open your channel and you will see the CPU temperature data is
updating into ThingSpeak website.

Output :
CPU temperature data is updating into ThingSpeak website:
RESULT:

The experiment successfully set up a cloud platform in Things Speak to log the CPU
temperature data from Raspberry PI board to the cloud.
Expt.No. 12
DESIGN AN IOT BASED SYSTEM
Date:

You might also like