EIoT Manual
EIoT Manual
AIM:
To write 8051 Assembly Language Program for an 8-bit addition using Keil simulator and
execute it.
SOFTWARE REQUIRED:
To start writing a new program, you need to create a new project. Navigate to project —> New
µVision project. Then save the new project in a folder.
After saving the file, a new window will pop up asking you to select your microcontroller.
Select ‘Yes’ in the next pop-up, as we do not need this file in our project.
Our project workspace is now ready!
From here, we need to create a file where we can write our C code. Navigate to File —> New. Once the
file is created, save it with .c extension in the same project folder.
Next, we have to add that .c or .asm file to our project workspace. Select Add Existing Files and
then select the created .c or .asm file to get it added.
1
IThe workspace and project file are ready.
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.
PROGRAM:
ORG 0000H
CLR C
MOV A, #20H
ADD A, #21H
MOV R0, A
END
2
RESULT:
Thus 8051 Assembly Language Experiment using Simulator has been executed and verified
Successfully.
3
EXP NO:2
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.
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
4
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
RESULT:
Thus, the Assembly language program to transfer data between registers and memory was
executed and verified successfully.
5
EXP NO:3
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.
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
6
//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
7
8
RESULT:
Thus, the ALU program using the Keil simulator was executed and verified successfully.
9
EXP NO:4a
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.
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++);
}
}
10
RESULT:
Thus, the basic embedded C program to control a port 0 pin 0 connected to an 8051
microcontroller using a Keil simulator was simulated and executed successfully.
11
EXP NO:4b
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.
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);
}
12
RESULT:
Thus, the embedded C program for addition, subtraction, multiplication, and division using the
Keil simulator was simulated and verified successfully.
13
EXP NO:5a
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.
14
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.
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
15
o Tmega328 Microcontroller- It is a single-chip Microcontroller of the ATmel family. The processor
code inside it is of 8-bit. It combines Memory (SRAM, EEPROM, and Flash), Analog to Digital
Converter, SPI serial ports, I/O lines, registers, timers, external and internal interrupts, and
oscillator.
o ICSP pin - The In-Circuit Serial Programming pin allows the user to program using the firmware of
the Arduino board.
o TX and RX LED's- The successful flow of data is represented by the lighting of these LED's.
o AREF- The Analog Reference (AREF) pin is used to feed a reference voltage to the Arduino UNO
board from the external power supply.
o Reset button- It is used to add a Reset button to the connection.
o USB- It allows the board to connect to the computer. It is essential for the programming of the Arduino
UNO board.
o Crystal Oscillator- The Crystal oscillator has a frequency of 16MHz, which makes the Arduino
UNO a powerful board.
o Voltage Regulator- The voltage regulator converts the input voltage to 5V.
o GND- Ground pins. The ground pin acts as a pin with zero voltage.
o Vin- It is the input voltage.
o Analog Pins- The pins numbered from A0 to A5 are analog pins. The function of Analog pins is to
read the analog sensor used in the connection. It can also act as GPIO (General Purpose Input Output)
pin.
RESULT:
Thus, the study on basics of Arduino Uno board and Arduino IDE 2.0 software was studied
successfully.
16
EXP NO:5b
INTRODUCTION TO ARDUINO PROGRAMMING
DATE
AIM:
To write and execute different Arduino programming for analog, digital signals and serial
communication.
5 Joystick Module 1
PROCEDURE:
CONNECTION:
PROGRAM:
DIGITAL WRITE:
void setup() {
pinMode(2, OUTPUT);
}
17
void loop() {
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(2, LOW);
delay(1000);
}
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);
}
}
18
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);
}
CONNECTION:
ANALOG WRITE:
void setup() {
pinMode(3, OUTPUT);
}
void loop() {
for(int i=0; i<256;i++) {
19
analogWrite(3,i);
delay(20);
}
for(int i=255; i>=0;i--) {
analogWrite(3,i);
delay(20);
}
}
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);
}
}
}
20
DIGITAL READ & WRITE
21
RESULT:
Thus the Arduino programming for analog, digital signals and serial Communication has been
executed and verified Successfully.
22
EXP NO:6a DIFFERENT COMMUNICATION METHODS WITH IOT
DEVICES (ZIGBEE, GSM, BLUETOOTH)
DATE
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.
23
RESULT:
Thus the Explore different communication methods with IoT devices (Zigbee, GSM, Bluetooth)
has been done Successfully.
24
EXP NO:6b
BLUETOOTH COMMUNICATION
DATE
AIM:
To write a program to control an LED using a Bluetooth module.
PROCEDURE
CONNECTIONS:
25
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");
}
}
}
26
RESULT:
Thus the program to control an LED using a Bluetooth module has been verified and executed
Successfully
27
EXP NO:6c
ZIGBEE, GSM COMMUNICATION
DATE
AIM:
To write a program to control an LED using a Zigbee module.
5 Zigbee Module 2
PROCEDURE
CONNECTIONS:
TRANSMITTER:
28
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);
}
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);
}
29
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:
Thus the program to control an LED using a Zigbee module has been verified and executed
Successfully.
30
EXP NO:7a INTRODUCTION TO THE RASPBERRY PI
DATE PLATFORM
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.
31
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.
32
Pico W is compatible with C/C++ programming, allowing experienced developers to leverage the
rich ecosystem of libraries and frameworks available.
As with all Raspberry Pi products, the Pico W benefits from the vibrant and supportive Raspberry Pi
community. Raspberry Pi provides extensive documentation, including datasheets, pinout diagrams,
and programming guides, to assist developers in understanding the board’s capabilities. The
community offers forums, online tutorials, and project repositories, allowing users to seek help, share
knowledge, and collaborate on innovative project.
33
The Raspberry Pi Pico W brings wireless connectivity to the popular Raspberry Pi Pico
microcontroller board. With its powerful RP2040 microcontroller, built-in Wi-Fi chip, extensive
GPIO capabilities, and compatibility with MicroPython and C/C++ programming, the Pico W offers
a versatile and affordable platform for a wide range of embedded projects. Whether you are a
beginner or an experienced developer, the Raspberry Pi Pico W provides a user-friendly and flexible
platform to bring your ideas to life and explore the exciting world of wireless IoT applications.
RESULT:
Thus, the study on Introduction To The Raspberry PI Platform was studied successfully.
34
EXP NO:7b
INTRODUCTION TO PYTHON PROGRAMMING
DATE
What is MicroPython?
MicroPython is a Python 3 programming language re-implementation targeted for microcontrollers
and embedded systems. MicroPython is very similar to regular Python. Apart from a few exceptions,
the language features of Python are also available in MicroPython. The most significant difference
between Python and MicroPython is that MicroPython was designed to work under constrained
conditions.
Because of that, MicroPython does not come with the entire pack of standard libraries. It only
includes a small subset of the Python standard libraries, but it includes modules to easily control and
interact with the GPIOs, use Wi-Fi, and other communication protocols.
Thonny IDE:
Thonny is an open-source IDE which is used to write and upload MicroPython programs to different
development boards such as Raspberry Pi Pico, ESP32, and ESP8266. It is extremely interactive and
easy to learn IDE as much as it is known as the beginner-friendly IDE for new programmers. With
the help of Thonny, it becomes very easy to code in Micropython as it has a built-in debugger that
helps to find any error in the program by debugging the script line by line.
You can realize the popularity of Thonny IDE from this that it comes pre-installed in Raspian OS
which is an operating system for a Raspberry Pi. It is available to install on r Windows, Linux, and
Mac OS.
35
A) Installing Thonny IDE – Windows PC
Thonny IDE comes installed by default on Raspbian OS that is used with the Raspberry Pi board.
To install Thonny on your Windows PC, follow the next instructions:
1. Go to https://thonny.org
2. Download the version for Windows and wait a few seconds while it downloads.
Follow the installation wizard to complete the installation process. You just need to click “Next”.
4. After completing the installation, open Thonny IDE. A window as shown in the following figure
should open.
CONNECTIONS:
PROGRAM
LED:
from machine import Pin
import time
LED = Pin(16, Pin.OUT)
while True:
LED.value(1)
time.sleep(1)
LED.value(0)
time.sleep(1)
CONNECTIONS:
36
RGB:
from machine import Pin
from time import sleep_ms,sleep
r=Pin(16,Pin.OUT)
y=Pin(17,Pin.OUT)
g=Pin(18,Pin.OUT)
while True:
r.value(1)
sleep_ms(1000)
r.value(0)
sleep_ms(1000)
y.value(1)
sleep(1)
y.value(0)
sleep(1)
g.value(1)
sleep(1)
g.value(0)
sleep(1)
CONNECTIONS:
37
sleep(2)
led.value (0)
sleep(2)
led.value (1)
sleep(2)
led.value(0)
sleep(2)
else:
print("LED OFF")
sleep(0.5)
RESULT:
Thus, the study on Introduction to Python Programming was studied successfully.
38
EXP NO:8
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
5 IR Sensor 1
6 Ultrasonic sensor 1
PROCEDURE
CONNECTIONS:
39
PROGRAM:
IR Sensor:
from machine import Pin
from time import sleep
buzzer=Pin(16,Pin.OUT)
ir=Pin(15,Pin.IN)
while True:
ir_value=ir.value()
if ir_value== True:
print("Buzzer OFF")
buzzer.value(0)
else:
print("Buzzer ON")
buzzer.value (1)
sleep(0.5)
CONNECTIONS:
ULTRASONIC SENSOR:
from machine import Pin, PWM
import utime
trigger = Pin(14, Pin.OUT)
echo = Pin(15, Pin.IN)
buzzer = Pin(16, Pin.OUT)
def measure_distance():
trigger.low()
utime.sleep_us(2)
trigger.high()
utime.sleep_us(5)
trigger.low()
while echo.value() == 0:
40
signaloff = utime.ticks_us()
while echo.value() == 1:
signalon = utime.ticks_us()
while True:
dist = measure_distance()
print(f"Distance : {dist} cm")
if dist <= 10:
buzzer.value(1)
utime.sleep(0.01)
else:
buzzer.value(0)
utime.sleep(0.01)
utime.sleep(0.5)
RESULT:
Thus the interface the IR sensor and Ultrasonic sensor with Raspberry Pico has been verified and
executed Successfully.
41
EXP NO:9 COMMUNICATE BETWEEN ARDUINO AND
DATE RASPBERRY PI
AIM:
To write and execute the program to Communicate between Arduino and Raspberry PI
using any wireless medium (Bluetooth)
1 Thonny IDE 1
2 Raspberry Pi Pico Development Board 1
3 Arduino Uno Development Board 1
4 Jumper Wires few
5 Micro USB Cable 1
6 Bluetooth Module 2
PROCEDURE
CONNECTIONS:
42
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);
}
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()
43
print(data)
if "A" in data:
led.value(1)
print('LED on \n')
uart.write('LED on \n')
elif "B" in data:
led.value(0)
print('LED off \n')
uart.write('LED off \n')
RESULT:
Thus the program to Communicate between Arduino and Raspberry PI using any wireless
medium (Bluetooth) has been verified and executed Successfully.
44
EXP NO:10
CLOUD PLATFORM TO LOG THE DATA
DATE
AIM:
To set up a cloud platform to log the data from IoT devices.
1 Blynk Platform 1
CLOUD PLATFORM-BLYNK:
Blynk is a smart platform that allows users to create their Internet of Things applications without the
need for coding or electronics knowledge. It is based on the idea of physical programming & provides
a platform to create and control devices where users can connect physical devices to the Internet and
control them using a mobile app.
Step 1: Visit blynk.cloud and create a Blynk account on the Blynk website. Or you can simply sign
in using the registered Email ID.
Step 3: Give any name to the Template such as Raspberry Pi Pico W. Select ‘Hardware Type’ as
Other and ‘Connection Type’ as WiFi.
45
Select a New Device from ‘Template
Select the device from a template that you created earlier and also give any name to the device. Click
on Create.
A new device will be created. You will find the Blynk Authentication Token Here. Copy it as it is
necessary for the code.
46
Step 5: Now go to the dashboard and select ‘Web Dashboard’.
From the widget box drag a switch and place it on the dashboard screen.
Step 6: On the switch board click on Settings and here you need to set up the Switch. Give any title to
it and Create Datastream as Virtual Pin.
47
With this Blynk dashboard set up, you can now proceed to program the Raspberry Pi Pico W board
to control the LED.
Step 7: To control the LED with a mobile App or Mobile Dashboard, you also need to setup the
Mobile Phone Dashboard.
Install the Blynk app on your smartphone The Blynk app is available for iOS and Android. Download
and install the app on your smartphone. then need to set up both the Mobile App and the Mobile
Dashboard in order to control the LED with a mobile device. The process is explained above.
48
RESULT:
Thus the set up a cloud platform to log the data from IoT devices has been verified and executed
Successfully.
49
EXP NO:11 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.
3 Jumper Wires 1
PROCEDURE
CONNECTIONS:
50
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'
"Connection to Blynk"
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
lcd.clear()
51
while True:
ADC_voltage = adc.read_u16() * (3.3 / (65536))
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:
Thus the program Log Data using Raspberry PI and upload it to the cloud platform has been
verified and executed Successfully.
52
EXP NO:12
Design an IOT-based system
DATE
AIM:
To design a Smart Home Automation IOT-based system
3 Jumper Wires 1
5 LED or Relay 1
PROCEDURE
CONNECTIONS:
Raspberry Pi Raspberry Pi
Pico Pin Pico Development
Board
GP16 LED 1
53
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'
54
"Connection to Blynk"
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
RESULT:
Thus To design a Smart Home Automation IOT-based system has been verified and executed
Successfully.
55
ADDITIONAL PROGRAM
56
EXP NO:13
LCD DISPLAY, SERVO MOTOR, STEPPER MOTOR
DATE USING RASPBERRY Pi
Aim:
To design a LCD display system using Raspberry Pi.
3 Jumper Wires 1
PROCEDURE
LCD DISPLAY:
while True:
lcd.move_to(3,0)
lcd.putstr("Ediylabs")
sleep(5)
lcd.clear()
DHT 11 Sensor:
Connection
pwm =
PWM(Pin(1))
pwm.freq(50)
while True:
for position in
range(1000,9000,50):
pwm.duty_u16(position)
sleep(0.01)
for position in
range(9000,1000,-50):
pwm.duty_u16(position)
sleep(0.01)
Connection
STEPPER MOTOR:
from machine
import Pin from
time import sleep
IN1=Pin(12,Pin,OUT)
IN2 = Pin(13,Pin.OUT)
IN3 = Pin(14,Pin.OUT)
IN4 = Pin(15,Pin.OUT)
sequence = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]
while True:
for step in sequence:
for i in
range(len(pins
)):
pins[i].value(s
tep[i])
sleep(0.001)
Connection
RESULT:
Thus LCD Display, Servo Motor, Stepper Motor Using Raspberry Pi has been verified
and executed Successfully.