8051 Assembly & Arduino Programming Guide
8051 Assembly & Arduino Programming Guide
GSM, Bluetooth)
medium
AIM:
To write an 8051AssemblyLanguageprogramtomove a hexadecimal integer to the
Accumulator and validate the results in the register window using the Keil simulator.
PROCEDURE:
1. Createnewuvisionproject.
2. Selectthefolder (newlycreated) to savetheproject.
3. Savetheproject.
4. Selectthevendor “Atmel”anddevice“AT89C51”.
5. AdditionofSTARTUP.A51toprojectfolder.
6. STARTUP.A51isadded.
7. TypetheRequiredProgram.
8. SavetheProgram [Link].
9. Prgm.asmistobeaddedtoSourceGroup1.
10. Selectthefilenow it isadded toSourceGroup1.
11. Buildthetargetandthen debugthetarget.
12. Newwindowevaluationmodeappeared. Clickok
13. Verify the program output by clicking step option or [Link] can be viewed in
theregisterwindo
PROGRAM:
org 0000h
mov a, #2h
mov r0,#4h
mova,r0
end
OUTPUTSCREENSHOT:
RESULT:
Thus the 8051 Assembly language for an 8 bit Addition using Keil Simulator is executed
successfully.
EXPNO :2 TEST DATA TRANSFER BETWEEN REGISTERS AND MEMORY
DATE:
AIM:
To write an assembly language program to test the data transfer between registers and memory
using Keil Simulator.
PROCEDURE:
1. Createnewuvisionproject.
2. Selectthefolder (newlycreated) to savetheproject.
3. Savetheproject.
4. Selectthevendor “Atmel”anddevice“AT89C51”.
5. AdditionofSTARTUP.A51toprojectfolder.
6. STARTUP.A51isadded.
7. TypetheRequiredProgram.
8. SavetheProgram [Link].
9. Prgm.asmistobeaddedtoSourceGroup1.
10. Selectthefilenow it isadded toSourceGroup1.
11. Buildthetargetandthen debugthetarget.
12. Newwindowevaluationmodeappeared. Clickok.
13. Modifythememoryaddressbyrightclickingattheparticularhexadecimalnumberandgivetheap
propriate datato thememoryaddress.
14. [Link]
owand in memorywindow at thebottom.
PROGRAM:
ORG 0000HMOV
R0,#40H
MOV R1,#50H
MOVR3,#03H
BACK:MOV A,@R0
MOVB,@R1
MOV @R0,B
MOV @R1,AINCR0
INCR1
DJNZ R3,BACK
END
SCREENSHOTASSIGNINGDATA IN MEMORYADDRESSOF40,41, 42&50,51, 52.
SCREENSHOTOFSWAPPINGOFDATATRANSFERBETWEEN42 &52.
RESULT:
Thus the Assembly language Program to transfer data between register and memory was
executed successfully.
EXP NO:3 PERFORM ALU OPERATIONS.
DATE:
AIM:
To write an 8051 Assembly Language program and Perform ALU operations (Addition,
subtraction,Divisionand Multiplication) usingKeil simulator.
PROCEDURE:
1. Createnewuvisionproject.
2. Selectthefolder (newlycreated) to savetheproject.
3. Savetheproject.
4. Selectthevendor “Atmel”anddevice“AT89C51”.
5. AdditionofSTARTUP.A51toprojectfolder.
6. STARTUP.A51isadded.
7. TypetheRequiredProgram.
8. SavetheProgram [Link].
9. Prgm.asmistobeaddedtoSourceGroup1.
10. Selectthefilenow it isadded toSourceGroup1.
11. Buildthetargetandthen debugthetarget.
12. Newwindowevaluationmodeappeared. Clickok
13. Verify the program output by clicking step option or [Link] can be viewed in
theregister window and in memory window at the bottom (only for multiplication and
divisionoperations).
PROGRAM:
ADDITION SUBTRACTION
ORG ORG
0000HMOVA 000HMOV
,#40HMOV A,#40HMOV
B,#41HADD B,#41HSUBB
A,BMOV42H A,BMOV42H
,A ,A
END END
MULTIPLICATION DIVISION
ORG ORG
0000HMOVA, 000HMOV A,
#40HMOV B, #40HMOV B,
#41HMUL #41HDIVAB
ABMOV MOV
42H,AMOV 42H,AMOV
A,BMOV43H, A,BMOV43
A H,A
END END
OUTPUTSCREENSHOTOFADDITION
OUTPUTSCREENSHOTOFSUBTRACTION
OUTPUTSCREENSHOTOFMULTIPLICATION
OUTPUTSCREENSHOTOFDIVISION
RESULT:
Thus we executed the Perform ALU operations
EXPNO:4 WRITE BASIC AND ARITHMETIC PROGRAMS USING EMBEDDED C.
DATE:
AIM:
Towrite a basic arithmetic program (for performing Addition, subtraction, Division and
Multiplication) using Embedded C in Keil Simulator.
PROGRAM:
#
include<reg51.h>voidmain(v
oid)
{
unsigned charx,y,z,a,b,c; //define
variablesx=0x12; //first8-bitnumber
y=0x34; //second8-bitnumber
P0=0x00; //declareport0asoutputport
P1=0x00; //declareport1asoutputport
P2=0x00; //declareport2asoutputport
P3=0x00; //declareport3asoutputport
z=x+y; //performaddition
P0=z; //displayresult of addition on port 0
a=y-x; //performsubtraction
P1=a; //displayresultof subtraction onport 1
b=x*y; //performmultiplication
P2=b; //displayresultof multiplicationon port2
c=y/x; //performdivision
P3=c; // display result of division on port
3while(1);
}
PROCEDURE:
1. Createnewuvisionproject.
2. Selectthefolder (newlycreated) to savetheproject.
3. Savetheproject.
4. Selectthevendor “Atmel”anddevice“AT89C51”.
5. AdditionofSTARTUP.A51toprojectfolder.
6. STARTUP.A51isadded.
7. TypetheRequiredProgram.
8. [Link].
9. Prgm.CistobeaddedtoSourceGroup1.
10. Selectthefilenow it isadded toSourceGroup1.
11. Buildthetargetandthen debugthetarget.
12. Newwindowevaluationmodeappeared. Clickok
13. Verify the program output by clicking step option or [Link] can be viewed in
theregisterwindow
14. InperipheralsI/OPorts Port0displaysresultAddition
Port1displaysresultSubtraction
Port2displaysresultofmultiplication
Port3displaysresultofdivision
OUTPUTSCREENSHOTOFPARALLEL PORT0ADDITION
OUTPUTSCREENSHOTOFPARALLEL PORT1SUBTRACTION
OUTPUTSCREENSHOTOFPARALLEL PORT2MULTIPLICATION
OUTPUTSCREENSHOTOFPARALLEL PORT3DIVISION
RESULT:
Thus the Basic and arithmetic Programs Using Embedded C was Executed successfully.
INTRODUCTION TO ARDUINO PLATFORM AND PROGRAMMING
Inexpensive-Arduinoboardsarerelativelyinexpensivecomparedtoothermicrocontrollerplatforms. The
least expensive version of the Arduino module can be assembled by hand, and eventhepre-assembled
Arduino modules costveryless.
Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX,
andLinuxoperatingsystems. Most microcontroller systemsarelimited toWindows.
Simple,clearprogrammingenvironment-TheArduinoSoftware(IDE)iseasy-to-useforbeginners, yet
flexible enough for advanced users to take advantage of as well. For teachers, it'sconveniently based
on the Processing programming environment, so students learning to program inthatenvironment will
be familiarwith how theArduinoIDEworks.
Open source and extensible software - The Arduino software is published as open source
tools,available for extension by experienced programmers. The language can be expanded through
C++libraries, and people wanting to understand the technical details can make the leap from Arduino
tothe AVR C programming language on which it's based. Similarly, you can add AVR-C code
directlyintoyour Arduino programs ifyou wantto.
Open source and extensible hardware - The plans of the Arduino boards are published under
aCreative Commons license, so experienced circuit designers can make their own version of
themodule, extending it and improving it. Even relatively inexperienced users can build the
breadboardversionofthe moduleinorder tounderstand howit works and savemoney.
ArduinoIDE:
A toolchain is a set of programming tools that is used to perform a complex set of [Link] the
Arduino Software (IDE) the toolchain is hidden from the user, but it is used to compile
[Link],assembler, linkerandStandardC&mathlibraries.
The Arduino Integrated Development Environment (IDE) is a software application used to write,
compile, and upload code to Arduino-compatible microcontroller boards. It provides a user-friendly interface for
programming and prototyping electronic projects.
ArduinoUNOboard
ScreenshotofArduinoIDE
ScreenshotofIDE’sStatusmessages
Processing Power and Memory: The ESP32 is significantly more powerful and has more
memorythan the Arduino Uno. This makes it capable of handling more complex tasks and managing
multipleoperationssimultaneously.
Operating Voltage: Arduino Uno operates at 5V, while the ESP32 operates at 3.3V. This
couldimpacttheselection ofcompatiblecomponents for your project.
Built-in Connectivity: The ESP32 comes with built-in Wi-Fi and Bluetooth, making it an
excellentchoice for IoT projects. On the other hand, Arduino Uno doesn't have built-in connectivity,
but youcanadd thesecapabilities usingshields.
Analog Input Pins: The ESP32 has more analog inputs, making it a better choice for
projectsrequiringmultiple analog sensors.
EaseofUse:Arduinoisgenerallyconsideredeasiertogetstartedwithandhasavastcommunityandalot of
resources,which can behelpful forbeginners.
AdvantagesofESP32 overArduino:
More Processing Power: ESP32 has a more powerful CPU. It features a dual-core
TensilicaXtensaLX6,whichcanrunupto240MHz,whiletheArduinoUnorunsanATmega328Pat16MHza
ndtheMegarunsan ATmega2560 at 16 MHz.
More Memory: ESP32 comes with significantly more RAM (520KB) compared to typical
Arduinoboards(2KBfor Uno, 8KBfor Mega).This allows formore complexapplications.
WirelessConnectivity:OneofthemajoradvantagesoftheESP32isthebuilt-inWi-FiandBluetooth 4.2
(including BLE), which is crucial for IoT projects. Arduino boards don't have built-
inwirelessconnectivity, requiringadditional components or shields.
MoreGPIO:TheESP32hasmoregeneral-purposeinput/output(GPIO)pins,allowingittointerface with a
larger number of sensors and devices. The ESP32 has 34 GPIO pins, while theArduinoUno has 14,
andthe Megahas 54.
Analog Inputs and Outputs: ESP32 has more analog input channels and also features two 8-
bitDACchannels, whichArduino Uno lacks.
Lower Operating Voltage: ESP32 operates at a voltage of 3.3V, which is beneficial when
workingwithsensors ordevices that also operateat 3.3V.
Deep Sleep Mode: The ESP32 has a deep sleep mode for power saving, consuming less than
10uA,whichmakes it abetter choiceforbattery-powered projects.
The choice between Arduino and ESP32 depends on the specific requirements of your project. For
simpletasks and ease of use, an Arduino could be a good choice. But for tasks requiring more processing
power,memory,or built-in Wi-Fi and Bluetooth, theESP32 would beamore fittingchoice.
StepstoinstallESP32boardin [Link]:
OpenyourArduinoIDE, thengotoFile>Preferences
Enter[Link] the “Additional Board
ManagerURLs” field. Click OK
GotoTools >Board >Boards Manager open theBoards Managers
Search“ESP32”then pressinstallbutton for“ESP32by Espressif Systems”
Inthe fewsecondsyour ESP32boardinstallationshouldbedone.
Now, we can go to the next step which is setting communication port, as ESP32 board has USB to
UARTconverter that needs to be installed for serial data communication between ESP32 and your
computer. Youmaywanttodownloaditfrom[Link]
drivers
Next,youshould:
PlugESP32toyourcomputer
OpenyourArduinoIDE, thengoTools>Boardmenu.
SelecttheTypeofESPboardavailable.
EXP NO: INTRODUCTION TO ARDUINO PLATFORM AND PROGRAMMING
DATE:
AIM:
To write and execute different Arduino programming for analog, digital signals and serial
communication.
5 Joystick Module 1
PROCEDURE:
1. Give the connections as per the circuit diagram.
2. Connect the ESP32kitto PC using USB.
3. Type the program in the IDE compiler.
4. Verify the program by compiling and upload it to ESP32 by selecting the ports.
5. Now the LED may blink as per the delay given in the coding.
PROGRAM:
intledPin = 2;
voidsetup()
{
pinMode(ledPin, OUTPUT);
}
voidloop()
{digitalWrite(ledPin,HIGH);
delay(1000);digitalWrite(ledPin,
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);
}
CONNECTION:
ANALOG READ:
void setup() {
pinMode(2, OUTPUT);
[Link](9600);
}
void loop() {
int joystick=analogRead(A0);
[Link](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++) {
analogWrite(3,i); delay(20);
}
for(int i=255; i>=0;i--) {
analogWrite(3,i); delay(20);
}
}
CONNECTION:
SERIAL COMMUNICATION:
void setup() {
[Link](9600);
pinMode(4, OUTPUT);
}
void loop() {
if([Link]()>0)
{
char data=[Link]();
[Link](data);
if(data=='1'){
digitalWrite(4,HIGH);
}
else if(data=='2'){
digitalWrite(4,LOW);
}
}
}
RESULT:
Thus the Arduino programming written for analog, digital signals and serial
communication was excuted.
EXP NO: 6 (a) EXPLORE DIFFERENT COMMUNICATION METHODS WITH IOT DEVICES
DATE : (BLUETOOTH)
PROCEDURE:
CONNECTIONS:
#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=='1'){
digitalWrite(4,HIGH);
[Link]("LED ON");
}
else if(data=='2'){
digitalWrite(4,LOW);
[Link]("LED OFF");
}
}
}
RESULT:
Thus a program has been written for connecting the Bluetooth of ESP32 controller to a external Bluetooth
device and it was implemented for sending and receiving data using Arduino IDE platform
EXP NO:6(B)
ZIGBEE COMMUNICATION
DATE
AIM:
To write a program to control an LED using a Zigbee module.
5 Zigbee Module 2
PROCEDURE
CONNECTIONS:
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);
}
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() {
[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);
}
}
.
RESULT:
Thus a program has been written for connecting the zigbee of ESP32 controller to a
external zigbee device and it was implemented for sending and receiving data using Arduino
IDE platform
EXP NO: 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.
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.
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 Micro Python was designed to work under
constrained conditions.
Because of that, Micro Python 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.
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.
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 [Link]
2. Download the version for Windows and wait a few seconds while it downloads.
3. Run the .exe file.
4. Follow the installation wizard to complete the installation process. You just need to click “Next”.
5. After completing the installation, open Thonny IDE. A window as shown in the following figure
should open.
CONNECTIONS:
LED:
from machine import Pin
import time
LED = Pin(16, [Link])
while True:
[Link](1)
[Link](1)
[Link](0)
[Link](1)
CONNECTIONS:
RGB:
from machine import Pin
from time import sleep_ms,sleep
r=Pin(16,[Link])
y=Pin(17,[Link])
g=Pin(18,[Link])
while True:
[Link](1)
sleep_ms(1000)
[Link](0)
sleep_ms(1000)
[Link](1)
sleep(1)
[Link](0)
sleep(1)
[Link](1)
sleep(1)
[Link](0)
sleep(1)
CONNECTIONS:
PROGRAM:
sleep(0.5)
\
RESULT:
Thus the Raspberry Pi and phython program was studied and written.
EXP NO:
INTERFACING SENSORS WITH RASPBERRY PI
DATE
AIM:
To interface the IR sensor and Ultrasonic sensor with Raspberry Pi.
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
CONNECTIONS:
PROGRAM:
IR Sensor:
from machine import Pin
from time import sleep
buzzer=Pin(16,[Link])
ir=Pin(15,[Link])
while True:
ir_value=[Link]()
if ir_value== True:
print("Buzzer OFF")
[Link](0)
else:
print("Buzzer ON")
[Link] (1)
sleep(0.5)
CONNECTIONS:
def measure_distance():
[Link]()
utime.sleep_us(2)
[Link]()
utime.sleep_us(5)
[Link]()
while [Link]() == 0:
signaloff = utime.ticks_us()
while [Link]() == 1:
signalon = utime.ticks_us()
while True:
dist = measure_distance()
print(f"Distance : {dist} cm")
if dist <= 10:
[Link](1)
[Link](0.01)
else:
[Link](0)
[Link](0.01)
[Link](0.5)
RESULT:
Thus the IR sensor and Ultrasonic sensor with Raspberry Pi was interfaced.
EXP NO: 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
CONNECTIONS:
MASTER
ARDUINO:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
[Link](9600);
}
void loop() {
[Link]('A');
delay(1000);
[Link]('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, [Link])
while True:
if [Link]() > 0:
data = [Link]()
print(data)
if "A" in data:
[Link](1)
print('LED on \n')
[Link]('LED on \n')
elif "B" in data:
[Link](0)
print('LED off \n')
[Link]('LED off \n')
CS3691 EMBEDDED SYSTEMS AND IOT
RESULT:
Thus the program was written and to Communicate between Arduino and Raspberry PI
using any wireless medium was excuted.
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
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 [Link] 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.
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
CS3691 EMBEDDED SYSTEMS AND IOT
To control the LED with a mobile App or Mobile Dashboard, you also need to setup the Mobile
Phone Dashboard. The process is similarly explained above.
Install the Blynk app on your smartphone The Blynk app is available for iOS and Android.
Download and install the app on your smartphone. then need to set up both the Mobile App and the
Mobile Dashboard in order to control the LED with a mobile device. The process is explained
above.
RESULT:
Thus the cloud platform to log the data from IoT devices was settuped..
CS3691 EMBEDDED SYSTEMS AND IOT
AIM:
To write and execute the program Log Data using Raspberry PI and upload it to the cloud
platform
CONNECTIONS:
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 = [Link](4)
i2c=I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
I2C_ADDR=[Link]()[0]
lcd=I2cLcd(i2c,I2C_ADDR,2,16)
wlan = [Link]()
[Link](True)
[Link]("Wifi_Username","Wifi_Password")
BLYNK_AUTH = 'Your_Token'
"Connection to Blynk"
# Initialize Blynk
CS3691 EMBEDDED SYSTEMS AND IOT
blynk = [Link](BLYNK_AUTH)
[Link]()
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)
[Link]("Temp:")
[Link](str(round(temperature_celcius,2)))
[Link]("C ")
lcd.move_to(0,1)
[Link]("Temp:")
[Link](str(round(temp_fahrenheit,2)))
[Link]("F")
[Link](5)
blynk.virtual_write(3, temperature_celcius)
blynk.virtual_write(4, temp_fahrenheit)
blynk.log_event(temperature_celcius)
[Link]()
[Link](5)
CS3691 EMBEDDED SYSTEMS AND IOT
RESULT:
Thus the the program was written and Log Data using Raspberry PI and upload it to the
cloud platform was excuted.
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
CONNECTIONS:
PROGRAM:
import time
import network
import BlynkLib
from machine import Pin
CS3691 EMBEDDED SYSTEMS AND IOT
led=Pin(16, [Link])
wlan = [Link]()
[Link](True)
[Link]("Wifi_Username","Wifi_Password")
BLYNK_AUTH = 'Your_Token'
"Connection to Blynk"
# Initialize Blynk
blynk = [Link](BLYNK_AUTH)
RESULT:
Thus the Smart Home Automation IOT-based system was designed.
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT
CS3691 EMBEDDED SYSTEMS AND IOT