STMW Internet - of - Things - Lab - Manual
STMW Internet - of - Things - Lab - Manual
STMW Internet - of - Things - Lab - Manual
IV B. Tech- I Sem
(2022-23)
INTERNET OF
THINGS(IoT)
LABORATORY
MANUAL
• Two Relays for Switching AC devices.
• 4x4 Keypad
• L293D Motor Driver for DC and Stepper Motors
• DS1307 based Real Time Clock
• AT2404 EEPROM
• Light Sensor(LDR)
• Temperature sensor(LM35)
It is 8-bit microcontroller, means MC 8051 can Read, Write and Process 8 bit data.
This is mostly used microcontroller in the robotics, home appliances like mp3 player,
washing machines, electronic iron and industries. Mostly used blocks in the
architecture of 8051 are as follows:
• 4KB ROM
In 8051, 4KB read only memory (ROM) is available for program storage.This is used for
permanent data storage. Or the data which is not changed during the processing like the
program or algorithm for specific applications.
• 128 Byte RAM for Data Storage
MC 8051 has 128 byte Random Access memory for data storage. Random access
Memory is nonvolatile memory. During execution for storing the data the RAM
is used. RAM consists of the register banks, stack for temporary data storage.
Normally microcontroller has 256 byte RAM in which 128 byte is used for user space
which is normally Register banks and stack.
We know that 128 byte = 27byte
• Timers and Counters
In MC8051, two timer pins are available T0 and T1, by these timers we can
give the delay of particular time if we use these in timer mode.We can count external
pulses at these pins if we use these pins in counter mode.16 bits timers are available.
Means we can generate delay between 0000H to FFFFH.
If we want to load T0 with 16 bit data then we can load separate lower 8 bit in TL0 and
higher 8 bit in TH0. In the same way for T1. TMOD, TCON registers are used for
controlling timer operation.
• Serial Port
There are two pins available for serial communication TXD and RXD. Normally TXD is
used for transmitting serial data which is in SBUF register,RXD is used for receiving the
serial data.
• Input Output Ports
There are four input output ports available P0, P1, P2, P3. Each port is 8 bit wide and
has special function register P0, P1, P2, P3 which are bit addressable means each bit can be
set or reset by the Bit instructions (SETB for high, CLR for low) independently.Port 2 can
be used as I/O port as well as higher order address bus A8 to A15. Port 3 also have dual
functions it can be worked as I/O as well as each pin of P3 has specific function
Features:
• Easy interface to all microprocessors
• Operates ratio metrically or with 5 VDC or analog span
• adjusted voltage reference
• No zero or full-scale adjust required
• 8-channel multiplexer with address logic
• 0V to 5V input range with single 5V power supply
• Outputs meet TTL voltage level specifications
• ADC0808 equivalent to MM74C949
• ADC0809 equivalent to MM74C949-1
Key Specifications
• Resolution 8 Bits
• Total Unadjusted Error ±1⁄2 LSB and ±1 LSB
• Single Supply 5 VDC
• Low Power 15 mW
• Conversion Time 100
A real time clock is basically just like a watch - it runs on a battery and keeps time for you even when
there is a power outage! Using an RTC, you can keep track of long timelines, even if you reprogram
your microcontroller or disconnect it from USB or a power plug.
AT24C16
Features
• Low-voltage and Standard-voltage Operation– 2.7 (CC= 2.7V to 5.5V)– 1.8 (VCC= 1.8V to 5.5V)
•Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K),1024 x 8 (8K) or 2048 x 8 (16K)
•Two-wire Serial Interface
•Schmitt Trigger, Filtered Inputs for Noise Suppression
•Bidirectional Data Transfer Protocol
•100 kHz (1.8V) and 400 kHz (2.7V, 5V) Compatibility
•Write Protect Pin for Hardware Data Protection
•8-byte Page (1K, 2K), 16-byte Page (4K, 8K, 16K) Write Modes
•Partial Page Writes Allowed
•Self-timed Write Cycle (5 ms max)
•High-reliability
– Endurance: 1 Million Write Cycles
– Data Retention: 100 Year.
CR2032 battery
A CR2032 battery is a button cell lithium battery rated at 3.0 volts. It is commonly used in computers
as a CMOS battery, calculators, remote controls, scientific instruments, wireless doorbells, watches,
and other small devices.
D. Procedure:-
General Procedures for Keil µ Vision 5:-
1. Create a New folder on the desktop for saving the Project.
2. Double Click on the icon Keil µ Vision 5 present on the desktop.
3. Keil µ Vision 5 window will appear on desktop.
4. Close the Existing Project if exists.
5. Go to the project menu & click on New µ Vision project after this Create New
Project window will appear on desktop write the New Project Name Select
IC AT89S52 OK YES.
6. Go to target 1 & then source group, Right click on there & click on the
option “Add Files to the Group ‘Source Group 1’ ”.
7. Select your .asm or .c file which you want to add. depending on your coding
and then Add.
8. Program editing window will appear on desktop with New File Name.
9. Write or copy you code there & save (Ctrl+S).
10. Right click Target 1, go to the Option for Target ‘Target 1’ or (Alt+F7)
Option for Target ‘Target 1’ window will appear on desktop click on output
& tick on Create HEX File option and then OK.
11. Now click on “Translate current file”, “Build Target” and “Rebuilt all
target files”.
12. After this Hex file will be created in the New Folder.
13. It will show you 0 errors & 0 warning on Output Window.
After performing all these steps the chip will be configured through Xplore Flash.
How to use Xplore Flash
G. Conclusions:
The addition of two 8-bit numbers is performed using AT8051 Ultra Development Kit where
sum is 8 – bit result display on LEDS in Binary form.
H. Precautions:
1. Properly connect the AT89S52 Ultra Development Kit with USB Cable.
2. Handle the Trainer kit carefully.
Internet of Things Lab
EXPERIMENT No. : 02
Aim: - To familiarize with Intel Galileo Gen2 board and understand the procedure of creation and
compilation of C source code.
Objectives: Student should get the knowledge of Intel Galileo Board and different types of LED
Outcomes: Student will be Write program using Arduino IDE for Blink LED
Apparatus Used -
1. Intel® Galileo Board
2. Micro SD Card
3. SD Card Reader
4. +5V Power adapter
5. USB to Serial Cable
6. Micro USB Cable
Theory:- Galileo is a microcontroller board based on the Intel® Quark SoC X1000 Application
Processor, a 32-bit Intel Pentium-class system on a chip (datasheet). It’s the first board based on
Intel® architecture designed to be hardware and software pin-compatible with Arduino shields
designed for the Uno R3. Digital pins 0 to 13 (and the adjacent AREF and GND pins), Analog
inputs 0 to 5, the power header, ICSP header, and the UART port pins (0 and 1), are all in the same
locations as on the Arduino Uno R3. This is also known as the Arduino 1.0 pinout.
Galileo is designed to support shields that operate at either 3.3V or 5V. The core operating voltage
of Galileo is 3.3V. However, a jumper on the board enables voltage translation to 5V at the I/O pins.
This provides support for 5V Uno shields and is the default behavior. By switching the jumper
position, the voltage translation can be disabled to provide 3.3V operation at the I/O pins.
Procedure:
1. Connect a 5V power supply to the Galileo. (The USB port alone cannot supply enough power to
run the Galileo.)
2. Connect a micro-B USB cable from the Galileo’s USB Client port to an available USB
socket on your computer.
3. Upon connecting the board, Windows will automatically attempt to install the driver and,
unsurprisingly, it will fail. We’ll have to manually install the driver.
4. Open up the Device Manager. (Either Start > Run > devmgmt.msc, or go to the Control
Panel, select System and click Device Manager.)
5. Locate the Gadget Serial v2.4 device, under the Other devices tree. Right-click that and
select UpdAte Driver SoftwAre…
6. On the first window that pops up, click Browse my computer for driver software. And on
the next page selectBrowse… and navigate to the hardware\arduino\x86\tools folder within
your Arduino Galileo software installation. Then click Next.
7. Click Install on the next Windows Security window that pops up. And, after a number of
Loading-bar-scrolls, the installation should complete and you should be greeted with a Windows
has successfully updated your driver software window.
8. Look back at the Device Manager, under the Ports tree now. There should be an entry
for Galileo (COM #). Remember which COM # your Galileo is assigned, it’ll be important
for Arduino sketch uploading.
Uploading Blink
As always, the first program to be uploaded to a board is the “Hello, world” of microcontrollers -
Blink.
To open the Blink example, go to the File > Examples > 01.Basics > Blink.
/* Blink
Turns on an LED on for one second, then off
for one second, repeatedly. */
// Pin 13 has an LED connected on most Arduino
boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press
reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again
forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on
(HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off
by making the voltage LOW
delay(1000);
// wait for a second
}
Make sure the Serial Port and Board selections are still correct. Compilers supported are GCC and
ICC. Then click the Upload button. Upload Button will Compile and run the code.
After the upload completes, you should see a tiny, green LED blinking on and off every second.
This LED is connected to pin 13 of the Galileo.
Result :- Compilation and Installation of Arduino IDE & Drivers is done and process understood.
Conclusion :- Target board of such types can be used in low cost system designs using very less
amount of components and can be used for many user defined applications or customizations.
Internet of Things Lab
EXPERIMENT No. : 03
Aim: - Wifi module interfacing with Intel Galileo Gen2 Board.
Apparatus Used -
9. Intel® Galileo Board
10. Micro SD Card
11. SD Card Reader
12. +5V Power adapter
13. USB to Serial Cable
14. Micro USB Cable
Theory:-
Make a bootable micro SD card
You must boot your Intel® Galileo board using a micro SD card that contains the latest Intel®
IoT Developer Kit version of the Yocto*-built Linux image.
Linux is the operating system that powers the Intel® Galileo board. While there is already a
version of Linux built into your board, the developer-kit version of Yocto-built Linux includes
even more libraries and resources to help developers create applications in their favorite
programming language. This version includes GCC, Python, Node.js, OpenCV, to name a few.
This section contains steps to download and extract the latest developer kit version of the
Linux image.
5. In the file type drop-down list, select *.* so you can see all files, regardless of file extension.
6. Navigate to and select the .direct file that you extracted earlier, then click Open.
7. From the Device drop-down list, select the device drive of your micro SD card.
Caution: Be sure to select the correct device drive, as the drive letter for your card may be
different on your system. Selecting the wrong drive letter could result in erasing your data on
the wrong drive.
8. Click Write, then wait for the write process to finish. Please be patient, as this may take up to
5 minutes.
9. After completing the write process, click Exit to close Win32 Disk Imager. Eject and remove
the micro SD card from your card reader.
10. You can now insert the card into the micro SD card slot on your Intel Galileo board. When you
power up your board, the board automatically boots using the image on the card.
5. Plug the other end of the FTDI cable in to a USB port on your computer.
1. Assemble the wireless card with the aluminum plate, to help keep the wireless card in place on
the board.
2. Connect the antennas to the wireless card.
3. Insert wireless card in the mini PCI Express slot. Once the wireless card is inserted into the
Mini PCI Express slot, press the wireless card gently towards the board until it locks in place.
Login name root
To enable Wi-Fi
connmanctl> enable wifi
To scan Wi-Fi
connmanctl> scan wifi
Type “ping google.com” in the shell to see if Intel® Galileo Gen 2 is already
connected to internet.
Conclusions:
Precautions:
Internet of Things Lab
EXPERIMENT No. : 04
Aim: - To study of IoT Data Logging using Beaglebone Black and Thingspeak.
Apparatus Used -
1. Beaglebone Black
2. USB cable
3. Bread board
4. Light Dependent Resistor(LDR)
5. 10K Resistor
6. PC with internet connection and Putty installed.
7. Latest Debian distribution of Linux installed.
Theory:- The BeagleBone Black is unique in that it has quite a few pins that are available on easy to
use pin headers, as well as being a fairly powerful little system. There are 2 x 46 pins available (well,
not all of them are, but we'll get to that later) to use.
Some of the functionality that is available:
1. 7 Analog Pins
2. 65 Digital Pins at 3.3V
3. 2x I2C
4. 2x SPI
5. 2x CAN Bus
6. 4 Timers
7. 4x UART
8. 8x PWM
9. A/D Converter
Setting up Thingspeak
Thing speak is a free online cloud service that lets it's users to create data channels which they can connect
with their devices with the unique API Key generated with each channel. The connected device just need to
send an HTTP POST request along with the API key and the data to update the data channels. Don't worry if
it looks too complicated. Let's make it simple.
Create a Thingspeak account by clicking on getting started. Now you will be asked to register yourself with
thingspeak.
After you are registered you will be with a screen like this.
Now click on the "New Channel" button. You will have a form like this.
After filling up the Name you can save the channel by clicking on "Save Channel". I have given some extra
parameters for understanding but it is not mandatory.
Now you will get a window like this. In this window you ca visualize your channel feed. If you want to tweak
your window or add some more charts you are free to check out the documentations. For now we will
proceed with the basic window.
Now Click on the "API Key" tab to open a window like this
Note down the API Key. You will need this in order to connect your device to the newly created
channel. I have blotted out my API Key so that it doesn't become public.
Now follow the wiring diagram as shown below
Now start up your Beaglebone Black and Log in with your ID and password. Connect your BBB to
the internet.
Open Putty
That's it you are done. Now check the chart on your channel Private window where the data gets
updated every 15 seconds.
This is my chart getting updated here
Analysis of Results: (Write your own)
Conclusions:
Precautions:
Internet of Things Lab
EXPERIMENT No. : 05
Aim: -Turn your smartphone into an IoT device using the IBM Watson IoT Platform cloud-hosted
service.
Software Requirement: IBM Watson IoT Platform cloud-hosted service, Cloud Foundry apps, A
smartphone.
Theory:-
How you can send sensor data that is generated by your smartphone to the IBM Watson IoT
Platform cloud-hosted service, and then create Cloud Foundry apps on the IBM Cloud that process,
visualize, and store the data. Lastly, it shows you how to create an Android application for a smartphone.
Here is an overview of the architecture:
Procedure:
Click Create.
After your app is created, in the left pane, click Overview. Notice that your app contains two
connections, one to a Cloudant NoSQL database and another to an Internet of Things Platform
service.
Add a device that will send MQTT messages to the Watson IoT Platform
In the Overview view of your app, under Connections, click the Internet of Things Platform service,
named something like iot<_your name_="name_">-iotf-serviceiot<your name>-iotf-service.
A device type is a group of devices that share characteristics; for example, they might provide the
same sensor data. In our case, the device type name must be “Android” (this device type name is
required by the app that you will use later).
1. Click Next.
A page is displayed where you can enter metadata about the device type, such as a serial number or model.
You don’t need to specify this information for this demo. Just click Done.
1. Click Register Devices. Enter the device ID. The device ID can be, for example, the MAC address of
your smartphone. However, it must be unique within your organization only. Therefore, you might
enter, as I did here, something like “ --------------- ”.
Click Next. A page is displayed where you could enter metadata about the
device. Leave it blank, and click Next.
Click Next.
Provide a value for the authentication token. Remember this value for later.
Then, click Next.
Click Done.
Click Next. A page is displayed where you could enter metadata about the device. Leave it blank,
and click Next.
Provide a value for the authentication token. Remember this value for later. Then, click Next.
Click Back.
Now you are ready to send MQTT messages from a device to the IBM Watson IoT Platform.
1. On your phone, go to Settings > Security. Under Device Administration, enable Unknown sources.
Now you can install .apk files from outside of Google Play.
2. Open the browser on your phone, and enter this URL:
https://github.com/deveops/iot-starter-for-android/releases
Verify that messages are being sent from your smartphone to the Watson IoT Platform
1. Back on your computer, open the IBM Watson IoT Platform page for your organization again (see
the start of ).
2. In the left menu, click Devices. Your Android device is displayed.
Click the Device ID, and then go to the Recent Events tab. You should see
events coming from your smartphone.
Click the Device ID, and then go to the Recent Events tab. You should see events coming from your
smartphone.
Click one of the events. The messages that are sent from your smartphone are in JSON format.
They contain acceleration and position data.
Click one of the events. The messages that are sent from your smartphone are
in JSON format. They contain acceleration and position data.
Now you are ready to work with the message data on IBM Cloud.
Next
Finish
Save Password
On the Node-RED page for your IoT app, click Go to your Node-RED flow editor.
The editor opens, containing a sample flow.
Click to Login
Using the drag-and-drop features of this editor, you can plug together a flow of
messages. Although you can create your own flow here, we will import the code
below. But first, select all existing nodes, and delete them by pressing the Delete
key.
1. Download the following code (as a long single line of code) as a text file
(nodeRedCode.txt) from GitHub.
In the Node-RED editor, press Ctrl-I to open the Import Nodes dialog. Paste the
code, and click Import.
Now you need to adapt the flow to your specific parameters. The only relevant
parameter is the Device ID. Double-click the node IBM IoT App out. In the pop-
up window, enter the Device ID that you used earlier (for example, 112233445566),
and click Import.
Click Deploy in the flow editor. The flow is deployed and should be active
immediately.
Move your smartphone around; flip and tilt it. The background color of the app
on your phone should now change colors, depending on the orientation of the z-
axis.
Result:-
Conclusions:
Precautions: