CS3691 - EMB & IoT Lab Manual Final Copy
CS3691 - EMB & IoT Lab Manual Final Copy
SEMESTER: BATCH:
REGISTER NO:
Prepared By,
Mrs.Kiruthika.S.V
Assistant Professor
Department of ECE
Christ the King Engineering College
Karamadai, Coimbatore.
CS3691 EMBEDDED SYSTEMS AND IOT
SYLLABUS
COURSE OBJECTIVES:
LIST OF EXPERIMENTS
OUTCOMES:
EXP NO:
8051 Assembly Language program using Keil simulator
DATE
AIM:
To write 8051 Assembly Language Program for an 8-bit addition using Keil simulator and
execute it.
SOFTWARE REQUIRED:
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.
CS3691 EMBEDDED SYSTEMS AND IOT
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 .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 simulation by clicking Run or step run.8.
CS3691 EMBEDDED SYSTEMS AND IOT
PROGRAM:
ORG 0000H
CLR C
MOV A, #20H
ADD A, #21H
MOV R0, A
END
OUTPUT:
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
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:
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.
CS3691 EMBEDDED SYSTEMS AND IOT
PROGRAM:
TYPE-I:
ORG 0000H
CLR C
MOV R0, #55H
MOV R1, #6FH
MOV A, R0
MOV 30H, A
MOV A, R1
MOV 31H, A
END
OUTPUT:
CS3691 EMBEDDED SYSTEMS AND IOT
PROGRAM:
TYPE-II:
ORG 0000H
CLR C
MOV R0, #30H
MOV R1, #40H
MOV R7, #06H
BACK: MOV A, @R0
MOV @R1, A
INC R0
INC R1
DJNZ R7, BACK
END
OUTPUT:
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
ALU operations
DATE
AIM:
To write and execute the ALU program using the Keil simulator.
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 .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 simulation by clicking Run or step run.
CS3691 EMBEDDED SYSTEMS AND IOT
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
CS3691 EMBEDDED SYSTEMS AND IOT
XRL A, B
MOV 48H, A
//NOT
MOV A, #45H
CPL A
MOV 49H, A
END
OUTPUT:
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
WRITE BASIC PROGRAMS USING EMBEDDED C
DATE
AIM:
To write a basic embedded C program to control a port 0 pin 0 connected to an 8051
microcontroller using a Keil simulator.
SOFTWARE REQUIRED:
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.
CS3691 EMBEDDED SYSTEMS AND IOT
OUTPUT:
CS3691 EMBEDDED SYSTEMS AND IOT
PROGRAM:
#include<REG51.h>
int i,j;
sbit LED = P2^0;
void main()
{
while(1)
{
LED = 0;
for(j=0;j<10000;j++);
LED = 1;
for(j=0;j<10000;j++);
}
}
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
ARITHMETIC PROGRAMS USING EMBEDDED C
DATE
AIM:
To write an embedded C program for addition, subtraction, multiplication, and division
using the Keil simulator.
SOFTWARE REQUIRED:
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.
CS3691 EMBEDDED SYSTEMS AND IOT
PROGRAM:
#include<REG51.H>
unsigned char a, b;
void main()
{
a=0x10;
b=0x04;
P0=a-b;
P1=a+b;
P2=a*b;
P3=a/b;
while(1);
}
CS3691 EMBEDDED SYSTEMS AND IOT
OUTPUT:
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
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 ATmega328
Microcontroller 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.
CS3691 EMBEDDED SYSTEMS AND IOT
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 includes
6 Power pins and 2 Reset pins.
3) Arduino Mega
The Arduino Mega is based on the ATmega2560 Microcontroller. The ATmega2560 is an 8-bit
microcontroller. We need a simple USB cable to connect to the computer and the AC to DC adapter
or battery to get started with it. It has the advantage of working with more memory space. The
Arduino Mega includes 54 I/O digital pins and 16 Analog Input/Output (I/O), ICSP header, a reset
CS3691 EMBEDDED SYSTEMS AND IOT
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
INTRODUCTION TO ARDUINO PROGRAMMING
DATE
AIM:
To write and execute different Arduino programming for analog, digital signals and serial
communication.
5 Joystick Module 1
PROGRAM:
DIGITAL WRITE:
void setup() {
pinMode(2, OUTPUT);
}
void loop() {
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(2, LOW);
delay(1000);
}
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTION:
DIGITAL READ:
void setup() {
pinMode(2, OUTPUT);
pinMode(5, INPUT_PULLUP);
}
void loop() {
int sw=digitalRead(5);
if(sw==1)
{
for(int i=0; i<5; i++)
{
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(2, LOW);
delay(1000);
}
}
else
{
digitalWrite(2, LOW);
}
}
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTION:
ANALOG READ:
void setup() {
pinMode(2, OUTPUT);
Serial.begin(9600);
}
void loop() {
int joystick=analogRead(A0);
Serial.println(joystick);
if(joystick>800)
digitalWrite(2, HIGH);
else
digitalWrite(2, LOW);
delay(500);
}
CS3691 EMBEDDED SYSTEMS AND IOT
ANALOG WRITE:
void setup() {
pinMode(3, OUTPUT);
}
void loop() {
for(int i=0; i<256;i++) {
analogWrite(3,i);
delay(20);
}
for(int i=255; i>=0;i--) {
analogWrite(3,i);
delay(20);
}
}
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTION:
CONNECTION:
CONNECTION:
SERIAL COMMUNICATION:
void setup()
{
Serial.begin(9600);
pinMode(4, OUTPUT);
void loop() {
if(Serial.available()>0)
{
char data=Serial.read();
Serial.println(data);
if(data=='1'){
digitalWrite(4,HIGH);
}
else if(data=='2'){
digitalWrite(4,LOW);
}
}
}
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
AIM:
To Explore different communication methods with IoT devices (Zigbee, GSM, Bluetooth).
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.
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.
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTIONS:
PROGRAM:
#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=='1'){
digitalWrite(4,HIGH);
Serial.println("LED ON");
}
else if(data=='2'){
digitalWrite(4,LOW);
Serial.println("LED OFF");
}
}
}
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTIONS:
TRANSMITTER:
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);
}
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTIONS:
RECEIVER:
Arduino UNO Pin Zigbee Module Arduino Development Board
- 5V 5V
- G GND
2 Tx -
3 Rx -
4 - LED1
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);
}
}
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
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.
CS3691 EMBEDDED SYSTEMS AND IOT
RP2040 Microcontroller:
At the core of the Raspberry Pi Pico W is the RP2040 microcontroller. It features a dual-core ARM
Cortex-M0+ processor running at 133MHz, providing ample processing power for a wide range of
applications. The microcontroller also includes 264KB of SRAM, which is essential for storing and
manipulating data during runtime. Additionally, the RP2040 incorporates 2MB of onboard flash
memory for program storage, ensuring sufficient space for your code and firmware.
Wireless Connectivity:
The standout feature of the Raspberry Pi Pico W is its built-in wireless connectivity. It includes an
onboard Cypress CYW43455 Wi-Fi chip, which supports dual-band (2.4GHz and 5GHz) Wi-Fi
802.11b/g/n/ac. This allows the Pico W to seamlessly connect to wireless networks, communicate
with other devices, and access online services. The wireless capability opens up new avenues for IoT
projects, remote monitoring and control, and real-time data exchange.
Pico W is compatible with C/C++ programming, allowing experienced developers to leverage the
rich ecosystem of libraries and frameworks available.
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.
CS3691 EMBEDDED SYSTEMS AND IOT
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
INTRODUCTION TO PYTHON PROGRAMMING
DATE
AIM:
To learn about the evolution, core features, general characteristics and applications of Raspberry
THEORY:
The Raspberry Pi is a credit card sized computer that can connect to a huge variety of sensors and
other modules like LCD displays, servos, and motors. The Raspberry Pi is a low-cost, low power
consumption, credit-card-sized single-board computer. After some initial setup, you can connect
it to a computer or TV monitor and start using it. Aside from a monitor, the Raspberry Pi will also
need a mouse and keyboard, unless you decide to set it up in headless mode. In headless mode you
only need a computer and a USB cable to use the Raspberry Pi.
Fig: Raspberry Pi
The Raspberry Pi has 40 GPIO pins to connect external peripherals or sensors. The abundance of
GPIO pins allows the Raspberry Pi to be used as a control center for more complex projects like
robots and autonomous vehicles. Finally, the Raspberry Pi relies on a Broadcom BCM2835
System on a Chip (SoC). An SoC is an integrated circuit that has all the components necessary to
power a computer. On the Raspberry Pi, the Broadcom chip contains a 700MHz ARM processor
and a video core 4 GPU.
CS3691 EMBEDDED SYSTEMS AND IOT
USES OF RASPBERRY PI
There are so many things you can make with a Raspberry Pi. And due to its extreme popularity,
the number of third-party sensors, modules, and code libraries has grown to epic proportions. This
has greatly expanded the possible applications for the Raspberry Pi. The applications really are
endless, but here are some common ones:
Web servers
Sensor control
Robotics control
Data processing
THE RASPBERRY PI OS
There are several different operating systems available for use on the Raspberry Pi, but the
Raspberry Pi OS (formerly Raspbian) is the most popular. The Raspberry Pi OS is based on the
Debian release of Linux. Linux is great for critical applications because it focuses on security and
stability instead of mainstream operating systems that focus on ease of use. Linux is also
lightweight and less resource intensive than commercial operating systems. The Raspberry Pi OS
has two different versions – a version with a desktop and command line interface, or a lightweight
version with just a command line interface.
• Another way to write and run python programs is through the terminal. To access the
terminal, click on the terminal icon up the top left-hand corner.
• Type the following command: nano helloworld.py
• Enter the following code
• Press CTRL+O to save
• Press CTRL+X to exit
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
INTERFACING SENSORS WITH RASPBERRY PI
DATE
AIM:
To interface the IR sensor and Ultrasonic sensor with Raspberry Pico.
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
PROGRAM:
GPIO.setmode(GPIO.BOARD)
GPIO.setup(sensor,GPIO.IN)
GPIO.setup(buzzer,GPIO.OUT)
GPIO.output(buzzer,False)
print "IR Sensor Ready ....
try:
while True:
if GPIO.input(sensor):
GPIO.output(buzzer,True)
print "Object Detected"
while GPIO.input(sensor):
time.sleep(0.2)
else:
GPIO.output(buzzer,False)
except KeyboardInterrupt:
GPIO.cleanup()
CS3691 EMBEDDED SYSTEMS AND IOT
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
AIM:
To write and execute the program to Communicate between Arduino and Raspberry PI
using any wireless medium (Bluetooth)
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
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);
}
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTIONS:
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')
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTIONS:
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
Ex. No:
SETUP A CLOUD PLATFORM TO LOG THE DATA
Date:
AIM:
To set up a cloud platform to log data from Arduino and Raspberry Pi to use cloud services like
Amazon Web Services (AWS), Google Cloud Platform (GCP), or Microsoft Azure.
THEORY:
If you don't have an AWS account, sign up for one at https://aws.amazon.com/. AWS offers a free
tier with limited usage, which is suitable for small-scale projects.
AWS IoT Core is a managed cloud service that allows you to connect devices to the cloud. You
can use it to securely communicate with your Arduino and Raspberry Pi.
a. In the AWS Management Console, navigate to the AWS IoT Core service.
b. Create a new IoT Thing for each of your devices (Arduino and Raspberry Pi) and generate
security certificates and policies to enable secure communication.
Install the necessary libraries and scripts on your devices to establish MQTT or HTTP(S)
communication with AWS IoT Core. AWS provides SDKs and documentation for various
programming languages.
a. Create an Amazon S3 bucket to store your data. This is where your data will be logged.
b. Create an AWS Lambda function to process incoming data and store it in your S3 bucket. You
can trigger this Lambda function when data is sent to AWS IoT Core.
c. Configure AWS IoT Core to route incoming data to the Lambda function.
You can set up data visualization and analysis tools to make sense of your data. AWS offers
services like Amazon Quick Sight or Amazon Sage Maker for this purpose.
Set up monitoring and alerts using AWS CloudWatch to keep an eye on your data logging system's
health and performance. This is a high-level overview, and the exact steps may vary depending on
the cloud platform you choose. You can follow similar steps on other cloud platforms like Google
Cloud or Azure, but the specific services and configurations will be different. Make sure to review
the documentation and pricing details of the cloud platform you choose to understand the costs
associated with data storage and data transfer to ensure it aligns with your project's requirements
and budget.
PROGRAM:
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for CopyLogEntries
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.
CS3691 EMBEDDED SYSTEMS AND IOT
# [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import logging_v2
# [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_async]
CS3691 EMBEDDED SYSTEMS AND IOT
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO: 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
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'
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTIONS:
"Connection to Blynk"
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
CS3691 EMBEDDED SYSTEMS AND IOT
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") time.sleep(5)
blynk.virtual_write(3, temperature_celcius)
blynk.virtual_write(4, temp_fahrenheit)
blynk.log_event(temperature_celcius)
blynk.run() time.sleep(5)
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
Design an IOT-based system
DATE
AIM:
To design a Smart Home Automation IOT-based system
5 LED or Relay 1
PROGRAM:
import time
import network
import BlynkLib
from machine import Pin
led=Pin(16, Pin.OUT)
wlan = network.WLAN()
wlan.active(True)
wlan.connect("Wifi_Username","Wifi_Password")
BLYNK_AUTH = 'Your_Token'
CONNECTIONS:
"Connection to Blynk"
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
RESULT:
CS3691 EMBEDDED SYSTEMS AND IOT