0% found this document useful (0 votes)
6 views75 pages

Cs3691 Eiot Lab Manual

The document is a laboratory manual for the CS3691 Embedded Systems and IoT course at Tagore Engineering College for the academic year 2025-2026. It outlines the vision and mission of the Department of Artificial Intelligence and Data Science, along with course objectives, a list of experiments, and expected outcomes. The manual includes detailed procedures for various experiments involving assembly language, embedded C programming, Arduino, and IoT communication methods.
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)
6 views75 pages

Cs3691 Eiot Lab Manual

The document is a laboratory manual for the CS3691 Embedded Systems and IoT course at Tagore Engineering College for the academic year 2025-2026. It outlines the vision and mission of the Department of Artificial Intelligence and Data Science, along with course objectives, a list of experiments, and expected outcomes. The manual includes detailed procedures for various experiments involving assembly language, embedded C programming, Arduino, and IoT communication methods.
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

TAGORE ENGINEERING COLLEGE

RATHINAMANGALAM, VANDALUR - KELAMBAKKAM ROAD,CHENNAI-


600127

DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND


DATA SCIENCE

CS3691-EMBEDDED SYSTEMS AND IOT

LABORATORY MANUAL

Semester/ Branch: VI/AIDS


Academic Year: 2025-2026

EVEN SEMESTER
VISION

To produce an intelligent and highly ethical professionals in the field of Artificial Intelligence and
Data Science through innovative teaching, training and collaborative research activities.

MISSION

• To develop the department as a centre of excellence for solving the complex cognitive tasks
through value-based data science education for the students.

• To produce ethical data science engineers by inculcate the value of humanity and courage in
producing the relevant solutions to address the societal challenges.

• To promote the research activities amongst the students through an innovative teaching and
training process that could benefit the society.
CS3691 EMBEDDED SYSTEMS AND IOT SYLLABUS
COURSE OBJECTIVES:
❖ To learn the internal architecture and programming of an embedded processor.

❖ To introduce interfacing, I/O devices to the processor.

❖ To introduce the evolution of the Internet of Things (IoT).

❖ To build a small low-cost embedded IoT system using Arduino/Raspberry Pi/ open platform.
❖ To apply the concept of the Internet of Things in real-world scenario.
LIST OF EXPERIMENTS
1. Write 8051 Assembly Language experiments using simulator.
2. Test data transfer between registers and memory.
3. Perform ALU operations.
4. Write Basic and arithmetic Programs Using Embedded C.
5. Introduction to Arduino platform and programming
6. Explore different communication methods with IoT devices (Zigbee, GSM, Bluetooth)
7. Introduction to Raspberry PI platform and python programming
8. Interfacing sensors with Raspberry PI
9. Communicate between Arduino and Raspberry PI using any wireless medium
10. Setup a cloud platform to log the data
11. Log Data using Raspberry PI and upload to the cloud platform
12. Design an IOT based system
OUTCOMES:
CO1: Explain the architecture of embedded processors.
CO2: Write embedded C programs. CO3: Design simple embedded applications.
CO4: Compare the communication models in IOT
CO5: Design IoT applications using Arduino/Raspberry Pi /open platform.
CERTIFICATE

Certified that this is the bonafide record of work done


Mr/Ms……………………………….of…………………………...
………………………………Department in the
……………………………..……………………………Laboratory
and submitted for University Practical Examination Conducted
on…………………………..at TAGORE ENGINEERING
COLLEGE.

Signature of the Signature of the


Lab in Charge Head of the Department

Internal Examiner External Examiner


LIST OF EXPERIMENTS

[Link] DATE NAME OF THE EXPERIMENT MARKS SIGNATURE

1 Write 8051 Assembly Language


Experiments Using Simulator

2 Test Data Transfer Between Registers


And Memory
3 Perform Alu Operations

4 Write Basic and arithmetic Programs


Using Embedded C.
5 Introduction to Arduino platform and
programming
6 Explore different communication
methods with IoT devices (Zigbee,
GSM, Bluetooth)
7 Introduction to Raspberry PI platform
and python programming

8 Interfacing sensors with Raspberry PI

9 Communicate between Arduino and


Raspberry PI using any wireless
medium
10 Setup a cloud platform to log the data

11 Log Data using Raspberry PI and


upload to the cloud platform
12 Design an IOT based system
Ex. No: 1 WRITE 8051 ASSEMBLY LANGUAGE EXPERIMENTS

DATE: USING SIMULATOR

AIM

To write 8051 Assembly language programs using a simulator.

SOFTWARE REQUIRED

Keil μvision5 IDE

INTRODUCTION TO 8051 SIMULATORS

A simulator is software that will execute the program and show the results exactly to
the 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.
SET UP KEIL IDE FOR PROGRAMMING

1. Install Keil µVision IDE, a popular tool for programming MCUs with 8051 architectures.
2. Create a new project by navigating to Project → New µVision project and save it in a
folder.
3. Select your microcontroller (e.g., AT89C51ED2) when prompted. Under the Microchip
section, choose the appropriate controller.
4. Opt to exclude unnecessary files when prompted.
5. Create a new C file by going to File → New, and save it with a .c extension in the project
folder.
6. Add the created .c file to your project workspace by selecting Add Existing Files.

PROCEDURE

1. Create a new project


• Go to "Project" and close the current project by selecting "Close Project".
• Next, go to "Project" > "New μVision Project" and create a new project. Select
the device for the target.
2. Select the device
• Choose the device AT89C51ED2, AT89C51, or AT89C52.
3. Add Startup file
• Go to "File" and click "New" to create a new file.
• Write a program in the editor window and save it with a .asm extension.
4. Add source file to Group
• Add the source file to a group in the project workspace.
5. Build Target
• Click on "Build Target" or press F7 to build the project.
6. Debugging
• Enter debugging mode to see the result of the simulation by clicking "Run" or
"Step Run".
PROGRAM

ORG 0000H

CLR C

MOV A, #20H

ADD A, #21H

MOV R0, A

END

OUTPUT
RESULT

Thus, the 8051 Assembly Language program has been executed successfully.
Ex. No: 2 TEST DATA TRANSFER BETWEEN REGISTERS AND MEMORY

DATE:

AIM

To test data transfer between registers and memory.

SOFTWARE REQUIRED

Keil μvision5 IDE

PROCEDURE

1. Create a new project by closing the current project and selecting "Project" → "Close
Project".
2. Go to "Project" → "New μVision Project" to create a new project. Select the device for
the target.
3. Choose the device from the options: AT89C51ED2, AT89C51, or AT89C52.
4. Add a startup file by selecting "File" → "New" and then writing your program in the
editor window. Save it with a .asm extension.
5. Add this source file to a group and click on "Build Target" or press F7.
6. Enter debugging mode to observe the simulation results by clicking "Run" or "Step Run".

PROGRAM
ORG 0000H
CLR C
MOV R0, #55H
MOV R1, #6FH
MOV A, R0
MOV 30H, A
MOV A, R1
MOV 31H, A
END
OUTPUT
RESULT

Thus, data transfers between memory and registers have been successfully tested.
Ex. No: 3 PERFORM ALU OPERATIONS

DATE:

AIM

To perform ALU operations using assembly language.

SOFTWARE REQUIRED

Keil μvision5 IDE

PROCEDURE

1. Create a new project by closing the current project and selecting "Project" → "Close
Project".
2. Go to "Project" → "New μVision Project" to create a new project. Select the device for
the target.
3. Choose the device from the options: AT89C51ED2, AT89C51, or AT89C52.
4. Add a startup file by selecting "File" → "New" and then writing your program in the
editor window. Save it with a .asm extension.
5. Add this source file to a group and click on "Build Target" or press F7.
6. Enter debugging mode to observe the simulation results by clicking "Run" or "Step Run".

PROGRAM

ORG 0000H

CLR C

//ADDITION

MOV A, #20H

ADD A, #21H

MOV 41H, A
//SUBTRACTION

MOV A, #20H

SUBB A, #18H

MOV 42H, A

//MULTIPLICATION

MOV A, #03H

MOV B, #04H

MUL AB

MOV 43H, A

//DIVISION

MOV A, #95H

MOV B, #10H

DIV AB

MOV 44H, A

MOV 45H, B

//AND

MOV A, #25H

MOV B, #12H

ANL A, B
MOV 46H, A

//OR

MOV A, #25H

MOV B, #15H

ORL A, B

MOV 47H, A

//XOR

MOV A, #45H

MOV B, #67H

XRL A,B

MOV 48H, A

//NOT

MOV A, #45H

CPL A

MOV 49H, A

END
OUTPUT
RESULT

Thus, arithmetic operations have been executed successfully.


Ex. No: 4 WRITE BASIC AND ARITHMETIC PROGRAMS

DATE: USING EMBEDDED C

AIM

To write basic and arithmetic programs using embedded C.

PROCEDURE

1. Close the current project and select "Project" → "Close Project" to create a new project.
2. Create a new project by going to "Project" → "New μVision Project" and select the target
device (AT89C51ED2, AT89C51, or AT89C52).
3. Add a startup file by navigating to "File" → "New" and write your program in the editor
window. Save it with a .c extension.
4. Add the source file to a group and build the target by clicking on "Build Target" or
pressing F7.
5. Enter debugging mode by clicking "Run" or "Step Run" to observe the simulation results.

PROGRAM

#include <reg51.h>

void main(void) {

unsigned char x, y, z, a, b, c, d, e, f, p, q, r; // define variables

// addition

x = 0x12; // first 8-bit number

y = 0x34; // second 8-bit number

P0 = 0x00; // declare port 0 as output port

z = x + y; // perform addition

P0 = z; // display result on port 0


// subtraction

a = 0x12; // first 8-bit number

b = 0x34; // second 8-bit number

P1 = 0x00; // declare port 1 as output port

c = b - a; // perform subtraction

P1 = c; // display result on port 1

// multiplication

d = 0x12; // first 8-bit number

e = 0x34; // second 8-bit number

P2 = 0x00; // declare port 2 as output port

f = e * d; // perform multiplication

P2 = f; // display result on port 2

// division

p = 0x12; // first 8-bit number

q = 0x34; // second 8-bit number

P3 = 0x00; // declare port 3 as output port

r = q / p; // perform division

P3 = r; // display result on port 3

while (1);

}
OUTPUT
RESULT

Thus, arithmetic operations have been executed using Embedded C in the Keil simulator.
Ex. No: 5 INTRODUCTIONS TO ARDUINO PLATFORM AND PROGRAMMING

DATE:

AIM

To study the Arduino platform, provide an overview of Arduino programming, and


demonstrate a basic program for blinking an LED.

APPARATUS REQUIRED

Arduino UNO Board, LED and 220 OHM resistor.

INTRODUCTION TO THE ARDUINO PLATFORM

Arduino is an open-source electronics platform based on easy-to-use hardware and


software. It's perfect for artists, designers, hobbyists, and anyone interested in creating
interactive and innovative projects. The platform consists of two main elements: the Arduino
hardware and the Arduino Integrated Development Environment (IDE).

Arduino Hardware

The Arduino board is the physical part of the platform. It consists of a microcontroller
that can be programmed to read inputs and control various outputs. The most common Arduino
board is the Arduino Uno, but there are many other models tailored to specific requirements.

Arduino IDE

The Arduino IDE is a cross-platform application that serves as the software part of the
platform. It allows you to write and upload code to the Arduino board. The code is written in a
simplified version of C/C++, making it accessible to those without extensive programming
experience.

BASIC-LED BLINKING PROGRAM

Let's start with a simple program to blink an LED connected to the Arduino board.
PROCEDURE

1. Connect an LED and a current-limiting resistor (e.g., 220-330 ohms) to pin 13 (anode of
the LED) and GND (cathode of the LED).
2. Open the Arduino IDE, and select the correct board and port from the "Tools" menu.
3. Copy and paste the code into the IDE.
4. Click the "Upload" button to load the code onto the board.
5. The LED blink on and off at 1-second intervals.

CIRCUIT DIAGRAM
PROGRAM

const int ledPin = 13;

void setup() {

pinMode(ledPin, OUTPUT);

void loop() {

digitalWrite(ledPin, HIGH);

delay(1000);

digitalWrite(ledPin, LOW);

delay(1000);

EXPLANATION

We start by defining the pin where the LED is connected (pin 13 on most Arduino boards).

• The setup() function is called once when the board starts. Here, we initialize the LED pin
as an output using pinMode().
• The loop() function runs continuously as long as the board is powered. Inside the loop,
we turn the LED on, wait for a second, turn it off, and wait for another second. This
creates the blinking effect.
RESULT

Thus, the Arduino platform and the Arduino programming were studied by executing a
basic program for blinking LED.
Ex. No: 6 a) EXPLORE DIFFERENT COMMUNICATION METHODS WITH

DATE: IOT DEVICES (GSM)

AIM

To explore GSM communication methods with IoT devices.

PROCEDURE

1. Connect Arduino UNO with the computer and open Arduino IDE on the computer.
2. Select the Arduino UNO board and respective port from the tools in Arduino IDE.
3. Write a program and compile it in Arduino IDE.
4. Upload the program to Arduino UNO with the Upload option.
5. In the GSM module we need to insert the SIM card with care.
6. Give a 12V power supply to the GSM module.
7. Connect the Arduino UNO and GSM module as per the circuit diagram using jumper
wires.
8. Open Serial Monitor in Arduino IDE.

PROGRAM

To call

void setup(){

[Link](9600);

delay(10000);

[Link]("ATD +91XXXXXXXXXX;\r"); //replace xxxxxxxxxx with receiver number

delay(1000);

void loop(){

}
To SMS

void setup()

[Link](9600);

delay(2000);

[Link]("AT+CMGF=1");

delay(2000);

[Link]("AT+CMGS=\"+91XXXXXXXXXX\"\r"); //replace xxxxxxxxxx with receiver


number

delay(2000);

[Link]("HELLO FROM SIM");

delay(500);

[Link](26);

void loop()

}
CIRCUIT DIAGRAM
RESULT

Thus, the GSM communication methods with IoT devices are explored and executed.
Ex. No: 6 b) EXPLORE DIFFERENT COMMUNICATION METHODS WITH

DATE: IOT DEVICES (BLUETOOTH)

AIM
To explore Bluetooth communication methods with IoT devices.
PROCEDURE
1. Connect Arduino UNO with the computer and open Arduino IDE on the computer.
2. Select the Arduino UNO board and respective port from the tools in Arduino IDE.
3. Write a program and compile it in Arduino IDE.
4. Upload the program to Arduino UNO with the Upload option.
5. Unplug the Arduino UNO from the computer.
6. Connect the Arduino UNO and HC-05 Bluetooth module as per the circuit diagram
using jumper wires.
7. Plug the Arduino UNO in the Computer and open the Serial Monitor in Arduino IDE.
8. Install the Serial Bluetooth Terminal app from the Play Store in Mobile.
9. Pair HC-05 in the Bluetooth option on Mobile, open the Serial Bluetooth Terminal app
on mobile and connect to HC-05.
10. Now the connections are done, just send the message from mobile to Arduino or from
Arduino to mobile.

PROGRAM
#include<SoftwareSerial.h>
void setup()
{
[Link](9600); /* Define baud rate for serial communication */
}

void loop() {
while ([Link]()) /* If data is available on serial port */
{
String
m=[Link]();
[Link](m);
}
delay(100);
}

CIRCUIT DIAGRAM
RESULT
Thus, the Bluetooth communication methods with IoT devices are explored and executed.
Ex. No: 6 c) EXPLORE DIFFERENT COMMUNICATION METHODS WITH

DATE: IOT DEVICES (ZIGBEE)

AIM

To explore Zigbee communication methods with IoT devices.

PROCEDURE

1. Connect the Zigbee module to the Arduino UNO board using jumper wires.
2. Power on the Arduino UNO by connecting it to the computer.
3. Open the Arduino IDE on the computer.
4. Select the appropriate board and port for the Arduino UNO in the Arduino IDE.
5. Write a program in the Arduino IDE to communicate with the Zigbee module.
6. Compile the program in the Arduino IDE.
7. Upload the compiled program to the Arduino UNO using the Upload option.
8. Disconnect the Arduino UNO from the computer.
9. Connect the second Zigbee module to another Arduino UNO using jumper wires.
10. Power on the second Arduino UNO by connecting it to the computer.
11. Repeat steps 3-7 for the second Arduino UNO to upload the same program.
12. Once both Arduino UNO boards are programmed and powered on, the Zigbee modules
will establish communication between them wirelessly.
13. Monitor the communication between the Arduino UNO boards using the Serial Monitor
in the Arduino IDE.
14. Send and receive messages between the two Arduino UNO boards using the Zigbee
modules.
PROGRAM

TRANSMITTER

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // rx, tx

void setup() {

[Link](9600);

[Link](9600);

void loop() {

[Link]('A');

[Link]('A');

delay(100);

[Link]('B');

[Link]('B');

delay(100);

}
RECEIVER

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // rx, tx

void setup() {

[Link](9600);

[Link](9600);

pinMode(4, OUTPUT);

void loop() {

if ([Link]() > 0) {

char data = [Link]();

[Link](data);

if (data == 'A') {

digitalWrite(4, HIGH);

} else if (data == 'B') {

digitalWrite(4, LOW);

}
CIRCUIT DIAGRAM
RESULT

Thus, the Zigbee communication methods with IoT devices are explored and executed.
Ex. No: 7 INTRODUCTION TO RASPBERRY PI PLATFORM AND

DATE: PYTHON PROGRAMMING

AIM

To study the Raspberry PI Pico platform, provide an overview of Python programming,


and demonstrate a basic program for blinking a Built-In LED.

APPARATUS REQUIRED

Raspberry PI Pico

INTRODUCTION TO RASPBERRY PI PICO AND RP2040

The Raspberry Pi Pico is a microcontroller board developed by the Raspberry Pi


Foundation. It's powered by the RP2040 microcontroller, which is designed by the same
foundation. RP2040 is a dual-core ARM Cortex-M0+ microcontroller with versatile I/O pins and
hardware support for a variety of communication protocols.

PYTHON PROGRAMMING FOR RP2040

Python is an excellent choice for programming the RP2040. Its simplicity and readability make it
accessible for beginners while being powerful enough for advanced projects.

PROCEDURE

Step 1: Setup Your Environment

• Install Thonny, a Python IDE that is beginner-friendly.


• Connect your Raspberry Pi Pico to your computer using a micro USB cable.

Step 2: Write a Python Program

• Here's a basic Python program to blink an LED connected to GPIO Pin 25


PROGRAM

import machine

import utime

led = [Link](25, [Link])

while True:

[Link]()

[Link](1)

Step 3: Run the Program

• Save this program with a .py extension in Thonny.


• Click the "Run" button in Thonny.
• The LED connected to Pin 25 blink.
BOARD DIAGRAM
RESULT

Thus, the Raspberry PI Pico platform and the Python programming were studied with a
basic program for blinking LED executed.
EX. NO: 8 a) INTERFACING SENSORS WITH RASPBERRY PI

DATE: TEMPERATURE SENSOR (LM35)

AIM

To interface temperature sensor with Raspberry PI.

COMPONENTS REQUIRED

Raspberry Pico (RP2040), lm35 sensor, jumper wire and power source.

PROCEDURE

1. Connect the lm35 sensor pins with the respective pins in Raspberry PI.
2. Connect the Raspberry Pi to your computer via USB to power it up.
3. Open the Thonny software on your computer.
4. In Thonny, select the appropriate board configuration (Raspberry Pi Pico) and port (the
one your Pico is connected to) from the menu.
5. Write the Python program to read data from the LM35 sensor and display the temperature
6. Save the program to a file.
7. Run the program by clicking the "Run" or "Execute" button in Thonny.
8. Note the temperature value displayed on the console.
9. Stop the program, and click the "Stop" or "Interrupt" button within Thonny.

PROGRAM

from machine import Pin


import time
import utime
conversion_factor = 3.3/(65536)
adc2 = [Link](27)
while True:
val2 = adc2.read_u16()
temp = (val2 * conversion_factor)*100.0
temp2 = str(round(temp,2))
print("===============================")
print("Temperature: ",temp2+" °C")
[Link](0.8)

CIRCUIT DIAGRAM
RESULT

Thus, the temperature sensor (lm35) with Raspberry Pi is interfaced and executed
EX. NO: 8 b) INTERFACING SENSORS WITH RASPBERRY PI

DATE: LIGHT DEPENDENT RESISTOR (LDR)

AIM

To interface the Light Dependent Resistor (LDR) sensor with Raspberry PI.

COMPONENTS REQUIRED

Raspberry Pico (RP2040), LDR sensor, jumper wires and power source.

PROCEDURE

1. Connect the LDR sensor pins with the respective pins in Raspberry PI.
2. Connect the Raspberry Pi to your computer via USB to power it up.
3. Open the Thonny software on your computer.
4. In Thonny, select the appropriate board configuration (Raspberry Pi Pico) and port (the
one your Pico is connected to) from the menu.
5. Write the Python program to read data from the LDR sensor and to display the LDR
voltage.
6. Save the program to a file.
7. Run the program by clicking the "Run" or "Execute" button in Thonny.
8. Note the LDR voltage value displayed on the console.
9. Stop the program, and click the "Stop" or "Interrupt" button within Thonny.

PROGRAM
from machine import Pin
import time
import utime
conversion_factor = 3.3/(65536)
adc2 = [Link](28)
while True:
val2 = adc2.read_u16()
ldr = (val2 * conversion_factor)
print("===============================")
print("LDR Voltage : ",ldr)
[Link](0.8)

CIRCUIT DIAGRAM
RESULT

Thus, the Light Dependent Resistor (LDR) sensor with Raspberry Pi is interfaced and
executed.
EX. NO: 8 c) INTERFACING SENSORS WITH RASPBERRY PI

DATE: INFRARED SENSOR (IR)

AIM

To interface IR sensor with Raspberry PI.

COMPONENTS REQUIRED

Raspberry Pico (RP2040), IR sensor, jumper wire and power source.

PROCEDURE

1. Connect the IR sensor pins with the respective pins in Raspberry PI.
2. Connect the Raspberry Pi to your computer via USB to power it up.
3. Open the Thonny software on your computer.
4. In Thonny, select the appropriate board configuration (Raspberry Pi Pico) and port (the
one your Pico is connected to) from the menu.
5. Write the Python program to read data from the IR sensor and to display the IR sensor
value.
6. Save the program to a file.
7. Run the program by clicking the "Run" or "Execute" button in Thonny.
8. Note the IR sensor value displayed on the console.
9. Stop the program, and click the "Stop" or "Interrupt" button within Thonny.

PROGRAM

from machine import Pin


import time
ir_pin = Pin(28, [Link])
while True:
print("=========================")
ir_data=ir_pin.value()
print("IR_SENSOR: ",ir_data)
[Link](0.5)

CIRCUIT DIAGRAM
RESULT

Thus, the IR sensor is interfaced with Raspberry Pi and executed.


EX. NO: 8 d) INTERFACING SENSORS WITH RASPBERRY PI

DATE: INFRARED SENSOR (DHT11)

AIM

To interface the DHT11 sensor with Raspberry PI.

COMPONENTS REQUIRED

Raspberry Pico (RP2040), DHT11 sensor, jumper wire and power source.

PROCEDURE

1. Connect the DHT11 sensor pins with the respective pins in Raspberry PI.
2. Connect the Raspberry Pi to your computer via USB to power it up.
3. Open the Thonny software on your computer.
4. In Thonny, select the appropriate board configuration (Raspberry Pi Pico) and port (the
one your Pico is connected to) from the menu.
5. Write a Python program to read data from the DHT11 sensor and to display the
temperature and humidity values.
6. Save the program to a file.
7. Run the program by clicking the "Run" or "Execute" button in Thonny.
8. Note the DHT11 sensor value displayed on the console.
9. Stop the program, and click the "Stop" or "Interrupt" button within Thonny.

PROGRAM

from machine import Pin, I2C


import utime as time
from dht import DHT11

while True:
[Link](1)
pin = Pin(28, [Link])
sensor = DHT11(pin)
[Link]()
t = [Link]()
h = [Link]()
print("Temperature: {}".format(t))
print("Humidity: {}".format(h))

CIRCUIT DIAGRAM
RESULT

Thus, the DHT11 sensor is interfaced with Raspberry Pi and executed.


EX. NO: 9 COMMUNICATE BETWEEN ARDUINO AND RASPBERRY PI

DATE: USING ANY WIRELESS MEDIUM

AIM

To Communicate between Arduino and Raspberry PI using any wireless medium


(Bluetooth).

APPARATUS REQUIRED

Raspberry PI Pico (RP2040), Arduino Uno, 2 x HC-05 Bluetooth Module, Jumper Wires.

PROCEDURE

RP2040 with HC-05

1. Open the Thonny software on your computer.


2. In Thonny, select the appropriate board configuration (Raspberry Pi Pico) and port (the
one your Pico is connected to) from the menu.
3. Write the Python program to send data through Bluetooth.
4. Save the program to a file.
5. Run the program by clicking the "Run" or "Execute" button in Thonny.
6. Connect the pins from RP2040 to HC-05 as per the pin diagram.
7. You can see the message received from Arduino UNO.

Arduino with HC-05

1. Connect Arduino UNO with the computer and open Arduino IDE on the computer.
2. Select the Arduino UNO board and respective port from the tools in Arduino IDE.
3. Write a program and compile it in Arduino IDE.
4. Upload the program to Arduino UNO with the Upload option.
5. Unplug the Arduino UNO from the computer.
6. Configure the HC-05 to connect with the other HC-05.
7. Connect the Arduino UNO and HC-05 Bluetooth module as per the circuit diagram using
jumper wires.
8. Plug the Arduino UNO in the Computer and open the Serial Monitor in Arduino IDE.
9. You can see the message received from RP2040.

PROGRAM

RP2040

from utime import sleep

from machine import Pin, UART

uart = UART(0, 9600)

while True:

if [Link]() > 0:

data = [Link]()

print("Received Data :",data)

[Link](str(data))

Arduino

#include <SoftwareSerial.h>

SoftwareSerial bluetooth(2, 3); // RX, TX

void setup() {

[Link](9600);

[Link](9600);
}

void loop() {

if ([Link]()) {

char receivedData = [Link]();

[Link]("ECHO FROM RP2040 : ");

[Link](receivedData);

if ([Link]()) {

char sendData = [Link]();

[Link](sendData);

PIN DIAGRAM

RP2040 with HC-05


Arduino UNO with HC-05
RESULT

Thus, the communication between Arduino and Raspberry PI using any wireless medium
(Bluetooth) is executed.
EX. NO: 10 SETUP A CLOUD PLATFORM TO LOG THE DATA

DATE:

AIM

To set up a cloud platform to log the data.

HARDWARE & SOFTWARE TOOLS REQUIRED

1. Blynk Platform

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 THE BLYNK 2.0 APPLICATION

To display the temperature read by the temperature sensor and send it to the Blynk
platform to display the data from there.
STEP 1: Create a new account at Blynk
1. Visit [Link] and create a Blynk account on the Blynk website or you can simply
sign in using the registered Email ID
2. After the sign-in, the plan that is currently being used will be shown.

STEP 2: Create a New Template


1. Click on the Devices tab on the left side.
2. Press on the +New Template button
3. Create a new template by giving the appropriate name, hardware type and connection type.

NAME: Raspberry Pi Pico W


HARDWARE TYPE: Raspberry Pi
CONNECTION TYPE: WiFi
STEP 3: Add a new device
1. Select Create New Device or Select the Add First Device option from the Home tab

2. Give a suitable name for the device (Raspberry Pi Pico W)


3. Note down or copy the Blynk Authentication Token. It is very important.

STEP 4: Set up the dashboard


1. Go to the Web Dashboard tab from the available tabs.
2. From the widget box, drag a "Gauge" widget onto the dashboard screen.

3. Click on the "Settings" icon of the gauge widget.


4. Set up the gauge by giving it a title and creating a data stream as a virtual pin.
5. Configure the gauge settings according to your preferences and click on "Create".

6. Save the configurations.

STEP 4: Configure the Final Steps


1. Review all your settings and configurations to ensure they are correct.
2. Save your changes.
RESULT
Thus, a cloud platform to log the data has been set up successfully with Blynk.
Ex. No: 11 LOG DATA USING RASPBERRY PI AND UPLOAD TO THE
DATE: CLOUD PLATFORM

AIM
To log data using Pico and upload it to the cloud platform (Blynk)

HARDWARE & SOFTWARE TOOLS


Thonny IDE, Raspberry PI Pico Development Board, Jumper wires and Micro USB
cable.

PROCEDURE
1. Connect the LCD module to the Raspberry Pi Pico
2. Install Thonny IDE and open a new Python file to write the code.
3. Copy and paste the provided Python code into the Thonny IDE.
4. Replace the placeholder values in the code with your actual Blynk authentication token,
Wi-Fi username, and password.
5. Save the Python file with an appropriate name.
6. Connect the Raspberry Pi Pico to your computer using a micro-USB cable.
7. Run the Python script on the Raspberry Pi Pico using Thonny IDE
8. Verify that temperature data is displayed on the LCD module and uploaded to Blynk.

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

# Initialize ADC and I2C LCD


adc = ADC(Pin(28))
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
I2C_ADDR = [Link]()[0]
lcd = I2cLcd(i2c, I2C_ADDR, 2, 16)

# Initialize Wi-Fi connection


wlan = [Link](network.STA_IF)
[Link](True)
[Link]("Wifi_Username", "Wifi_Password")

# Blynk authentication token


BLYNK_AUTH = 'Your_Token'

# Initialize Blynk
blynk = [Link](BLYNK_AUTH)

# Connect to the network


wait = 10
while wait > 0:
if [Link]():
break
wait -= 1
print('waiting for connection...')
[Link](1)

# Handle connection error


if not [Link]():
raise RuntimeError('network connection failed')
else:
print('connected')
ip = [Link]()[0]
print('IP: ', ip)

# Function to read temperature


def read_temperature():
ADC_voltage = adc.read_u16() * (3.3 / (65536))
temperature_celcius = 27 - (ADC_voltage - 0.706) / 0.001721
return temperature_celcius

# Main loop
while True:
# Read temperature
temperature_celcius = read_temperature()
print("Temperature in C: {}".format(temperature_celcius))

# Display temperature on LCD


[Link]()
lcd.move_to(0, 0)
[Link]("Temp:")
[Link](str(round(temperature_celcius, 2)))
[Link]("C ")

# Send temperature data to Blynk


blynk.virtual_write(0, temperature_celcius) # Virtual pin 0 for Celsius

# Run Blynk
[Link]()

[Link](5)

NOTE
Replace 'Your_Token', 'Wifi_Username', and 'Wifi_Password' with your actual Blynk
authentication token and Wi-Fi credentials. This code reads the temperature from the sensor,
displays it on an LCD, and sends it to the Blynk platform using virtual pin 0.

OUTPUT
RESULT
Thus, using Raspberry PI log data has been uploaded to the cloud platform.

You might also like