IOT Practical

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

IOT(3160716) 200210107023

Practical: 1
Aim: Prepare brief report on Arduino tool and brief about its utility. Write a basic program on Arduino
that show case the various programming features of c. take example of operators, conditional statements,
loop etc

The Arduino Uno is an open source microcontroller board based on


the Microchip ATmega328P microcontroller and developed by Arduino.cc. The board is equipped with sets of
digital and analog input/output (I/O) pins that may be interfaced to various expansion boards (shields) and other
circuits. The board has 14 digital I/O pins (six capable of PWM output), 6 analog I/O pins, and is programmable
with the Arduino IDE (Integrated Development Environment), via a type B USB cable. It can be powered by a
USB cable or a barrel connector that accepts voltages between 7 and 20 volts, such as a rectangular 9-volt
battery. It is similar to the Arduino Nano and Leonardo. The hardware reference design is distributed under
a Creative Commons Attribution Share-Alike 2.5 license and is available on the Arduino website. Layout and
production files for some versions of the hardware are also available.

General pin functions:


 LED: There is a built-in LED driven by digital pin 13. When the pin is high value, the LED is on, when
the pin is low, it is off.
 VIN: The input voltage to the Arduino/Genuino board when it is using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage
through this pin, or, if supplying voltage via the power jack, access it through this pin.
 5V: This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with
power either from the DC power jack (7 - 20V), the USB connector (5V), or the VIN pin of the board
(7-20V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage the board.
 3V3: A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
 GND: Ground pins.
 IOREF: This pin on the Arduino/Genuino board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the
appropriate power source, or enable voltage translators on the outputs to work with the 5V or 3.3V.
 Reset: Typically used to add a reset button to shields that block the one on the board.

Special pin functions:


 Serial / UART: pins 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL serial chip.
 External interrupts: pins 2 and 3. These pins can be configured to trigger an interrupt on a low value, a
rising or falling edge, or a change in value.
 PWM (pulse-width modulation): pins 3, 5, 6, 9, 10, and 11. Can provide 8-bit PWM output with the
analogWrite() function.
 SPI (Serial Peripheral Interface): pins 10 (SS), 11 (MOSI), 12 (MISO), and 13 (SCK). These pins
support SPI communication using the SPI library.
 TWI (two-wire interface) / I²C: pin SDA (A4) and pin SCL (A5). Support TWI communication using
the Wire library.

1
IOT(3160716) 200210107023

 AREF (analog reference): Reference voltage for the analog inputs.

Example:
int ledPin = 2;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(LED, HIGH); //turn on an LED
digitalWrite(LED, LOW);

}
void setup() - this function executes only once, when the Arduino is powered on. Here we define things such as
the mode of a pin (input or output), the baud rate of serial communication or the initialization of a library.

void loop() - this is where we write the code that we want to execute over and over again, such as turning on/off
a lamp based on an input, or to conduct a sensor reading every X second.

2
IOT(3160716) 200210107023

Practical: 2
Aim:To study about basic operations of Arduino 1. Blinking of inbuilt LED 2. Blinking of external LED
attaching registers to control the flow of current i.e. intensity of light.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000); // wait for 1 second
digitalWrite(LED_BUILTIN, LOW);
delay(1000); // wait for 1 second
}

int pwmPin = 5;
int pwmValue = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(pwmPin, OUTPUT);
}

void loop() {
pwmValue = analogRead(A0) / 4;
analogWrite(pwmPin, pwmValue);
delay(10); // wait for 10 milliseconds
}

3
IOT(3160716) 200210107023

4
IOT(3160716) 200210107023

Practical: 3
Aim: To study about breadboard in Arduino and implement practical 2 with help of breadboard.
A breadboard (sometimes called protoboard) is essentially the foundation to construct and prototype electronics.
A breadboard allows for easy and quick creation of temporary electronic circuits or to carry out experiments
with circuit design.
void setup(){
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
}

void loop(){
digitalWrite(12, HIGH);
delay(500); // Wait for 500 millisecond(s)
digitalWrite(12, LOW);
delay(500); // Wait for 500 millisecond(s)
digitalWrite(11, HIGH);
delay(500); // Wait for 500 millisecond(s)
digitalWrite(11, LOW);
delay(500); // Wait for 500 millisecond(s)
digitalWrite(10, HIGH);
delay(500); // Wait for 500 millisecond(s)
digitalWrite(10, LOW);
delay(500); // Wait for 500 millisecond(s)
}

5
IOT(3160716) 200210107023

Practical: 4
Aim: Write a Arduino Code to Measure the Temperature data in Serial Monitor. Use DTH11 for the
same.
float pin =A0;
double temp, tempCel;
void setup(){
pinMode(A3,INPUT);
Serial.begin(9600);
}

void loop(){
temp = analogRead(pin);
float v =(temp/965.00)*5.0;
tempCel = (v - 0.5)*100;
Serial.println(tempCel);

Serial.println(temp);
delay(1000);
if(temp<0){
Serial.println("very low");
}
else if(temp>0 && temp<35){
Serial.println("Very Moderate");
}
else {
Serial.println("Very High");}
}

6
IOT(3160716) 200210107023

Practical:5
Aim: Implement a flame detector using Arduino. If there is any presence of flame buzzer should be
enabled

int a;
void setup() {
// put your setup code here, to run once:
pinMode(LED_BUILTIN, OUTPUT);
pinMode(2, INPUT);
}

void loop() {
// put your main code here, to run repeatedly:

a=digitalRead(2);
if(a == HIGH)
{
tone(LED_BUILTIN, 400);
}
else
{
noTone(LED_BUILTIN);
}

7
IOT(3160716) 200210107023

8
IOT(3160716) 200210107023

Practical: 6
Study about various tools for IoT development and prepare a document that describes the study of IoT
Application tools and Node MCU Micro controller

1. OpenRemote
OpenRemote is a platform you can use to create and manage IoT monitoring applications. The primary domains
leveraging the tool are smart city and mobility, energy management and asset management.
OpenRemote is offered under an open-source or a commercial license. The team behind it also provides a range
of services from concept development to implementation and product maintenance.

2. ThingsBoard
The ThingsBoard IoT platform uses MQTT, CoAP and HTTP protocols to connect devices and handle data
from them. Out-of-the-box configurable dashboards, charts, maps and widgets provide you with robust real-time
visualization of your data, which you can share with partners. In addition, you can create custom widgets using
the built-in editor.
ThingsBoard Rule Engine allows you to create rule chains and event-based workflows for the perfect match
with your use case requirements.
The platform can support multiple tenants and millions of devices. Cloud and on-prem deployment is available.
You can choose a monolithic architecture for a small project or a microservices architecture for a highly scalable
project.

3. Flutter
Another hardware product for IoT solutions is Flutter — a programmable processor core. The board is based on
Arduino, has a powerful ARM processor, built-in battery charging and a security chip. A long-range wireless
transmitter makes this board the perfect fit for wireless networks of sensors.
Flutter offers:
the Basic control module
the Pro control module
complete kits (Quick Start Kit, Vehicle Control Kits)
accessory boards (the Bluetooth adapter, the Breakout, the Remote Control, the Explorer)
a solar panel, a cylindrical battery and other accessories
3D-printed parts for your device.

4. Zetta
Zetta is a platform for designing APIs for IoT devices. The platform is based on Node.js and combines reactive
programming, WebSockets and REST APIs. A Zetta server can run in the cloud or locally on hardware such as
Raspberry Pi or Intel Edison.
The development process is simplified due to abstractions and direct access to protocols and conventions.
Visualization tools ensure the continuous monitoring of device behavior and timely reaction to abnormalities.
With Zetta, you can create data-intensive mobile, device and cloud applications and integrate smaller systems
into one coherent system.

5. Home Assistant
Home Assistant is a comprehensive home automation software system. This single center integrates smart home
devices, providing local control and security. Home Assistant offers convenient mobile applications that enable
the remote management of your devices and send notifications if something goes wrong. You can also extend
the functionality of this tool by integrating it with additional apps.

6. DeviceHive
The DeviceHive platform covers end-to-end IoT services, including:
prototyping and production at scale
connection of any devices via MQTT, REST API, WebSockets
integration with cloud platforms and third-party systems
real-time data analytics using the best data solutions such as Apache Spark and Kafka.
DeviceHive offers public, private, or hybrid cloud deployment models, a container-based architecture managed
by Kubernetes, and support to libraries written in various languages. You can use this scalable and device-
agnostic platform for implementing IoT projects of any complexity.

9
IOT(3160716) 200210107023

7. Node-RED
Node-RED is a free programming tool based on Node.js and designed to integrate distributed IoT hardware and
software systems and automate their interaction. It works primarily in Linux environments but can be installed
on Android and Windows as well (you’ll only need a Linux subsystem for WIndows). Node-RED offers out-of-
the-box repositories, interfaces for connecting to MQTT, logic sets and format parsers, as well as the ability to
write custom components.
You can extend Node-RED capabilities by integrating it with cloud platforms (Azure, AWS, IBM) and other
third-party systems.
8. Arduino
Arduino is the leading company on the IoT market that produces electronic devices and software for
them. Arduino hardware offerings include microcontroller boards, modules, shields and kits. Hardware
specifications are suitable for creating various projects, such as robotics and home automation.
Software products are represented by:
Arduino IDE — an open-source prototyping platform, which can be used to easily write code compatible with
any Arduino board.
Arduino Cloud — a single platform that enables the wireless communication of IoT devices, as well as their
remote control and data collection.
IoT Cloud Remote — an application for creating dashboards to control cloud-connected devices.
Web Editor — an application for coding from a browser.

9. Kinoma
A group of software engineers from Marvell Technology, Inc., a leading manufacturer of memory devices,
microcontrollers, telecom equipment and semiconductor devices, has developed a line of open-
source Kinoma software and hardware products for the Internet of Things and embedded solutions.
Kinoma Create — a hardware platform for prototyping IoT devices. It’s powered by   and has an
integrated SD card, speaker, microphone, Bluetooth and Wi-Fi. It enables the interaction of devices with cloud
platforms via the WebSocket internet protocol.
Kinoma Studio — an integrated development environment (IDE) that provides the hardware simulator and
sensor library, allowing developers to create robust applications.
Kinoma Connect — an application for Android and iOS supporting IoT devices.

About NodeMCU
NodeMCU stands for Node Microcontroller Unit. It is an open-source Lua-based firmware that is designed for
IoT(Internet of Things) applications. The module that runs this firmware is ESP-12E and that module is based
on 32-bit ESP8266 MCU.  It has 2.4 GHz Wi-Fi that supports WPA/WP2. The ESP-12E comes with a
programmer and a 3.3v SMPS unit. So, you do not need any external programmer to program this board and you
can easily run this board directly on 5V from USB.
Features of NodeMCU ESP-12E development board
 Operating Voltage: 3.0-3.6 V
 Operating Current: 80mA
 Operating temperature: -40 to 125 degree Celsius 
 32-bit MCU
 Integrated 10-bit ADC
 802.11 b/g/n
 Integrated TCP/IP protocol
 2.4 GHz Wi-Fi that supports WPA/WPA2
 It supports UART, SPI, I2C, IR remote, PWM, SDIO 2.0
 It has 20 I/O ports
 Applications of NodeMCU ESP-12E development board
 IP cameras 
 Home security
 Home Automation
 Wireless Control Systems
 Mesh network

10

You might also like