Eiot Lab Manual
Eiot Lab Manual
EQUIPMENTS REQUIRED:
Algorithm:
1. Copy the first operand in the A register.
2. Complement the content of A register.
3. Increment the accumulator content. It is equal to the 2’scomplement operation.
4. Initialize DPTR with external Memory location 9000
5. Move the result which is in A to the specified memory location by DPTR
6. Stop the program Execution.
FLOWCHART:
Start
GetthedatainA
Movetheresultinspecifiedmemoryby
Stop
1
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
8001 56H 9000 AAH
PROCEDURE:
RESULT:
Thus the ALP program for 2’s Complement was executed successfully and the output
was verified.
2
8051 PROGAMS USING SIMULATOR
1B. SQUARING OF TWO 8 BIT DATA
AIM:
To write an ALP for Square of 8 bit data and execute the program using 8051
Micro controller Simulator.
EQUIPMENTS REQUIRED:
1. PC with 8051 micro controller simulator
ALGORITHM:
1. Copy the first immediate oper and with pound symbol to the A register.
2. Copy the registers oper and to the B register.
3. Initialize the R0 as carry register to store the carry.
4. Multiply the content of A and B register. Default the result is stored in A and B registers.
5. Store the sum in the specified memory location which is represented by DPTR
6. The sum in A and B register. It is copied in the specified memory location 9000 and
9001.
7. Stop the program.
FLOWCHART:
Start
Getthe1stdatainA
CopytheAvalueinB
MULAandB
InitializeDPTRwith9000
Movethehigherbyteofsum
IncrementtheDPTR
Movethelowerbyteofsum
Stop
3
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
9000H 40H(lower
8001 08H
byte of sum)
9001H 00H(higher
8003 08H
byte of sum)
RESULT:
Thus the program for Squaring of two 8 bit data was executed successfully and the output
was verified.
4
1C. UNPACKED BCD TO ASCII
AIM:
To convert unpacked BCD to ASCII using 8051 micro controller Simulator.
EQUIPMENTS REQUIRED:
1. PC with 8051 micro controller Simulator.
ALGORITHM:
1. Initialize DPTR with a memory address and Move the value of A to B.
2. Perform AND and OR operation between the given contents and A value.
3. Increment DPTR and move the value of DPTR to A.
4. Move the value of A to B. perform AND operation.
5. Swap the contents and perform OR operation.
6. Increment DPTR and move the value of DPTR to A.
7. Using SJMP instruction, terminate the program.
5
OUTPUT
INPUT: MEMORYADDRESS DATA
PROCEDURE:
1. Open the 8051 Simulator which is installed in the Desktop.
2. Open New file and write the ALP Program.
3. Go to menu–choose Assemble-click assemble.
4. Go to menu—choose view-click output. You will see the 0warning error and 0
errors. (I e., Compile the Program)
5. Go to menu–choose simulate—click simulate. (Execute the Program)
6. Go to menu—choose view-click Register, Direct Memory, External Memory one by
one and note the output value.
RESULT:
Thus the unpacked BCD is converted into ASCII number, executed successfully and the
output was verified using 8051 micro controller.
6
2.TEST DATA TRANSFER BETWEEN REGISTERS AND MEMORY
AIM:
To write the instruction for data transfer between registers and memory and verify the data in
the corresponding register and memory.
EQUIPMENTS REQUIRED:
PC with 8051 Simulator
THEORY:
In 8051 Microcontroller there is 28 different instructions under the Data Transfer Group. In
total there are 79 opcodes. The flags are not affected by using the data transfer instructions, but the P
(Parity) flag may change if the value of A register is changed using Data Transfer Instruction. If the
Clock Frequency is 12MHz, then 1 machine cycle will take 1 µs for execution.
7
RESULT:
The assembly language program was to exchange successfully bytes of data from location
A:30h to location B:40h
8
2(A). Write an assembly language program to find the largest element ina
given array of N =h bytes at location 4000h. Store the largest element at
location 4062h.
AIM:
To Write an assembly language program to find the largest element in a given array.
Before Execution:
After Execution:
RESULT:
The assembly language program was to the largest element in a given array was successfully and
output verified .
9
3.PERFORM ALU OPERATIONS-8051 PROGAMS USING SIMULATOR
BASIC ARITHMETIC AND LOGICAL OPERATIONS
3A.ADDITION WITHCARRY
AIM:
To write an ALP for addition of two 8bit data with Carry and execute the program using
8051 Microcontroller Simulator.
EQUIPMENTS REQUIRED:
1. PC with 8051 micro controller Simulator.
ALGORITHM:
1. Copy the first immediate operand with pound symbol to the A register.
2. Copy the second immediate operand with pound symbol to the B register.
3. Initialize the R0 as carry register to store the carry.
4. Add the content of A and B registers. Default the result is stored in A register.
5. If carry exist increment the R0 register.
6. If no Carry, store the sum and carry in the specified memory location which is
represented by DPTR
7. The sum in A register. It is copied in the specified memory location 9000.
8. The carry in R0register.It is copied in the specified memory location 9002.
9. Stop the program.
10
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
8001 44H(AL) 9000 66H(sum)
PROCEDURE:
11
FLOW CHART:
Start
Getthe1stdatainA
Getthe2nddatainB
InitializecarryregisterR0
Add a and b
If
borrow YES Increment CX
No
InitializeDPTRwith9000
Storethedifferenceinmemory
IncrementtheDPTR
MovethecarryinR0toA
MovethecarryinAto9001
Stop
12
RESULT:
Thus the program for addition of two 8bit data with carry was executed successfully
and the output was verified.
13
8051 PROGAMS USING KITS
3. BASIC ARITHMETIC AND LOGICAL OPERATIONS
3B.Subtraction with borrow
AIM:
To write an ALP for Subtraction of two 8bit data with borrow and execute the program
Using 8051 Microcontroller simulator.
EQUIPMENTS REQUIRED:
1. 8051microcontroller kit
2. Keyboard
3. Connecting probes
ALGORITHM:
1. Copy the first immediate operand with pound symbol to the A register.
2. Copy the second immediate operand with pound symbol to the B register.
3. Initialize the R0 as carry register to store the carry.
4. Subtract the content of B from A registers. Default the result is stored in A register.
5. If borrow exist increment the R0 register.
6. If no Carry, store the sum and carry in the specified memory location which is
represented by DPTR
7. The sum in A register. It is copied in the specified memory location 9000.
8. The borrow which in R0 register. It is copied in the specified memory location 9001.
9. Stop the program.
14
FLOWCHART:
Start
Getthe1stdatainA
Getthe2nddatainB
InitializecarryregisterR0
SubtractAandB
If
borrow YES Increment CX
No
InitializeDPTRwith9000
Storethedifferenceinmemory
IncrementtheDPTR
MovetheborrowinR0toA
MovethecarryinAto9001
Stop
15
I/P&O/PVerificationTable:
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
8001 44H(AL) 9000 22H(difference)
8003 22H(AH) 9001 00H(borrow)
PROCEDURE:
RESULT:
Thus the program for Subtraction of two 8bit data with borrow was executed
successfully and the output was verified.
16
8051PROGAMSUSING KITS
3. BASICARITHMETICANDLOGICALOPERATIONS
3C.Multiplication
AIM
To write an ALP for Multiplication of two 8 bit data and execute the program using 8051
Micro controller using Simulator.
EQUIPMENTS REQUIRED:
1. PC with 8051 micro controller Simulator
ALGORITHM:
1. Copy the first immediate operand with pound symbol to the A register.
2. Copy the second immediate operand with pound symbol to the B register.
3. Multiply the content of A and B registers. Default the result is stored in A and B register.
4. Store the sum in the specified memory location which is represented by DPTR
5. The sum in A and B register. It is copied in the specified memory location 9000 and
9001.
6. Stop the program.
17
FLOWCHART:
Start
Getthe1stdatainA
Getthe2nddatainB
MultiplyAandB
InitializeDPTRwith9000
Movethehigherbyteof sum
IncrementtheDPTR
Movethelowerbyteofsum
Stop
PROCEDURE:
18
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
9000 0CH(lowerbyte
8001 04H
of sum)
9001 00H(higher
8003 03H
byteofsum)
RESULT:
Thus the program for multiplication of two 8bit data was executed successfully and the
output was verified.
19
8051 PROGAMS USING KITS
3. BASIC ARITHMETIC AND LOGICAL OPERATIONS
3D. Division
AIM
To write an ALP for Division of two 8bit data and execute the program using 8051
Microcontroller.
EQUIPMENTS REQUIRED:
1. PC with 8051 micro controller Simulator
ALGORITHM:
1. Copy the first immediate operand with pound symbol to the A register.
2. Copy the second immediate operand with pound symbol to the B register.
3. Initialize the R0 as carry register to store the carry.
4. Divide the content of A and B registers. Default the result is stored in A and B register.
5. If carry exist increment the R0 register.
6. If no Carry, store the sum and carry in the specified memory location which is
represented by DPTR
7. The quotient and remainder which is in A and B register. It is copied in the specified
memory location 9000 and 9001.
8. The carry in R0 register. It is copied in the specified memory location 9002.
9. Stop the program.
20
FLOWCHART:
Start
Getthe1stdatainA
Getthe2nddatainB
Initializecarryregister R0
DivideAandB
If
borrow YES Increment CX
No
InitializeDPTRwith9000
Storethedifferenceinmemory
IncrementtheDPTR
MovethequotientandremainderwhichisinAandB
MovethecarryinRoto9002
Stop
21
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
8001 04H 9000 02H(quotient)
8003 02H 9001 00H(Remainder)
RESULT:
Thus the program for Division of two 8bit data was executed successfully and the
output was verified.
22
3E. LOGICAL AND
AIM
To write an ALP for logical AND operation and execute the program using 8051
Microcontroller simulator.
EQUIPMENTS REQUIRED:
ALGORITHM:
1. Copy the first operand in the A register.
2. Copy the Second operand in the B register.
3. Using the logical AND instruction, AND operation between two contents of A and
B and result store in the A register.
4. Initialize DPTR with external Memory location 9000
5. Move the result which is in A to the specified memory location by DPTR
6. Stop the program Execution.
23
FLOWCHART:
Start
GetthefirstdatainA
GettheseconddatainB
LogicalANDoperationisperformedonthecontentof AandB
MovetheresultinspecifiedmemorybyDPTR
Stop
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
8001 56H 9000 12H
8004 12H
RESULT:
Thus the ALP program for Logical AND was executed successfully and the output was
Verified.
24
3F. LOGICAL OR
AIM
To write an ALP for logical OR operation and execute the program using 8051
Microcontroller Simulator.
EQUIPMENTS REQUIRED:
ALGORITHM:
1. Copy the first operand in the A register.
2. Copy the Second operand in the B register.
3. Using the logical OR instruction, OR operation between two contents of A and B
and result store in the A register.
4. Initialize DPTR with external Memory location9000
5. Move the result which Is in A to the specified memory location by DPTR
6. Stop the program Execution.
25
FLOWCHART:
Start
GetthefirstdatainA
GettheseconddatainB
LogicalORoperationisperformedonthecontentofAandB
MovetheresultinspecifiedmemorybyDPTR
Stop
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
8001 56H 9000 56H
8004 12H
RESULT:
AIM
To write an ALP for logical XOR operation and execute the program using 8051
Microcontroller Simulator.
EQUIPMENTSREQUIRED:
ALGORITHM:
27
FLOW CHART:
Start
GetthefirstdatainA
GettheseconddatainB
LogicalXORoperationisperformedonthecontentofAandB
MovetheresultinspecifiedmemorybyDPTR
Stop
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
8001 56H 9000 44H
8004 12H
RESULT:
ThustheALPprogramforLogicalXORwasexecutedsuccessfullyandtheoutput was
verified.
28
3H. LOGICAL NOT
AIM
To write an ALP for logical NOT operation and execute the program using 8051
Microcontroller Simulator.
EQUIPMENTS REQUIRED:
ALGORITHM:
1. Copy the first operand in the A register.
2. Complement the content of A register.
3. Initialize DPTR with external Memory location 9000
4. Move the result which is in A to the specified memory location by DPTR
5. Stop the program Execution.
29
FLOWCHART:
Start
GetthedatainA
ComplementthecontentofAregister.
MovetheresultinspecifiedmemorybyDPTR
Stop
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
ADDRESS ADDRESS
8001 56H 9000 A9H
RESULT:
Thus the ALP program for Logical NOT wasexecuted successfully and the output was
verified.
30
4. WRITE BASIC PROGRAMS USING EMBEDDED C PROGRAM
AIM
To develop an embedded ‘C’ program for Implementation of specific tasks using Ports, Timers,
USART for 8051 Microcontroller.
APPARATUSREQUIRED
8051 Simulator- Keil C
Flow Chart
31
RESULT:
Thus the embedded C program for basic timers port was executed successfully and the output
was verified.
32
5.INTRODUCTION TO ARDUNIO PLATFORM AND PROGRAMMING
AIM:
To learn about the Board, core features, general characteristics and applications of
Arduino Uno.
THEORY
One of the most popular Arduino boards out there is the Arduino Uno. While it was not actually the
first board to be released, it remains to be the most actively used and most widely documented on the
market. Because of its extreme popularity, the Arduino Uno has a ton of project tutorials and forums
around the web that can help you get started or out of a jam. We’re big fans of the Uno because of its
great features and ease of use.
Introduction to Arduino Uno:
• Arduino Uno is a microcontroller board, developed by Arduino.cc, based on the Atmega328
microcontroller and is marked as the first Arduino board developed(UNO means “one” inItalian).
• The software used for writing, compiling & uploading code to Arduino boards is calledArduino
IDE(Integrated Development Environment), which is free to download from Arduino Official
Site.
• It has an operating voltage of 5Vwhile the input voltage may vary from 7Vto 12V.
• Arduino UNO has a maximum current rating of 40mA, so the load shouldn’t exceed this current
rating or you may harm the board.
• It comes with a crystal oscillatorof16MHz, which is its operating frequency.
33
• Arduino Uno Pin out consists of 14 digital pins starting from D0 to D13.
• It also has 6 analog pins starting from A0 to A5.
• It also has1Reset Pin, which is used to reset the board programmatically. In order to reset the
board, we need to make this pin LOW.
• Italsohas6Power Pins, which provide different voltage levels.
• Out of 14digital pins, 6 pins are used for generating PWM pulses of 8-Bit resolution. PWM pins
in Arduino UNO are D3, D5, D6, D9, D10 and D11.
• ArduinoUNOcomeswith3 types of memories associated with it, named:
• Flash Memory: 32KB, SRAM:2KB, EEPROM:1KB
• Arduino UNO supports 3 types of communication protocols ,used for interfacing with third-
party peripherals, named:
▪ Serial Protocol, I2C Protocol, SPI Protocol
RESULT:
The core features, general characteristics and the applications of Arduino UNO processors has
been studied.
34
5(a). BLINKING LED USING ARDUINO UNO WITH DIFFERENT DELAY
AIM:
To develop a ‘C’ program to make the LED blink (including delay routine). Upon changing the delay
program the speed should vary using Arduino uno.
APPARATUSREQUIRED:
• Personal Computer
• Arduino Uno Board.
• Arduino.cc IDE Software.
• USB cable.
PROCEDURE:
1. Open Arduino IDE Software and Selecting the board Arduino UNO
2. Go to tools and Select the right portex:COM-3
3. Type the Program in Editor page and Save it
4. Compile the Program and Upload the program into the Board
5. Verify the Output
OUTPUT
RESULT:
The C-Language program to make the LED blink was developed and output was verified. Upon
change in the delay program the speed variation was verified using Arduino Uno.
35
5(b). CONTROLLED USINGS WITH IN ARDUINO UNO
AIM:
To develop a ‘C ’program to make the LEDON/OFF using switch. Upon change in the switch the LED
should ON/OFF.
APPARATUS REQUIRED:
• Personal Computer
• Arduino Uno Board.
• Arduino.cc IDE Software.
• USB cable.
PROCEDURE:
1. Open Arduino IDE Software and Selecting the board Arduino UNO
2. Go to tools and Select the right portex:COM-3
3. Type the Program in Editor page and Save it
4. Compile the Program and Upload the program in to the Board
5. Verify the Output
OUTPUT:
RESULT:
The C-Language program to make the LED ON/OFF using switch was developed and output
was verified.
36
6. EXPLORE DIFFERENT COMMUNICATION METHODS WITH IOT DEVICES-
BLUETOOTH
AIM
To write an Embedded C program to explore different communication methods with IoT devices
APPARATUSREQUIRED
• Arduino IDE
• ESP32 Devkit C board
• USBA / mini USB B cable
• Bluetooth Module
PROCEDURE
37
OUTPUT:
38
OUTPUT:
RESULT:
Thus the Embedded C program to explore different communication methods with IoT devices
was executed successfully and the output was verified.
39
7.INTRODUCTION TO RASPBERRY PI PLATFORM AND PYTHON PROGRAMMING
TRAFFIC LIGHT CONTROL USING ARDUINO UNO (SINGLE LANE)
AIM:
To develop a ‘C’ program to make the single lane Traffic Light Control using Ardino UNO.
APPARATUS REQUIRED:
• Personal Computer
• Arduino Uno Board.
• Arduino.cc IDE Software.
• USB cable.
PROCEDURE:
1. Open Arduino IDE Software and Selecting the board Arduino UNO
2. Go to tools and Select the right port ex: COM-3
3. Type the Program in Editor page and Save it
4. Compile the Program and Upload the program in to the Board
5. Verify the Output
OUTPUT :
RESULT:
The C-Language program to make the Single Lane Traffic Light Control was developed and output
was verified.
40
8. INTERFACING SENSORS WITH RASPBERRYPI
AIM
APPARATUSREQUIRED
• RaspberryPi-4
• Micro python- Thonny
• DHT11sensor
PROCEDURE
41
CONNECTION
OUTPUT
RESULT:
Thus the python programming to interface DHT11Sensor with Raspberry Pi was executed
successfully and the output was verified.
42
9.COMMUNICATE BETWEEN ARDUNIO AND RASPBERRYPI USING ANY
WIRELESSMEDIUM
AIM:
To develop a C-Language program to detect an object with Ultrasonic sensor using Arduino UNO.
APPARATUSREQUIRED:
• Personal Computer
• Arduino Uno Board.
• Arduino.cc IDE Software.
• Ultrasonic Sensor
• USB cable.
PROCEDURE:
1. Open Arduino IDE Software and Selecting the board Arduino UNO
2. Go to tools and Select the right port ex: COM-3
3. Type the Program in Editor page and Save it
4. Compile the Program and Upload the program into the Board
5. Verify the Output
43
OUTPUT:
Distance = 5 cm
Distance = 40 cm
Distance=100cm
RESULT:
The C program detect and find the distance of an object with Ultrasonic sensor was developed
and output was verified.
44
9(a) . Automatic Street Light Control using LDR Sensorwith
Arduino UNO
AIM:
To develop a ‘C’ program for Automatic Street Light Control using LDR Sensor with Arduino
UNO.
APPARATUS REQUIRED:
• Personal Computer
• Arduino Uno Board.
• LM393Light-Dependent Resistor(LDR)
• LED(Generic)
• Bread Board
• Jumper Wires.
• Arduino.cc IDE Software.
• USB cable.
PROCEDURE:
1. Open Arduino IDE Software and Selecting the board Arduino UNO
2. Go to tools and Select the right port ex: COM-3
3. Type the Program in Editor page and Save it
4. Compile the Program and Upload the program in to the Board
5. Verify the Output
45
OUTPUT:
RESULT:
The C-Language program for Automatic Street Light Control using LDR Sensor was developed
and output was verified.
46
10. SETUPACLOUDPLATFORMTOLOGTHE DATA
THEORY
The Node MCU (Node Micro Controller Unit) is open-source software and hardware
development environment built around an inexpensive System-on-a-Chip (SoC) called the ESP8266.
The ESP8266, designed and manufactured by Express if Systems, contains the crucial elements of a
computer: CPU, RAM, networking (WiFi), and even a modern operating system and SDK. That makes
it an excellent choice for Internet of Things (IoT) projects of all kinds.
This level of integration is not a problem using the ESP8266 as an embedded controller chip in
mass-produced electronics. It is a huge burden for hobbyists, hackers, or students who want to
experiment with it in their own IoT projects.
47
Power Pins:
• There are four power pins. VIN pin and three3.3V pins.
• VIN can be used to directly supply the Node MCU/ESP8266 and its peripherals. Power
delivered on VIN is regulated through the onboard regulator on the Node MCU module – you
can also supply 5V regulated to the VIN pin
• 3.3V pins are the output of the onboard voltage regulator and can be used to supply power to
external components.
• GND are the ground pins of Node MCU/ESP8266
• I2C Pin sare used to connect I2C sensors and peripherals. Both I2C Master and I2C Slave are
supported. I2C interface functionality can be realized programmatically, and the clockfrequency
is 100 kHz at a maximum. It should be noted that I2C clock frequency should be higher than the
slowest clock frequency of the slave device.
48
• GPIO Pins: Node MCU/ESP8266 has 17 GPIO pins which can be assigned to functions such as
I2C, I2S, UART, PWM, IR Remote Control, LED Light and Button programmatically. Each
digital enabled GPIO can be configured to internal pull-up or pull-down, or set to high
impedance. When configured as an input, it can also be set to edge-trigger or level-trigger to
generate CPU interrupts.
• ADC Channel: The Node MCU is embedded with a 10-bit precision SAR ADC. The two
functions can be implemented using ADC. Testing power supply voltage of VDD3P3 pin and
testing input voltage of TOUT pin. However, they cannot be implemented at the same time.
• UART Pins: Node MCU/ESP8266 has 2 UART interfaces (UART0 and UART1) which
provide asynchronous communication (RS232 and RS485), and can communicate at up to 4.5
Mbps. UART0 (TXD0, RXD0, RST0 & CTS0 pins) can be used for communication. However,
UART1 (TXD1 pin) features only data transmit signal so, it is usually used for printing log.
• SPI Pins: Node MCU/ESP8266 features two SPIs (SPI and HSPI) in slave and master modes.
These SPIs also support the following general-purpose SPI features: 4 timing modes of the SPI
format transfer Up to 80 MHz and the divided clocks of 80 MHz, Up to 64-Byte FIFO
• SDIO Pins: Node MCU/ESP8266 features Secure Digital Input/Output Interface (SDIO) which
is used to directly interface SD cards. 4-bit 25 MHz SDIO v1.1 and 4-bit 50 MHz SDIO v2.0are
supported.
• PWM Pins: The board has 4 channels of Pulse Width Modulation (PWM). The PWM output
can be implemented programmatically and used for driving digital motors and LEDs. PWM
frequency range is adjustable from 1000 μs to 10000 μs (100 Hz and 1 kHz).
• Control Pins: are used to control the Node MCU/ESP8266. These pins include Chip Enable pin
(EN), Reset pin (RST) and WAKE pin.
• EN: The ESP8266 chip is enabled when EN pin is pulled HIGH. When pulled LOW the chip
works at minimum power.
• RST: RST pin is used toresettheESP8266 chip.
• WAKE: Wake pin is used to wake the chip from deep-sleep.
• Tiny Sine: Wave Control Pins are used to control the Node MCU/ESP8266. These pins include
Chip Enable pin (EN), Reset pin (RST) and WAKE pin.
49
BLYNKAPP SETTINGS:
RESULT:
The C-Language program to make the LED ON/OFF with Blynk platform using Arduino
Node MCU was developed and output was verified.
50
11. LOGDATAUSINGRASPBERRYPIANDUPLOADTOTHECLOUDPLATFORM
AIM
To write an python programming to Log Data using Raspberry PI and upload to the cloud
platform
APPARATUSREQUIRED
• RaspberryPi-4
• Micro python- Thonny
• DHT sensor
• Ubidots IoT Platform
PROCEDURE
1. With your Raspberry Pi connected to the internet, verify the IP address assigned to the board
access using ssh in your computer's terminal: ssh pi@{IP_Address_assigned}
2. Now let's upgrade some packages and install pip, Python's packet manager.
sudo apt-get update
sudoapt-getupgrade
sudoapt-get install python-pip python-dev build-essential
3. Then, install Request library, which is a popular Python library that simplifies making HTTP
requests..
$ pip install requests
4. Type sudonanoexp11_ubidots.pyand click Enter. A new file will open. Sending data to Ubi dots for
visualization- include header file. Make sure to replace the Ubi dots token with your account
token, and assign your Ubi dots account token in the request URL.
5. TypethegivenprogramandsaveitbypressingCtrl+O,thenpressEnterthenpress Ctrl+X.
6. Now run the script in your computer's terminal sudo python exp11_ubidots.py. If it is working
properly, you will see a new device in your Ubi dots account with two variables: temperature
and humidity.
51
CONNECTIONS
OUTPUT
RESULT
Thus the python programming to Log Data using Raspberry PI and upload to the cloud platform
was executed successfully and the output was verified.
52
12.DESIGN AN IOT BASED SYSTEM
AIM
To write an Embedded C program to explore different communication methods with IoT devices
APPARATUSREQUIRED
• Arduino IDE
• ESP32DevkitCboard
• USBA / mini USB B cable
• Ubi dots library
• Ubi dots account
PROCEDURE
• To publish and get your value using Ubi dots, open the Arduino IDE and type the Embedded
C code. Once you have typed the code, you must assign your unique Ubi dots TOKEN, SSID
(WiFi Name) and Password of the available network, Device Label of the device which
contains the variable to want to subscribe to and Variable Label of the variable you want to
subscribe to.
• Verify your code with in the Arduino IDE. To do this, in the top left corner four ArduinoIDE
you will see the "Check Mark" icon; press it to verify your code.
• Upload the code into your ESP 32 Dev Module .To do this ,choose the "right- arrow"
icon beside the "check mark" icon.
• To verify the connectivity of the device and the data sent, open the serial monitor by
selecting the "magnifying glass" icon in the top right corner of the Arduino IDE to seethe
connectivity logs.
• In the serial monitor, you will be able to see the last value received in Ubi dots of the
variable specified in the firmware
OUTPUT:
53
RESULT
Thus the python Embedded C program to explore different communication methods with IoT
devices was executed successfully and the output was verified.
54