IoT Lab Manual
IoT Lab Manual
Laboratory Manual
Elective-I
Internet of Things
(IoT)
For
It is my great pleasure to present this laboratory manual for Final year engineering
students for the subject of Elective-I : Internet of Things (IoT).
As a student, many of you may be wondering with some of the questions in your
mind regarding the subject and exactly what has been tried is to answer through
this manual.
As you may be aware that MGM has already been awarded with ISO 9001:2000
certification and it is our endure to technically equip our students taking the
advantage of the procedural aspects of ISO 9001:2000 Certification.
Faculty members are also advised that covering these aspects in initial stage
itself, will greatly relieve them in future as much of the load will be taken care by
the enthusiasm energies of the students once they are conceptually clear.
Dr. H. H. Shinde
Principal
LABORATORY MANUAL CONTENTS
This manual is intended for the third year students of Computer Science and
Engineering in the subject of SDL-II Mobile Application Development (Android). This
manual typically contains practical/lab sessions related Android implemented in java-
eclipse covering various aspects related the subject to enhanced understanding.
Students are advised to thoroughly go through this manual rather than only topics
mentioned in the syllabus as practical aspects are the key to understanding and
conceptual visualization of theoretical aspects covered in the books.
II. Preparing graduates for higher education and research in computer science and engineering
enabling them to develop systems for society development.
3. Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of
the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports and
design documentation, make effective presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the engineering and
management principles and apply these to one’s own work, as a member and leader in a team, to manage
projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
LAB INDEX
Study and Install Python in Eclipse and WAP for data types in python.
Write a Program for arithmetic operation in Python.
Write a Program for looping statement in Python.
Study and Install IDE of Arduino and different types of Arduino.
Write program using Arduino IDE for Blink LED.
Write Program for RGB LED using Arduino.
Study the Temperature sensor and Write Program foe monitor temperature using
Arduino.
Study and Implement RFID, NFC using Arduino.
Study and implement MQTT protocol using Arduino.
Study and Configure Raspberry Pi.
WAP for LED blink using Raspberry Pi.
Study and Implement Zigbee Protocol using Arduino / Raspberry Pi.
DOs and DON’Ts in Laboratory:
1. Make entry in the Log Book as soon as you enter the Laboratory.
2. All the students should sit according to their roll numbers starting from their left to
right.
3. All the students are supposed to enter the terminal number in the log book.
1. Submission related to whatever lab work has been completed should be done during the
next lab session.
2. The immediate arrangements for printouts related to submission on the day of practical
assignments.
3. Students should be taught for taking the printouts under the observation of lab teacher.
4. The promptness of submission should be encouraged by way of marking and evaluation
patterns that will benefit the sincere students.
Basic honesty in the evaluation and marking system is absolutely essential and
in the process impartial nature of the evaluator is required in the examination system to
become popular amongst the students. It is a wrong approach or concept to award the
students by way of easy marking to get cheap popularity among the students to which
they do not deserve. It is a primary responsibility of the teacher that right students who
are really putting up lot of hard work with right kind of intelligence are correctly awarded.
The marking patterns should be justifiable to the students without any ambiguity and
teacher should see that `students are faced with unjust circumstances.
Aim: Study and Install Python in Eclipse and WAP for data types in python.
Objectives: Student should get the knowledge of Python and Eclipse background.
What is Python:
Python is Interactive − You can actually sit at a Python prompt and interact with
the interpreter directly to write your programs.
History of Python
Python was developed by Guido van Rossum in the late eighties and early nineties at
the National Research Institute for Mathematics and Computer Science in the
Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-
68, SmallTalk, and Unix shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under the GNU
General Public License (GPL).
Python is now maintained by a core development team at the institute, although Guido
van Rossum still holds a vital role in directing its progress.
Python Features
Easy-to-learn − Python has few keywords, simple structure, and a clearly defined
syntax. This allows the student to pick up the language quickly.
Easy-to-read − Python code is more clearly defined and visible to the eyes.
A broad standard library − Python's bulk of the library is very portable and cross-
platform compatible on UNIX, Windows, and Macintosh.
Interactive Mode − Python has support for an interactive mode which allows
interactive testing and debugging of snippets of code.
Portable − Python can run on a wide variety of hardware platforms and has the
same interface on all platforms.
Extendable − You can add low-level modules to the Python interpreter. These
modules enable programmers to add to or customize their tools to be more
efficient.
GUI Programming − Python supports GUI applications that can be created and
ported to many system calls, libraries and windows systems, such as Windows
MFC, Macintosh, and the X Window system of Unix.
Scalable − Python provides a better structure and support for large programs
than shell scripting.
Apart from the above-mentioned features, Python has a big list of good features, few are
listed below −
It provides very high-level dynamic data types and supports dynamic type
checking.
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
The following assume that you have already Eclipse installed. For an installation
description of Eclipse please see Eclipse IDE for Java.
For Python development under Eclipse you can use the PyDev Plugin which is an
open source project. Install PyDev via the Eclipse update manager via the
following update site: http://pydev.org/updates.
Configuration of Eclipse
You also have to maintain in Eclipse the location of your Python installation. Open
in theWindow ▸ Preference ▸ Pydev ▸ Interpreter Python menu.
Press the New button and enter the path to python.exe in your Python
installation directory. For Linux and Mac OS X users this is normally
/usr/bin/python.
Variables are nothing but reserved memory locations to store values. This means
that when you create a variable you reserve some space in memory.
Based on the data type of a variable, the interpreter allocates memory and decides
what can be stored in the reserved memory. Therefore, by assigning different data
types to variables, you can store integers, decimals or characters in these
variables.
Python variables do not need explicit declaration to reserve memory space. The
declaration happens automatically when you assign a value to a variable. The
equal sign (=) is used to assign values to variables.
The operand to the left of the = operator is the name of the variable and the
operand to the right of the = operator is the value stored in the variable. For
example −
#!/usr/bin/python
print counter
print miles
print name
Here, 100, 1000.0 and "John" are the values assigned to counter, miles,
and name variables, respectively. This produces the following result −
100
1000.0
John
Multiple Assignment
Python allows you to assign a single value to several variables simultaneously.
For example −
a=b=c=1
Here, an integer object is created with the value 1, and all three variables are
assigned to the same memory location. You can also assign multiple objects to
multiple variables. For example −
a,b,c = 1,2,"john"
Here, two integer objects with values 1 and 2 are assigned to variables a and b
respectively, and one string object with the value "john" is assigned to the variable
c.
The data stored in memory can be of many types. For example, a person's age is
stored as a numeric value and his or her address is stored as alphanumeric
characters. Python has various standard data types that are used to define the
operations possible on them and the storage method for each of them.
Numbers
String
List
Tuple
Dictionary
Python Numbers
Number data types store numeric values. Number objects are created when you
assign a value to them. For example −
var1 = 1
var2 = 10
You can also delete the reference to a number object by using the del statement.
The syntax of the del statement is −
del var1[,var2[,var3[....,varN]]]]
You can delete a single object or multiple objects by using the del statement. For
example −
del var
long (long integers, they can also be represented in octal and hexadecimal)
Examples
- -052318172735L - 3e+26J
0x26 32.54e10
0 0
Python Strings
he plus (+) sign is the string concatenation operator and the asterisk (*) is the repetition
operator. For example −
#!/usr/bin/python
Operators
Operators are the constructs which can manipulate the value of operands.
Consider the expression 4 + 5 = 9. Here, 4 and 5 are called operands and + is called
operator.
Types of Operator
Python language supports the following types of operators.
Arithmetic Operators
Comparison (Relational) Operators
Assignment Operators
Logical Operators
Bitwise Operators
Membership Operators
Identity Operators
Let us have a look on all operators one by one.
Example
#!/usr/bin/python
a = 21
b = 10
c=0
c=a+b
c=a-b
c=a*b
c=a/b
c=a%b
a=2
b=3
c = a**b
a = 10
b=5
c = a//b
When you execute the above program, it produces the following result −
Line 1 - Value of c is 31
Line 2 - Value of c is 11
Line 4 - Value of c is 2
Line 5 - Value of c is 1
Line 6 - Value of c is 8
Line 7 - Value of c is 2
Experiment No 3
Objectives: Student should get the knowledge of for looping statement in python.
Programming languages provide various control structures that allow for more
complicated execution paths.
1 while loop
2 for loop
3 nested loops
You can use one or more loop inside any another while, for or
do..while loop.
Loop control statements change execution from its normal sequence. When
execution leaves a scope, all automatic objects that were created in that scope are
destroyed.
Python supports the following control statements. Click the following links to check
their detail.
1 break statement
2 continue statement
Causes the loop to skip the remainder of its body and
immediately retest its condition prior to reiterating.
3 pass statement
It has the ability to iterate over the items of any sequence, such as a list or a string.
Syntax
statements(s)
If a sequence contains an expression list, it is evaluated first. Then, the first item in the
sequence is assigned to the iterating variable iterating_var. Next, the statements block is
executed. Each item in the list is assigned to iterating_var, and the statement(s) block is
executed until the entire sequence is exhausted.
Flow Diagram
Example
#!/usr/bin/python
Current Letter : P
Current Letter : y
Current Letter : t
Current Letter : h
Current Letter : o
Current Letter : n
Good bye!
An alternative way of iterating through each item is by index offset into the sequence
itself. Following is a simple example −
#!/usr/bin/python
Good bye!
Here, we took the assistance of the len() built-in function, which provides the total
number of elements in the tuple as well as the range() built-in function to give us the
actual sequence to iterate over.
If the else statement is used with a for loop, the else statement is executed when
the loop has exhausted iterating the list.
If the else statement is used with a while loop, the else statement is executed
when the condition becomes false.
The following example illustrates the combination of an else statement with a for
statement that searches for prime numbers from 10 through 20.
#!/usr/bin/pytho
10 equals 2 * 5
11 is a prime number
12 equals 2 * 6
13 is a prime number
14 equals 2 * 7
15 equals 3 * 5
16 equals 2 * 8
17 is a prime number
Experiment No 4
Aim: Study and Install IDE of Arduino and different types of Arduino
Objectives: Student should get the knowledge of Arduino IDE and different types
of Arduino Board
Outcomes: Student will be get knowledge of Arduino IDE and different types of
Arduino Board
Arduino:
Arduino provides a standard form factor that breaks the functions of the micro-
controller into a more accessible package.
Arduino boards are able to read analog or digital input signals from different
sensors and turn it into an output such as activating a motor, turning LED on/off,
connect to the cloud and many other actions.
You can control your board functions by sending a set of instructions to the
microcontroller on the board via Arduino IDE (referred to as uploading software).
Unlike most previous programmable circuit boards, Arduino does not need an
extra piece of hardware (called a programmer) in order to load a new code onto
the board. You can simply use a USB cable.
Additionally, the Arduino IDE uses a simplified version of C++, making it easier
to learn to program.
Finally, Arduino provides a standard form factor that breaks the functions of the
micro-controller into a more accessible package.
The process will extract and install all the required files to execute properly the Arduino Software
(IDE)
Proceed with board specific instructions
When the Arduino Software (IDE) is properly installed you can go back to the
Arduino USB
1.Arduino uno
This is the latest revision of the basic Arduino USB board. It connects to
the computer with a standard USB cable and contains everything else
you need to program and use the board.
2.Arduino NG REV-C
Arduino Bluetooth
Arduino Mega
Arduino NANO
The Arduino Nano 3.0 has an ATmega328 and a two-layer PCB. The
power LED moved to the top of the board.
Experiment No 5
Aim: Write program using Arduino IDE for Blink LED
Objectives: Student should get the knowledge of Arduino Board and different types
of LED
Outcomes: Student will be Write program using Arduino IDE for Blink LED
Hardware Requirements:
1x Breadboard
1x Arduino Uno R3
1x RGB LED
1x 330Ω Resistor
2x Jumper Wires
Blinking the RGB LED
With a simple modification of the breadboard, we could attach the LED to an
output pin of the Arduino. Move the red jumper wire from the Arduino 5V
connector to D13, as shown below:
Now load the 'Blink' example sketch from Lesson 1. You will notice that both the
built-in 'L' LED and the external LED should now blink.
1. /*
2. Blink
3. Turns on an LED on for one second, then off for one second, repeatedly.
4.
5. This example code is in the public domain.
6. */
7.
8. // Pin 13 has an LED connected on most Arduino boards.
9. // give it a name:
10. int led = 13;
11.
12. // the setup routine runs once when you press reset:
13. void setup() {
14. // initialize the digital pin as an output.
15. pinMode(led, OUTPUT);
16. }
17.
18. // the loop routine runs over and over again forever:
19. void loop() {
20. digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
21. delay(1000); // wait for a second
22. digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
23. delay(1000); // wait for a second
24. }
Lets try using a different pin of the Arduino – say D7. Move the red jumper lead
from pin D13 to pin D7 and modify the following line near the top of the sketch:
so that it reads:
1. int led = 7;
Upload the modified sketch to your Arduino board and the LED should still
be blinking, but this time using pin D7.
Experiment No 6
Aim: Write Program for RGB LED using Arduino.
Objectives: Student should get the knowledge of Arduino IDE and RGB Led
Outcomes: Student will be developed programs using Arduino IDE and Arduino
Board for RGB Led
Hardware Requirements:
1x Breadboard
1x Arduino Uno R3
1x LED
1x 330Ω Resistor
2x Jumper Wires
Blinking the LED
With a simple modification of the breadboard, we could attach the LED to an
output pin of the Arduino. Move the red jumper wire from the Arduino 5V
connector to D13, as shown below:
Now load the 'Blink' example sketch from Lesson 1. You will notice that both the
built-in 'L' LED and the external LED should now blink.
The following test sketch will cycle through the colors red, green, blue, yellow,
purple, and aqua. These colors being some of the standard Internet colors.
1. /*
2. Adafruit Arduino - Lesson 3. RGB LED
3. */
4.
5. int redPin = 11;
6. int greenPin = 10;
7. int bluePin = 9;
8.
9. //uncomment this line if using a Common Anode LED
10. //#define COMMON_ANODE
11.
12. void setup()
13. {
14. pinMode(redPin, OUTPUT);
15. pinMode(greenPin, OUTPUT);
16. pinMode(bluePin, OUTPUT);
17. }
18.
19. void loop()
20. {
21. setColor(255, 0, 0); // red
22. delay(1000);
23. setColor(0, 255, 0); // green
24. delay(1000);
25. setColor(0, 0, 255); // blue
26. delay(1000);
27. setColor(255, 255, 0); // yellow
28. delay(1000);
29. setColor(80, 0, 80); // purple
30. delay(1000);
31. setColor(0, 255, 255); // aqua
32. delay(1000);
33. }
34.
35. void setColor(int red, int green, int blue)
36. {
37. #ifdef COMMON_ANODE
38. red = 255 - red;
39. green = 255 - green;
40. blue = 255 - blue;
41. #endif
42. analogWrite(redPin, red);
43. analogWrite(greenPin, green);
44. analogWrite(bluePin, blue);
45. }
The sketch starts by specifying which pins are going to be used for each of the colors:
Download file
Copy Code
1. int redPin = 11;
2. int greenPin = 10;
3. int bluePin = 9;
The next step is to write the 'setup' function. As we have learnt in earlier
lessons, the setup function runs just once after the Arduino has reset. In this
case, all it has to do is define the three pins we are using as being outputs.
1. void setup()
2. {
3. pinMode(redPin, OUTPUT);
4. pinMode(greenPin, OUTPUT);
5. pinMode(bluePin, OUTPUT);
6. }
Before we take a look at the 'loop' function, lets look at the last function in
the sketch.
Download file
Copy Code
This function takes three arguments, one for the brightness of the red, green
and blue LEDs. In each case the number will be in the range 0 to 255, where
0 means off and 255 means maximum brightness. The function then calls
'analogWrite' to set the brightness of each LED.
If you look at the 'loop' function you can see that we are setting the amount
of red, green and blue light that we want to display and then pausing for a
second before moving on to the next color.
1. void loop()
2. {
3. setColor(255, 0, 0); // red
4. delay(1000);
5. setColor(0, 255, 0); // green
6. delay(1000);
7. setColor(0, 0, 255); // blue
8. delay(1000);
9. setColor(255, 255, 0);// yellow
10. delay(1000);
11. setColor(80, 0, 80); // purple
12. delay(1000);
13. setColor(0, 255, 255);// aqua
14. delay(1000);
15. }
Try adding a few colors of your own to the sketch and watch the effect on your
LED.
Experiment No 7
Aim: Study the Temperature sensor and Write Program foe monitor temperature
using Arduino.
Outcomes: Student will be developed programs using Arduino IDE and Arduino
Board for Temperature Sensor
They come in a "TO-92" package which means the chip is housed in a plastic
hemi-cylinder with three legs. The legs can be bent easily to allow the sensor to be
plugged into a breadboard. You can also solder to the pins to connect long wires. If
you need to waterproof the sensor, you can see below for an Instructable for how
to make an excellent case.
Reading the Analog Temperature Data
Unlike the FSR or photocell sensors we have looked at, the TMP36 and friends
doesn't act like a resistor. Because of that, there is really only one way to read the
temperature value from the sensor, and that is plugging the output pin directly into
an Analog (ADC) input.
Remember that you can use anywhere between 2.7V and 5.5V as the power
supply. For this example I'm showing it with a 5V supply but note that you can
use this with a 3.3v supply just as easily. No matter what supply you use, the
analog voltage reading will range from about 0V (ground) to about 1.75V.
If you're using a 5V Arduino, and connecting the sensor directly into an Analog
pin, you can use these formulas to turn the 10-bit analog reading into a
temperature:
Voltage at pin in milliVolts = (reading from ADC) * (5000/1024)
This formula converts the number 0-1023 from the ADC into 0-5000mV (= 5V)
If you're using a 3.3V Arduino, you'll want to use this:
Voltage at pin in milliVolts = (reading from ADC) * (3300/1024)
This formula converts the number 0-1023 from the ADC into 0-3300mV (= 3.3V)
Then, to convert millivolts into temperature, use this formula:
Centigrade temperature = [(analog voltage in mV) - 500] / 10
Simple Thermometer
This example code for Arduino shows a quick way to create a temperature sensor, it
simply prints to the serial port what the current temperature is in both Celsius and
Fahrenheit.
1. //TMP36 Pin Variables
2. int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
3. //the resolution is 10 mV / degree centigrade with a
4. //500 mV offset to allow for negative temperatures
5.
6. /*
7. * setup() - this function runs once when you turn your Arduino on
8. * We initialize the serial connection with the computer
9. */
10. void setup()
11. {
12. Serial.begin(9600); //Start the serial connection with the computer
13. //to view the result open the serial monitor
14. }
15.
16. void loop() // run over and over again
17. {
18. //getting the voltage reading from the temperature sensor
19. int reading = analogRead(sensorPin);
20.
21. // converting that reading to voltage, for 3.3v arduino use 3.3
22. float voltage = reading * 5.0;
23. voltage /= 1024.0;
24.
25. // print out the voltage
26. Serial.print(voltage); Serial.println(" volts");
27.
28. // now print out the temperature
29. float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree
wit 500 mV offset
30. //to degrees ((voltage - 500mV)
times 100)
31. Serial.print(temperatureC); Serial.println(" degrees C");
32.
33. // now convert to Fahrenheit
34. float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
35. Serial.print(temperatureF); Serial.println(" degrees F");
36.
37. delay(1000);
38. }
Experiment No 8
Aim: Study and Implement RFID, NFC using Arduino.
Objectives: Student should get the knowledge of RFID, NFC using Arduino.
Outcomes: Student will be developed programs using Arduino IDE and Arduino
Board for RFID, NFC.
Hardware Requirements:
Lets first wire the whole thing up. You may observe the circuit diagram given below.
Take note of the following stuffs.
Note 1:- Power supply requirement of RFID Readers vary from product to product. The
RFID reader I used in this tutorial is a 12 Volts one. There are 5 Volts and 9 Volts
versions available in the market.
Note 2:- You may ensure the RFID Reader and RFID Tags are frequency compatible.
Generally they are supposed to be 125Khz. You may ensure this before purchasing
them.
Note 3:- There are two possible outputs from an RFID Reader. One is RS232 compatible
output and other one is TTL compatible output. A TTL compatible output pin can be
connected directly to Arduino. Whereas an RS232 compatible output must be converted
to TTL using an RS232 to TTL converter (You can design this yourself using MAX232
IC)
Make connections as shown. Make sure you connect Ground Pin of RFID reader to
Ground Pin of Arduino. I am using the SoftwareSerial Library of Arduino which enables
digital pins to be used in serial communication. I have used pin 9 as the Rx of Arduino.
(You can also use the hardware Rx pin of Arduino uno – that’s pin 0). If you are new
to SoftwareSerial Library, you may read my previous tutorial oninterfacing GSM
module to Arduino (this article clearly explains how to use Software Serial Library).
#include <SoftwareSerial.h>
void setup()
{
mySerial.begin(9600); // Setting the baud rate of Software Se
rial Library
}void loop()
if(mySerial.available()>0)
Serial.write(mySerial.read());
mySerial.available() – checks for any data coming from RFID reader module through
the SoftwareSerial pin 9. Returns the number of bytes available to read from software
serial port. Returns a -1 if no data is available to read.
Objectives: Student should get the knowledge of MQTT Protocol using Arduino.
Outcomes: Student will be developed programs using Arduino IDE and Arduino
Board for MQTT Protocol
MQTT:
MQTT methods
MQTT defines methods (sometimes referred to as verbs) to indicate the desired action
to be performed on the identified resource. What this resource represents, whether
pre-existing data or data that is generated dynamically, depends on the
implementation of the server. Often, the resource corresponds to a file or the output
of an executable residing on the server.
Connect
Waits for a connection to be established with the server.
Disconnect
Waits for the MQTT client to finish any work it must do, and for the TCP/IP session
to disconnect.
Subscribe
Waits for completion of the Subscribe or UnSubscribe method.
UnSubscribe
Requests the server unsubscribe the client from one or more topics.
Publish
Returns immediately to the application thread after passing the request to the
MQTT client.
Experiment No 10
Aim: Study and Configure Raspberry Pi.
Raspberry Pi
According to the Raspberry Pi Foundation, over 5 million Raspberry Pis have been sold
before February 2015, making it the best-selling British computer.[8] By November 2016
they had sold 11 million units[9][10], reaching 12.5m in March 2017, making it the third
best-selling "general purpose computer" ever.
To get started with Raspberry Pi, you need an operating system. NOOBS (New Out Of Box
Software) is an easy operating system install manager for the Raspberry Pi.
1. GO to the https://www.raspberrypi.org/downloads/
2. Click on NOOBS, then click on the Download ZIP button under ‘NOOBS (offline and
network install)’, and select a folder to save it to.
It is best to format your SD card before copying the NOOBS files onto it. To do this:
3. Insert your SD card into the computer or laptop’s SD card reader and make a note of the
drive letter allocated to it, e.g. G:/
4. In SD Formatter, select the drive letter for your SD card and format it.
1. Once your SD card has been formatted, drag all the files in the extracted NOOBS folder
and drop them onto the SD card drive.
3. When this process has finished, safely remove the SD card and insert it into your
Raspberry Pi.
FIRST BOOT
3. Your Raspberry Pi will boot, and a window will appear with a list of different operating
systems that you can install. We recommend that you use Raspbian – tick the box next
to Raspbian and click on Install.
4. Raspbian will then run through its installation process. Note that this can take a while.
5. When the install process has completed, the Raspberry Pi configuration menu (raspi-
config) will load. Here you are able to set the time and date for your region, enable a
Raspberry Pi camera board, or even create users. You can exit this menu by using Tab on
your keyboard to move to Finish.
The default login for Raspbian is username pi with the password raspberry. Note that you
will not see any writing appear when you type the password. This is a security feature
in Linux.
To load the graphical user interface, type startx and press Enter.
Experiment No 11
Aim: WAP for LED blink using Raspberry Pi.
Objectives: Student should get the knowledge of LED blinking using Raspberry Pi.
Outcomes: Student will be developed program of LED bilking using Raspberry Pi.
Hardware Requirements:
1x Breadboard
1x Raspberry Pi
1x RGB LED
1x 330Ω Resistor
2x Jumper Wires
Step 3: Run
sudo python 01_led.py
Now, you should see the LED blink.
Python Code
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
LedPin = 11 # pin11
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.output(LedPin, GPIO.HIGH) # Set LedPin high(+3.3V) to off led
def loop():
while True:
print '...led on'
GPIO.output(LedPin, GPIO.LOW) # led on
time.sleep(0.5)
print 'led off...'
GPIO.output(LedPin, GPIO.HIGH) # led off
time.sleep(0.5)
def destroy():
GPIO.output(LedPin, GPIO.HIGH) # led off
GPIO.cleanup() # Release resource
if __name__ == '__main__': # Program start from here
setup()
try:
loop()
except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the child program destroy() will be
executed.
destroy()
Experiment No 12
Aim: Study and Implement Zigbee Protocol using Raspberry Pi.
Objectives: Student should get the knowledge of Zigbee Protocol using Raspberry
Pi.
Hardware Requirements
Raspberry Pi2
XBee 1mW Wire Antenna- Series 1 (2 No:)
XBee Explorer Dongle (2 No:)
computers, systems, really anything with a serial port. As it works with low power
sight. ZigBee devices can transmit data over long distances by passing data through
a mesh network of intermediate devices to reach more distant ones. ZigBee is typically
used in low data rate applications that require long battery life and secure networking.
Its main applications are in the field of wireless sensor network based on industries as
it requires short-range low-rate wireless data transfer. The technology defined by the
Here we make use of an interface of Zigbee with Raspberry Pi2 for a proper wireless
communication. Raspberry Pi2 has got four USB ports, so it is better to use a Zigbee Dongle for
this interface. Now we want to check the communication between the two paired ZigBee
modules.
The response showed inside a red box indicates the presence of a usb device in the module.
import serial
while True:
incoming = ser.readline().strip()
The two zigbee must be in a line of sight and check the results in the Python shell and in the