CCS3691
CCS3691
CCS3691
RECORD
NAME
REGISTER NUMBER
YEAR III
SEMESTER V
PRACTICAL RECORD
BONAFIDE CERTIFICATE
REGISTER NUMBER
VISION
To lead the way in interdisciplinary education, shaping the next generation of technology-driven business
leaders by seamlessly integrating computer science and business principles, to empower students to address
societal challenges through innovation and entrepreneurial skills
MISSION
1. Provide holistic education that bridges the gap between the fields of computer science and business
systems, empowering students with a solid foundation in various domains and promoting innovative methods in
research and academics.
2. Establish strong partnerships with industries to provide conceptual knowledge that enables experiential
learning for students in the ever-changing industry landscape.
3. Offer comprehensive technology training to ensure that students are proficient in the latest tools and
methodologies crucial for success in the fields of computer science and business systems.
PROGRAM EDUCATIONAL OBJECTIVES(PEOs)
To ensure graduates will be proficient in utilizing the fundamental knowledge of basic sciences, mathematics,
Computer Science and Business systems for the applications relevant to various streams of Engineering and
Technology.
▪ To enrich graduates with the core competencies necessary for applying knowledge of computer science
and Data analytics tools to store, retrieve, implement, and analyze data in the context of business
enterprise to empower entrepreneurial skills
▪ To enable graduates through comprehensive technology training to gain employment in organizations
and establish themselves as professionals by applying their technical skills and leadership qualities to
solve societal problems and meet the diversified needs of industry, academia, and research.
PROGRAM SPECIFIC OUTCOMES (PSOs)
▪ To create, select, and apply appropriate techniques, resources, modern engineering, and business
tools including prediction and data analytics to complex engineering activities & business solutions.
▪ To evolve computer science domain specific methodologies for effective decision making in several
critical problem domains of the real world.
▪ To be able to apply entrepreneurial skills and management tools for identifying, analyzing, and
creating business opportunities with smart business ideas.
PROGRAM OUTCOMES (POs)
COURSE OBJECTIVES:
❖ To learn the internal architecture and programming of an embedded processor.
❖ To introduce interfacing, I/O devices to the processor.
❖ To introduce the evolution of the Internet of Things (IoT).
❖ To build a small low-cost embedded IoT system using Arduino/Raspberry Pi/ open platform.
❖ To apply the concept of the Internet of Things in real-world scenario.
PRACTICAL EXERCISES:
6. Explore different communication methods with IoT devices (Zigbee, GSM, Bluetooth)
11. Log Data using Raspberry PI and upload to the cloud platform
1.
Write 8051 Assembly Language experiments using
simulator.
2. Test data transfer between registers and memory.
3.
Perform ALU operations.
4.
Write Basic and arithmetic Programs Using Embedded C
5.
Introduction to Arduino platform and programming
6.
Explore different communication methods with IoT
devices (Zigbee, GSM, Bluetooth)
AIM:
To write an 8051 Assembly Language Program for an 8-bit addition using Keil
simulator and execute it.
SOFTWARE REQUIRED:
Keil μvision5 IDE
INTRODUCTION TO 8051 SIMULATORS:
A simulator is software that will execute the program and show the results exactly to the
program running on the hardware, if the programmer finds any errors in the program while
simulating the program in the simulator, he can change the program and re-simulate the code
and get the expected result, before going to the hardware testing. The programmer can
confidently dump the program in the hardware when he simulates his program in the simulator
and gets the expected results.
8051 controller is a most popular 8-bit controller which is used in a large number of embedded
applications and many programmers write programs according to their application. So testing
their programs in the software simulators is a way. Simulators will help the programmer to
understand the errors easily and the time taken for the testing is also decreased.
These simulators are very useful for students because they do not need to build the complete
hardware for testing their program and validate their program very easily in an interactive way.
List of 8051 Simulators:
The list of simulators is given below with their features:
1. MCU 8051: MCU 8051 is an 8051 simulator that is very simple to use and has an
interactive IDE (Integrated Development Environment). It is developed by Martin
Osmera and most important of all is that it is completely free. There are many
features for this IDE they are,
a. It supports both C and assembly language for compilation and simulation
b. It has an in-built source code editor, graphical notepad, ASCII charts, Assembly
symbol viewer, etc. It also supports several 8051 ICs like at89c51, A89S52,
8051, 8052, etc.
c. It will support certain electronic simulations like LED, 7 segment display, LCD
etc. which will help in giving the output when you interface these things to the
hardware directly.
d. It has tools like hex decimal editors, base converters, special calculator, file
converters, inbuilt hardware programmers, etc.
e. It has syntax validation, pop base auto-completion etc.
You can download this tool from https://sourceforge.net/projects/mcu8051ide/files/.
1
2. EDSIM 51: This is a virtual 8051 interfaced with virtual peripherals like 7 segment
display, motor, keypad, UART etc. This simulator is exclusively for students developed by
James Rogers,. The features of this simulator are
● Have virtual peripherals like ADC, DAC with scope to display, comparator etc.
● supports only assembly language
● IDE is completely written in JAVA and supports all the OS.
● Completely free and with user guide, examples, etc.
You can download this simulator from the https://www.edsim51.com/index.html.
3. 8051 IDE: This simulation software is exclusively for the Windows operating system
(98/xp). The features of this simulator are
Text editor, assembler, and software simulate in one single program.
has facilities like Breakpoint setter, execute to break point, predefined simulator watch
window, etc.
It is available in both free version and paid version.
You can download this tool from https://www.acebus.com/win8051.htm
4. KEIL µVision: KEIL is the most popular software simulator. It has many features like
interactive IDE and supports both C and assembly languages for compilation and simulation.
You can download and get more information from https://www.keil.com/c51/.
INSTALLATION OF KEIL SOFTWARE
Set up Keil IDE for Programming
Keil µVision IDE is a popular way to program MCUs containing the 8051 architectures.
It supports over 50 microcontrollers and has good debugging tools including logic
analyzers and watch windows.
In this article, we will use the AT89C51ED2 microcontroller, which has:
● 64 KB FLASH ROM
● On-chip EEPROM
● 256 Bytes RAM
● In-System programming for uploading the program
● 3 Timer/counters
● SPI, UART, PWM
2
After saving the file, a new window will pop up asking you to select your microcontroller.
As discussed, we are using AT89C51/AT89C51ED2/AT89C52, so select this controller under
the Microchip section (as Atmel is now a part of Microchip).
Select ‘Yes’ in the next pop-up, as we do not need this file in our project.
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.
3
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.
4
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, #30H
ADD A, #31H
MOV R0, A
END
OUTPUT:
RESULT:
The 8051 Assembly Language Program for an 8-bit addition using the Keil simulator was executed
successfully.
5
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:
Keil μvision5 IDE
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:
6
OUTPUT
BEFORE EXECUTION:
AFTER EXECUTION:
RESULT
An Assembly language program to transfer data between registers and memory was executed
successfully.
7
EXP NO:3 ALU Operations
DATE
AIM:
To write and execute the ALU program using the Keil simulator.
SOFTWARE REQUIRED:
Keil μvision5 IDE
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:
//arithmetic operations
mov a, #25h
mov b,#12h
add a,b
mov 40h,a
mov a,#25h
mov b,#12h
subb a,b
mov 41h,a
mov a,#25h
mov b,#12h
mul ab
mov 42h,b
mov 43h,a
mov a, #25h
8
mov b,#12h
div ab
mov 44h,a
mov 45h,b
//logical operations
mov a,#45h
mov r0, #67h
anl a,r0 //and
mov 46h,a
mov a,#45h
mov r0, #67h
orl a,r0 //or
mov 47h,a
mov a,#45h
mov r0, #67h
xrl a,r0 //xor
mov 48h,a
mov a,#45h
cpl a //not
mov 49h,a
end
OUTPUT:
ADD
9
SUB
MUL
DIV
AND
10
OR
XOR
NOT
RESULT:
The ALU program using the Keil simulator was executed successfully.
11
EXP NO: 4 WRITE BASIC AND ARITHMETIC PROGRAMS USING
DATE: EMBEDDED C
AIM:
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.
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 1:
#include<REG51.h>
int i,j;
sbit LED = P3^0;
void main()
{
while(1)
{
LED = 0;
for(j=0;j<10000;j++);
LED = 1;
for(j=0;j<10000;j++);
}
12
}
Output:
Before Execution:
After Execution:
13
PROGRAM 2:
#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);
}
Output:
BEFORE EXECUTION:
14
AFTER EXECUTION:
RESULT:
The basic embedded C program to
(i) Control a port 0’s pin 0 as a LED and
(ii) Add, subtract, multiply and divide using a Keil simulator was successfully verified.
15
EXP NO:5 INTRODUCTION TO ARDUINO PLATFORM AND PROGRAMMING
DATE
Aim:
To study the basics of Arduino Uno board and Arduino IDE 2.0 software.
Software and Hardware Required:
1. Arduino IDE 2.0 1
2. Arduino Uno Board 1
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 a 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.
1) Arduino UNO
Arduino UNO is based on an ATmega328P microcontroller. It is easy to use compared
to other boards, such as the Arduino Mega board, etc. The Arduino UNO includes 6
analog pin inputs, 14 digital pins, a USB connector, a power jack, and an ICSP (In-Circuit
Serial Programming) header. It is the most used and of standard form from the list of all
available Arduino Boards.
16
2) Arduino Nano
The Arduino Nano is a small Arduino board based on the 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
17
4) Arduino Micro
The Arduino Micro is based on the ATmega32U4 Microcontroller. It consists of 20 sets
of pins. The 7 pins from the set are PWM (Pulse Width Modulation) pins, while 12 pins
are analog input pins. The other components on board are a reset button, a 16MHz crystal
oscillator, an ICSP header, and a micro-USB connection. The USB is built in the Arduino
Micro board.
5) Arduino Leonardo
The basic specification of the Arduino Leonardo is the same as the Arduino Micro. It is
also based on the ATmega32U4 Microcontroller. The components present on the board
are 20 analog and digital pins, a reset button, a 16MHz crystal oscillator, an ICSP header,
and a micro USB connection.
6) Arduino Due
The Arduino Due is based on the 32-bit ARM core. It is the first Arduino board that has
been developed based on the ARM Microcontroller. It consists of 54 Digital Input/Output pins
and 12 Analog pins. The Microcontroller present on the board is the Atmel SAM3X8E ARM
Cortex-M3 CPU. It has two ports, namely, a native USB port and a Programming port. The
micro side of the USB cable should be attached to the programming port.
18
7) Arduino Lilypad
The Arduino LilyPad was initially created for wearable projects and e-textiles. It is based
on the ATmega168 Microcontroller. The functionality of Lilypad is the same as other
Arduino Boards. It is a round, lightweight board with a minimal number of components
to keep the size of the board small. The Arduino Lilypad board was designed by Sparkfun
and Leah. It was developed by Leah Buechley. It has 9 digital I/O pins.
8) Arduino Bluetooth
9) Arduino Diecimila
The Arduino Diecimila is also based on the ATmeg628 Microcontroller. The board
consists of 6 analog pin inputs, 14 digital Input/Output pins, a USB connector, a power
jack, an ICSP (In-Circuit Serial Programming) header, and a reset button. We can connect
the board to the computer using the USB and can power on the board with the help of an
AC to DC adapter. The Diecimila was initially developed to mark the 10000 delivered
boards of Arduino. Here, Diecimila means 10,000 in Italian.
19
10) Arduino Robot
The Arduino Robot is called the tiny computer. It is widely used in robotics. The board
comprises the speaker, five-button, color screen, two motors, an SD card reader, a digital
compass, two potentiometers, and five floor sensors. The Robot Library can be used to
control the actuators and the sensors.
The Arduino Ethernet is based on the ATmega328 Microcontroller. The board consists
of 6 analog pins, 14 digital I/O pins, crystal oscillator, reset button, ICSP header, a power
jack, and an RJ45 connection. With the help of the Ethernet shield, we can connect our
Arduino board to the internet.
20
12) Arduino Zero
The Arduino Zero is generally called as the 32-bit extension of the Arduino UNO. It is
based on ATmel's SAM21 MCU. The board consists of 6 analog pin inputs, 14 digital
Input/Output pins, a USB connector, a power jack, and an ICSP (In-Circuit Serial
Programming) header, UART port pins, a power header, and AREF button. The
Embedded debugger of Atmel is also supported by the Arduino Zero. The function of
Debugger is to provide a full debug interface, which does not require additional hardware.
The Arduino Esplora boards allow easy interfacing of sensors and actuators. The outputs
and inputs connected on the Esplora board make it unique from other types of Arduino
boards. The board includes outputs, inputs, a small microcontroller, a microphone, a
sensor, a joystick, an accelerometer, a temperature sensor, four buttons, and a slider.
The structure of Arduino Pro Micro is similar to the Arduino Mini board, except the
Microcontroller ATmega32U4. The board consists of 12 digital Input/output pins, 5
PWM (Pulse Width Modulation) pins, Tx and Rx serial connections, and 10-bit ADC
(Analog to Digital Converter).
21
INTRODUCTION TO ARDUINO UNO:
The Arduino UNO is a standard board of Arduino. Here UNO means 'one' in Italian.
It was named UNO to label the first release of Arduino Software. It was also the first
USB board released by Arduino. It is considered a powerful board used in various
projects. Arduino. cc developed the Arduino UNO board. Arduino UNO is based on an
ATmega328P microcontroller. It is easy to use compared to other boards, such as the
Arduino Mega board, etc. The board consists of digital and analog Input/Output pins
(I/O), shields, and other circuits. The Arduino UNO includes 6 analog pin inputs, 14
digital pins, a USB connector, a power jack, and an ICSP (In-Circuit Serial
Programming) header. It is programmed based on IDE, which stands for Integrated
Development Environment. It can run on both online and offline platforms. The IDE is
common to all available boards of Arduino.
22
o ICSP pin - The In-Circuit Serial Programming pin allows the user to program
using the firmware of the Arduino board.
o Power LED Indicator- The ON status of the LED shows the power is
activated. When the power is OFF, the LED will not light up.
o Digital I/O pins- The digital pins have the value HIGH or LOW. The pins
numbered from D0 to D13 are digital pins.
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 a GPIO (General Purpose Input Output) pin.
TECHNICAL SPECIFICATIONS OF ARDUINO UNO
The technical specifications of the Arduino UNO are listed below:
o There are 20 Input/Output pins present on the Arduino UNO board. These 20
pins include 6 PWM pins, 6 analog pins, and 8 digital I/O pins.
o The PWM pins are Pulse Width Modulation capable.
o The crystal oscillator present in Arduino UNO comes with a frequency of 16MHz.
o It also has an Arduino-integrated WIFI module. Such an Arduino UNO board
is based on the Integrated WIFI ESP8266 Module and ATmega328P
microcontroller.
o The input voltage of the UNO board varies from 7V to 20V.
o Arduino UNO automatically draws power from the external power supply. It
can also draw power from the USB.
23
ARDUINO UNO PINOUT
The Arduino UNO is a standard board of Arduino, which
is based on an ATmega328P microcontroller. It is easier to use than other types of
Arduino Boards.
The Arduino UNO Board, with the specification of pins, is shown below:
GND - Ground pins. The ground pins are used to ground the circuit.
TXD and RXD: TXD and RXD pins are used for serial communication. The TXD is
used for transmitting the data, and RXD is used for receiving the data. It also represents
the successful flow of data.
24
USB Interface: The USB Interface is used to plug-in the USB cable. It allows the board
to connect to the computer. It is essential for the programming of the Arduino UNO
board.
SCK: It stands for Serial Clock. These are the clock pulses, which are used to
synchronize the transmission of data.
MISO: It stands for Master Input/ Slave Output. The save line in the MISO pin is used
to send the data to the master.
VCC: It is the modulated DC supply voltage, which is used to regulate the IC's used in
the connection. It is also called as the primary voltage for IC's present on the Arduino
board. The Vcc voltage value can be negative or positive with respect to the GND pin.
Crystal Oscillator- The Crystal oscillator has a frequency of 16MHz, which makes the
Arduino UNO a powerful board.
ICSP: It stands for In-Circuit Serial Programming. The users can program the Arduino
board's firmware using the ICSP pins. The program or firmware with the advanced
functionalities is received by the microcontroller with the help of the ICSP header. The
ICSP header consists of 6 pins.
SDA: It stands for Serial Data. It is a line used by the slave and master to send and receive
data. It is called a data line, while SCL is called a clock line.
SCL: It stands for Serial Clock. It is defined as the line that carries the clock data. It is
used to synchronize the transfer of data between the two devices. The Serial Clock is
generated by the device and it is called the master.
25
SPI: It stands for Serial Peripheral Interface. It is popularly used by the
microcontrollers to communicate with one or more peripheral devices quickly. It uses
conductors for data receiving, data sending, synchronization, and device selection (for
communication).
MOSI: It stands for Master Output/ Slave Input. The MOSI and SCK are driven by the
Master.
SS: It stands for Slave Select. It is the Slave Select line, which is used by the master. It
acts as the enable line. I2C: It is the two-wire serial communication protocol. It stands
for Inter Integrated Circuits. The I2C is a serial communication protocol that uses SCL
(Serial Clock) and SDA (Serial Data) to receive and send data between two devices.
The Arduino IDE 2.0 is an open-source project, currently in its beta-phase. It is a big step
from it's sturdy predecessor, Arduino IDE 2.0, and comes with revamped UI, improved
board & library manger, autocomplete feature and much more.
In this tutorial, we will go through step by step, how to download and install the software.
Requirements
· Windows - Win 10 and newer, 64 bits
· Linux - 64 bits
· Mac OS X - Version 10.14: "Mojave" or newer, 64 bits
To insInstallation Windows
Install the Arduino IDE 2.0 on a Windows computer, simply run the file downloaded from the
software page.
26
Follow the instructions in the installation guide. The installation may take several minutes.
You can now use the Arduino IDE 2.0 on your windows computer!
How to use the board manager with the Arduino IDE 2.0
The board manager is a great tool for installing the necessary cores to use your Arduino
boards. In this quick tutorial, we will take a look at how to install one, and choosing the
right core for your board!
Requirements
· Arduino IDE 2.0 installed.
Why use the board manager?
The board manager is a tool that is used to install different cores on your local computer.
So what is a core, and why is it necessary that I install one?
27
Simply explained, a core is written and designed for specific microcontrollers. As Arduino
have several different types of boards, they also have different type of microcontrollers.
For example, an Arduino UNO has an ATmega328P, which uses the AVR core, while an
Arduino Nano 33 IoT has a SAMD21 microcontroller, where we need to use the SAMD core.
In conclusion, to use a specific board, we need to install a specific core.
Installing a core
Installing a core is quick and easy, but let's take a look at what we need to do.
2. With the editor open, let's take a look at the left column. Here, we can see
a couple of icons. Let's click on the "computer chip" icon.
3. A list will now appear of all available cores. Now let's say we are using an
Nano 33 IoT board, and we want to install the core. Simply enter the name in
the search field, and the right core (SAMD) will appear, where the Nano 33
IoT features in the description. Click on the "INSTALL" button.
4. This will begin an installation process, which in some cases may take several
minutes.
28
5. When it is finished, we can take a look at the core in the board's manager
column, where it should say "INSTALLED".
PROGRAM :
CONNECTION:
LED Blinking:
void setup()
{
pinMode(2, OUTPUT);
}
void loop()
{
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(2, LOW);
delay(1000);
}
29
OUTPUT:
LED Blinking
Before Execution:
After Execution:
RESULT:
The study and execution of different Arduino programming for analog, digital signals and serial
communication was verified successfully.
30
EXP NO:6 EXPLORE DIFFERENT COMMUNICATION METHODS WITH IOT
DATE: DEVICES (ZIGBEE, GSM, BLUETOOTH)
AIM:
To explore different communication methods with IoT devices (Zigbee, GSM,
Bluetooth).
DIFFERENT COMMUNICATION METHODS:
IoT devices require reliable and efficient communication methods to transmit data and
interact with other devices or systems. Here are three commonly used communication
methods for IoT devices:
Zigbee:
GSM is a widely used cellular network technology that enables IoT devices to
connect to the internet using SIM cards. It operates on various frequency bands and
provides wide coverage, making it suitable for applications that require long-range
communication. GSM is commonly used in applications such as asset tracking, remote
monitoring, and smart cities.
Bluetooth:
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.
31
6A. To demonstrate the process of interfacing a Bluetooth module (specifically HC-05)
with an Arduino board to wirelessly control the state of an LED.
APPARATUS REQUIRED:
● thingZkit IoT Board
● Jumper wires
● USB cable for Arduino Uno.
● Power Adapter Cable(12V/3A) for thingZkit IoT
● Computer with Arduino IDE installed.
SOFTWARE REQUIRED:
Arduino IDE software
PROCEDURE:
● Connect the VCC pin of the Bluetooth module to the 5V pin on the Arduino Uno
● Connect the GND pin of the Bluetooth module to the GND pin on Arduino.
● Connect the TX pin of the Bluetooth module to the RX pin on Arduino.
● Connect the RX pin of the Bluetooth module to the TX pin on Arduino.
● Open the Arduino IDE and go to "Sketch" -> "Include Library" -> "Manage Libraries..."
● Search for "SoftwareSerial" and install it if your module requires it
● Power on the Arduino Uno. Set your Bluetooth module in pairing mode (consult the
module's documentation for instructions).
● Pair your computer or mobile device with the Bluetooth module.
● Send commands from your computer or mobile device to the Bluetooth module to
control the connected IoT devices.
CONNECTION DIAGRAM:
32
PROGRAM:
char data = 0;
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop()
{
if(Serial.available() > 0)
{
data = Serial.read();
Serial.print(data);
Serial.print("\n");
if(data == 'A')
digitalWrite(13, HIGH);
else if(data == 'B')
digitalWrite(13, LOW);
}
}
OUTPUT: BLUETOOTH MODULE IN ARDUINO UNO
RESULT :
Thus the output was verified for communication between IOT Node using a Bluetooth
Module and Arduino UNO board.
33
EXP NO:7 INTRODUCTION TO THE RASPBERRY PI PLATFORM AND
DATE: PYTHON PROGRAMMING
34
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.
Similar to the Raspberry Pi Pico, the Pico W offers a generous number of GPIO pins,
providing flexibility for interfacing with external components and peripherals. It features
26 GPIO pins, of which 3 are analog inputs, and supports various protocols such as
UART, SPI, I2C, and PWM. The Pico W also includes onboard LED indicators and a
micro-USB port for power and data connectivity.
35
newcomers to get started. Additionally, the 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 projects.
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
36
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.
If you want to program your ESP32 and ESP8266 with MicroPython firmware, it’s very
handy to use an IDE. you’ll have your first LED blinking using MicroPython and Thonny
IDE.
What is MicroPython?
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
an extremely interactive and easy to learn IDE 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.
37
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.
38
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.
39
CONNECTION DIAGRAM:
40
# Define the RGB LED pins (common cathode)
Red_Pin = Gpio.Pin(15, Gpio.Pin.OUT)
Green_Pin = Gpio.Pin(14, Gpio.Pin.OUT)
Blue_Pin = Gpio.Pin(13, Gpio.Pin.OUT)
# Main loop
while True:
# Red
set_rgb_color(1, 0, 0)
TM.sleep(1)
# Green
set_rgb_color(0, 1, 0)
TM.sleep(1)
# Blue
set_rgb_color(0, 0, 1)
TM.sleep(1)
OUTPUT:
RESULT:
Thus, the program to control LED using the Zigbee Module was executed successfully.
41
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
5 IR Sensor 1
6 Ultrasonic sensor 1
CONNECTIONS:
Raspberry Pi Pico
IR Sensor Module
Pin
GP14 OUT
PROGRAM:
IR Sensor:
import machine as gpio
import utime as TM
42
# Function to read and print the IR sensor's digital output
def read_ir_sensor():
sensor_output = Sensor_In.value()
if sensor_output == 0:
print("IR sensor detected an object.")
else:
print("IR sensor did not detect an object.")
# Main loop
while True:
read_ir_sensor()
TM.sleep(1) # Add a delay between readings
Experiment Setup:
Hardware Connection:
❖ Connect the On-Board IR Sensor to thingZkit IoT as per the Connection Diagramabove.
❖ Connect the On Board IR Sensor to thingZkit IoT (OUT– GPIO 14 Pin )
❖ Ensure that the connections are secure, and the components are properly seatedon the
board.
thingZkit IoT Configuration:
❖ Connect thingZkit IoT to your computer using the USB cable.
❖ Open Thonny software and select the appropriate board and port.
❖ Open the Correct Code folder.
❖ Upload the code and observe the output on the hardware and Thonny shell.
OUTPUT:
RESULT:
The execution of LED control using python programming with RaspberryPi Pico was verified.
43
EXP NO:9 COMMUNICATE BETWEEN ARDUINO AND RASPBERRY PI
DATE: USING WIRELESS MODEM
AIM:
To write and control the onboard LED via UART communication using Pico on the
thingZkit IoT board.
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:
PICO
TTL(USB TO UART CONVERTER)
GP1 TX
GP0 RX
GND GND
44
Experiment Setup:
Hardware Connection:
❖ Connect the USB to UART Converter to Thingzkit IoT as per the Connection
Diagram above.
❖ Connect the USB to UART Converter to Thingzkit IoT(RX– GP0 Pin, TX – GP1Pin,
GND - GND)
❖ Ensure that the connections are secure, and the components are properly seatedon the
board.
thingZkit IoT Configuration:
❖ Connect thingZkit IoT to your computer using the USB cable.
❖ Open Thonny software and select the appropriate board and port.
❖ Open the Correct Code folder.
❖ Upload the code to Pico controller
Note: Uploading or Flashing Procedure refer Annexure -I
❖ Open the Arduino IDE → Click Tools→ Click port → Select correct COM port.
45
PROGRAM:
import machine as gpio
import utime as TM
while True:
# Read data from the serial port
Slave_Data = uart.readline()
if Slave_Data:
Slave_Data = Slave_Data.decode().strip() # Decode the received Slave_Data as a string
46
OUTPUT:
RESULT:
The execution of the program to Communicate between Arduino and Raspberry PI using any wireless
medium (Bluetooth) was verified.
47
EXP NO:10 SETUP A CLOUD PLATFORM TO LOG THE DATA
DATE:
AIM:
To study the experiment 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.
48
Step 3: Give any name to the Template such as Raspberry Pi Pico W. Select ‘Hardware
Type’ as Other and ‘Connection Type’ as WiFi.
49
Step 4: Now we need to add a ‘New Device’ now.
Select the device from a template that you created earlier and also give any name to the
device. Click on Create.
50
A new device will be created. You will find the Blynk Authentication Token Here. Copy it
as it is necessary for the code.
From the widget box drag a switch and place it on the dashboard screen.
51
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.
Configure the switch settings as per the image below and click on create.
52
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 set up
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.
53
PROCEDURE:
The process is explained above.
RESULT:
The cloud platform set up to log the data from IoT devices was verified.
54
EXP NO:11 Log Data using Raspberry PI and upload it to the
DATE: Cloud Platform
AIM:
To study and write a program to Log Data using Raspberry PI and upload it to the
cloud platform
PROGRAM:
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'
55
# connect the network wait = 10
while wait > 0:
if wlan.status() < 0 or wlan.status() >= 3:
break
wait -= 1
print('waiting for connection...')
time.sleep(1)
lcd.clear()
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:
The execution of the program to Log Data using Raspberry PI and upload it to the cloud platform was
verified.
56
EXP NO:12 DESIGN AN IOT-BASED SYSTEM
DATE:
AIM:
To study the design of a Smart Home Automation using an IOT-based system
5 LED or Relay 1
PROCEDURE:
CONNECTIONS:
57
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'
"Connection to Blynk"
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
RESULT:
The design of a Smart Home Automation using IOT-based system was verified successfully.
58