0% found this document useful (0 votes)
4 views37 pages

IOT-Lab-File Priya

Uploaded by

Pragati Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
4 views37 pages

IOT-Lab-File Priya

Uploaded by

Pragati Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 37

1

Date: _ _ /_ _ / 2024

Experiment - 1
AIM: To study the ARDUINO UNO and installation of IDE software for Arduino.
THEORY:

• Intro to Arduino.
Arduino is an open-source electronics platform based on easy-to-use hardware and
software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or
a Twitter message - and turn it into an output - activating a motor, turning on an LED,
publishing something online.

• ATmega 328 AVR microprocessor


ATmega328 is an Advanced Virtual RISC (AVR) microcontroller. It supports 8-bit data
processing. ATmega-328 has 32KB internal flash memory.

ATmega328 has 1KB Electrically Erasable Programmable Read-Only Memory (EEPROM). This
property shows if the electric supply supplied to the micro-controller is removed, even then
it can store the data and can provide results after providing it with the electric supply.
Moreover, ATmega-328 has 2KB Static Random Access Memory (SRAM). Other characteristics
will be explained later. ATmega 328 has several different features which make it the most
popular device in today's market. These features consist of advanced RISC architecture, good

ECE 2 Kumari Priya Sharma 10013202821


2
Date: _ _ /_ _ / 2024

performance, low power consumption, real timer counter having separate oscillator, 6 PWM
pins, programmable Serial USART, programming lock for software security, throughput up to
20 MIPS etc.

• Types of Arduino

1) Arduino Uno

The development of Arduino UNO board is considered as new compared to other Arduino
boards. This board comes up with numerous features that helps the user to use this in their
project. The Arduino UNO uses the Atmega16U2 microcontroller that helps to increase the
transfer rate and contain large memory compared to other boards. No extra devices are
needed for the Arduino UNO board like joystick, mouse, keyboard and many more. The
Arduino UNO contain SCL and SDA pins and also have two additional pins fit near to RESET
pin.

The board contains 14 digital input pins and output pins in which 6 pins are used as PWM, 6
pins as analog inputs, USB connection, reset button and one power jack. The Arduino UNO
board can be attached to computer system buy USB port and also get power supply to board
from computer system. The Arduino UNO contains flash memory of size 32 KB that is used to
the data in it. The other feature of the Arduino UNO is compatibility with other shield and can
be combined with other Arduino products.

2) Arduino Mega
This boards is considered as the microcontroller that uses the Atmega2560 in it. There are
total 54 input pins and output pins in it in which 14 pins are of PWM output, 4 pins are of
hardware port, 16 pins as analog inputs. The board also contain one USB connection, ICSP
header, power jack and one REST pin.

ECE 2 Kumari Priya Sharma 10013202821


3
Date: _ _ /_ _ / 2024

There are additional pins that act as crystal oscillator having frequency of 16 MHz. The board
also has flash memory of 256KB size that uses to store the data in it. The Arduino Mega board
can be attached to computer system via USB connection and power supply can be provided
to board by using battery or AC to DC adapter. As the board has large number of pins fitted in
it that make the board suitable for projects that requires more number of pins in it.
3) Arduino Nano
Arduino Nano are based on ATmega328P Microcontroller but Nano is significantly smaller in
size compared to UNO. The Type-B USB connector from Arduino UNO is replaced with mini-B
type connector. Also, there is no 2.1 mm DC jack to provide external power supply. Apart from
that, the layout of Arduino Nano is very much self-explanatory.

Arduino Nano has 32 KB of Flash Memory,2 KB of SRAM,1 KB of EEPROM,2 KB of the Flash


Memory is used by the bootloader code. 22 pins are associated with input and output. In that
14 pins (D0 to D13) are true digital IO pins, which can be configured as per you application
using pinMode(), digitalWrite() and digitalRead() functions. All these Digital IO pins are
capable of sourcing or sinking 40mA of current. An additional feature of the Digital IO pins is
the availability of internal pull-up resistor (which is not connected by default). The value of
the internal pull-up resistor will be in the range of 20KΩ to 50KΩ. There are also 8 Analog Input
Pins (A0 to A7). This is a couple more than Arduino UNO (which only has 6). All the analog

ECE 2 Kumari Priya Sharma 10013202821


4
Date: _ _ /_ _ / 2024

input pins provide a 10-bit resolution ADC feature, which can be read using analogRead()
function.
4) Arduino Leonardo
This board is considered as the microcontroller that uses the Atmega32u4 in it. There are total
20 digital input pins and output pins in it, in that 7 pins are used As PWM and 12 pins used as
analog inputs. The board also contain one micro USB connection, power jack, and one RESET
button fit in it. There are additional pins which act as crystal oscillator of frequency 16 MHz.

The Arduino Leonardo board can be attached to computer system via USB connection and
power supply can be provided to board by using battery or AC to DC adapter. The
microcontroller used by the Arduino Leonardo has in-built USB connection that removes the
dependency of extra processor in it. As there is no additional USB connection in the board, it
helps the board to act as mouse or keyboard for the computer system. The Arduino Leonardo
is considered as cheapest Arduino boards compare to other Arduino products.
5) Arduino Due
The Arduino Due is the first Arduino board based on a 32-bit ARM core microcontroller. With
54 digital input/output pins, 12 analog inputs, 2 DAC and 2 CAN it is the perfect board for
powerful larger scale Arduino projects.

ECE 2 Kumari Priya Sharma 10013202821


5
Date: _ _ /_ _ / 2024

The Arduino Due is a microcontroller board based on the Atmel SAM3X8E ARM Cortex-M3
CPU. It is the first Arduino board based on a 32-bit ARM core microcontroller. It has 54 digital
input/output pins (of which 12 can be used as PWM outputs), 12 analog inputs, 4 UARTs
(hardware serial ports), a 84 MHz clock, an USB OTG capable connection, 2 DAC (digital to
analog), 2 TWI, a power jack, an SPI header, a JTAG header, a reset button and an erase button.
6) Arduino Pro Mini
The Arduino Pro Mini is a microcontroller board based on the ATmega328P. It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, an on-board
resonator, a reset button, and holes for mounting pin headers. A six pin header can be
connected to an FTDI cable or Spark fun breakout board to provide USB power and
communication to the board.

Installation of Arduino
Step 1: Download and Install the IDE

You can download the IDE from the official Arduino website. Since the Arduino uses a USB to
serial converter (which allow it to communicate with the host computer), the Arduino board
is compatible with most computers that have a USB port. Of course, you will need the IDE first.
Luckily, the Arduino designers have released multiple versions of the IDE for different
operating systems, including Windows, Mac, and Linux. In this tutorial, we will use Window
10, so ensure that you download the correct version of the IDE if you do not have Windows
10.

ECE 2 Kumari Priya Sharma 10013202821


6
Date: _ _ /_ _ / 2024

Once downloaded, install the IDE and ensure that you enable most (if not all) of the options,
INCLUDING the drivers.
Step 2: Get the Arduino COM Port Number
Next, you’ll need to connect the Arduino Uno board to the computer. This is done via a USB
B connection. Thanks to the wonderful world of USB, we do not need to provide power to the
Arduino, as the USB provides 5V up to 2A. When the Arduino is connected, the operating
system should recognize the board as a generic COM port (for example, my Arduino Uno uses
a CH340G, which is an RS-232 serial to USB converter). Once it’s recognized, we will need to
find out what port number it has been assigned. The easiest way to do this is to type “device
manager” into Windows Search and select Device Manager when it shows.

In the Device Manager window, look for a device under “Ports (COM & LPT)”, and chances are
the Arduino will be the only device on the list. In my Device Manager, the Arduino shows up
as COM7 (I know this because CH340 is in the device name).

ECE 2 Kumari Priya Sharma 10013202821


7
Date: _ _ /_ _ / 2024

Be warned, the Arduino won’t always be recognized automatically. If your Arduino is not
recognized. then uninstall the driver, remove the Arduino, reinsert the Arduino, find the
unrecognized device, right click “Update driver”, and then click “Search automatically”. This
should fix 99 out of 100 problems.
Windows can be a real pain sometimes with COM ports, as it can magically change their
numbers between connections. In other words, one day, your Arduino may be on port 7 (as
shown here), but then on other days, Windows may shift it to a different port number. As I
understand it, this happens when you connect other COM ports to your system (which I do
frequently).
So, if you can’t find your Arduino on the port that you usually use, just go to your Device
Manager and check what port it’s actually on and, if necessary, update your driver.

Step 3: Configure the IDE

Now that we have determined the COM port that the Arduino is on, it’s time to load the
Arduino IDE and configure it to use the same device and port. Start by loading the IDE. Once
it’s loaded, navigate to Tools > Board > Arduino Uno. However, if you are using a different
board (i.e., not the Arduino Uno), you must select the proper board!

ECE 2 Kumari Priya Sharma 10013202821


8
Date: _ _ /_ _ / 2024

Next, you must tell the IDE which COM port the Arduino is on. To do this, navigate to Tools >
Port > COM7. Obviously, if your Arduino is on a different port, select that port instead.

Step 4: Loading a Basic Example

For the sake of simplicity, we will load an example project that the Arduino IDE comes with.
This example will make the onboard LED blink for a second continuously. To load this example,
click File > Examples > 01.Basics > Blink.

ECE 2 Kumari Priya Sharma 10013202821


9
Date: _ _ /_ _ / 2024

With the example loaded, it’s time to verify and upload the code. The verify stage checks the
code for errors, then compiles the ready-for-uploading code to the Arduino. The upload stage
actually takes the binary data, which was created from the code, and uploads it to the Arduino
via the serial port.

To verify and compile the code, press the check mark button in the upper left window.

ECE 2 Kumari Priya Sharma 10013202821


10
Date: _ _ /_ _ / 2024

If the compilation stage was successful, you should see the following message in the output
window at the bottom of the IDE. You might also see a similar message—just it’s one that
does not have words like “ERROR” and “WARNING”.

With the code compiled, you must now upload it the Arduino Uno. To do this, click the arrow
next to the check mark.

#CODE

ECE 2 Kumari Priya Sharma 10013202821


11
Date: _ _ /_ _ / 2024

Experiment – 2

AIM: Familiarisation with the concept of IoT and characteristics and the components to be
used.

THEORY:

ECE 2 Kumari Priya Sharma 10013202821


12
Date: _ _ /_ _ / 2024

• Components

1) Arduino Board

The major components of Arduino UNO board are as follows:

• USB connector: This is a printer USB port used to load a program from the Arduino IDE
onto the Arduino board. The board can also be powered through this port.
• Power port: The Arduino board can be powered through an AC-to-DC adapter or a
battery. The power source can be connected by plugging in a 2.1mm centre-positive
plug into the power jack of the board.
• Microcontroller: It is the most prominent black rectangular chip with 28 pins. Think of
it as the brains of your Arduino. The microcontroller used on the UNO board is
Atmega328P by Atmel ( a major microcontroller manufacturer). Atmega328P is pre-
programmed with bootloader. This allows you to directly upload a new Arduino
program into the device, without using any external hardware programmer, making
the Arduino UNO board easy to use.
• Analog input pins: The Arduino UNO board has 6 analog input pins, labelled “Analog
0 to 5.” These pins can read the signal from an analog sensor like a temperature sensor
and convert it into a digital value so that the system understands. These pins just
measure voltage and not the current because they have very high internal resistance.
Hence, only a small amount of current flows through these pins. Although these pins
are labelled analog and are analog input by default, these pins can also be used for
digital input or output.
• Digital pins: You can find these pins labelled “Digital 0 to 13.” These pins can be used
as either input or output pins. When used as output, these pins act as a power supply
source for the components connected to them. When used as input pins, they read
the signals from the component connected to them. When digital pins are used as
output pins, they supply 40 milliamps of current at 5 volts, which is more than enough
to light an LED.
These pins act as normal digital pins but can also be used for Pulse-Width Modulation
(PWM), which simulates analog output like fading an LED in and out.

ECE 2 Kumari Priya Sharma 10013202821


13
Date: _ _ /_ _ / 2024

• Reset switch: When this switch is clicked, it sends a logical pulse to the reset pin of the
Microcontroller, and now runs the program again from the start. This can be very
useful if your code doesn’t repeat, but you want to test it multiple times.
• Crystal oscillator: This is a quartz crystal oscillator which ticks 16 million times a
second. On each tick, the microcontroller performs one operation, for example,
addition, subtraction, etc.
• USB interface chip: Think of this as a signal translator. It converts signals in the USB
level to a level that an Arduino UNO board understands.
• TX RX LEDs: TX stands for transmit, and RX for receive. These are indicator LEDs which
blink whenever the UNO board is transmitting or receiving data. Now that you have
explored the Arduino UNO board, you have started your journey toward building your
first IoT prototype. In the next article, we will discuss Arduino programming and do a
few experiments with Arduino and LEDs.
2) ESP-32
The ESP32 family includes the chips ESP32-D0WDQ6 (and ESP32-D0WD), ESP32-D2WD,
ESP32-S0WD, and the system in package (SiP) ESP32-PICO-D4. At its heart, there's a dual-core
or single-core Tensilica Xtensa LX6 microprocessor with a clock rate of up to 240 MHz. ESP32
is highly integrated with built-in antenna switches, RF balun, power amplifier, low-noise
receive amplifier, filters, and power management modules. Engineered for mobile devices,
wearable electronics, and IoT applications, ESP32 achieves ultra-low power consumption
through power saving features including fine resolution clock gating, multiple power modes,
and dynamic power scaling.

• Processors:
1) Main processor: Tensilica Xtensa 32-bit LX6 microprocessor
2) Cores: 2 or 1 (depending on variation)

ECE 2 Kumari Priya Sharma 10013202821


14
Date: _ _ /_ _ / 2024

- All chips in the ESP32 series are dual-core except for ESP32-S0WD, which is single-core.
3) Clock frequency: up to 240 MHz
4) Performance: up to 600 DMIPS
5) Ultra-low power co-processor: allows you to do ADC conversions, computation, and level
thresholds while in deep sleep.
• Wireless connectivity:
1) Wi-Fi: 802.11 b/g/n/e/i (802.11n @ 2.4 GHz up to 150 Mbit/s)
2) Bluetooth: v 4.2 BR/EDR and Bluetooth Low Energy (BLE)
3) Memory:
Internal memory: ROM: 448 KiB
For booting and core functions.
SRAM: 520 KiB
For data and instruction.
Embedded flash: Flash connected internally via IO16, IO17, SD_CMD, SD_CLK, SD_DATA_0
and SD_DATA_1 on ESP32-D2WD and ESP32-PICO-D4.
a) 0 MiB (ESP32-D0WDQ6, ESP32-D0WD, and ESP32-S0WD chips)
b) 2 MiB (ESP32-D2WD chip)
c) 4 MiB (ESP32-PICO-D4 SiP module)
4) External flash & SRAM: ESP32 supports up to four 16 MiB external QSPI flashes and
SRAMs with hardware encryption based on AES to protect developers' programs and data.
ESP32 can access the external QSPI flash and SRAM through high-speed caches.
a) Up to 16 MiB of external flash are memory-mapped onto the CPU code space,
supporting 8-bit, 16-bit and 32-bit access. Code execution is supported.
b) Up to 8 MiB of external flash/SRAM memory are mapped onto the CPU data space,
supporting 8-bit, 16-bit and 32-bit access. Data-read is supported on the flash and
SRAM. Data-write is supported on the SRAM.
ESP32 chips with embedded flash do not support the address mapping between
external flash and peripherals.
5) Peripheral input/output: Rich peripheral interface with DMA that includes capacitive
touch, ADCs (analog-to-digital converter), DACs (digital-to-analog converter), I²C (Inter-
Integrated Circuit), UART (universal asynchronous receiver/transmitter), CAN 2.0
(Controller Area Network), SPI (Serial Peripheral Interface), I²S (Integrated Inter-IC Sound),
RMII (Reduced Media-Independent Interface), PWM (pulse width modulation), and more.
6) Security:
a) IEEE 802.11 standard security features all supported, including WFA, WPA/WPA2 and
WAPI
b) Secure boot
c) Flash encryption
d) 1024-bit OTP, up to 768-bit for customers
e) Cryptographic hardware acceleration: AES, SHA-2, RSA, elliptic curve cryptography
(ECC), random number generator (RNG)
3) Sensors

ECE 2 Kumari Priya Sharma 10013202821


15
Date: _ _ /_ _ / 2024

The sensors are defined as a machine, module, or a device that detect changes in the
environment. The sensors transfer those changes to the electronic devices in the form of a
signal. The sensor is a device, which is made up of Single Crystal Silicon. It is considered as a
widely used semiconductor material. It has superior mechanical stability, machinability, etc. It
can also combine electronics and sensing elements on the same substrate.

• Temp and Humidity sensor

The DHT11 is a commonly used Temperature and humidity sensor. The sensor comes with a
dedicated NTC to measure temperature and an 8-bit microcontroller to output the values of
temperature and humidity as serial data. The sensor is also factory calibrated and hence easy
to interface with other microcontrollers.The sensor can measure temperature from 0°C to
50°C and humidity from 20% to 90% with an accuracy of ±1°C and ±1%. So if you are looking
to measure in this range then this sensor might be the right choice for you.

• PIR sensor
Passive infrared (PIR) sensors use a pair of pyroelectric sensors to detect heat energy in
the surrounding environment. These two sensors sit beside each other, and when the
signal differential between the two sensors changes (if a person enters the room, for
example), the sensor will engage. That may mean it triggers an alarm, notifies
authorities, or maybe turns on a floodlight. IR radiation focuses on each of the two
pyroelectric sensors using a series of lenses constructed as the sensor’s housing. These
lenses widen the device’s sensing area.

ECE 2 Kumari Priya Sharma 10013202821


16
Date: _ _ /_ _ / 2024

While the lens setup and sensor electronics are sophisticated technology, these units
are easy to use in a practical application. You only need power and ground for the
sensor to produce a discreet output that’s strong enough for a microcontroller to use.
Typical adjustments include adding potentiometers for sensitivity and tweaking how
long a PIR stays engaged once it’s triggered. You can also toggle the sensor between:

1. Staying on for a set amount of time after detecting movement.


2. Pulsing on and off in a “non-retriggering” mode.

• IR Sensor

IR technology is used in daily life and also in industries for different purposes. For example,
TVs use an IR sensor to understand the signals which are transmitted from a remote control.
The main benefits of IR sensors are low power usage, their simple design & their convenient
features. IR signals are not noticeable by the human eye. The IR radiation in
the electromagnetic spectrum can be found in the regions of the visible & microwave. Usually,
the wavelengths of these waves range from 0.7 µm 5 to 1000µm. The IR spectrum can be
divided into three regions like near-infrared, mid, and far-infrared. The near IR region’s
wavelength ranges from 0.75 – 3µm, the mid-infrared region’s wavelength ranges from 3 to
6µm & the far IR region’s infrared radiation’s wavelength is higher than 6µm.

ECE 2 Kumari Priya Sharma 10013202821


17
Date: _ _ /_ _ / 2024

IR sensors are classified into different types depending on the applications. Some of the typical
applications of different types of sensors. The speed sensor is used for synchronizing the
speed of multiple motors. The temperature sensor is used for industrial temperature
control. PIR sensor is used for an automatic door opening system and the Ultrasonic sensor is
used for distance measurement.

• Ultrasonic sensor
HC-SR04 Ultrasonic (US) sensor is a 4-pin module, whose pin names are Vcc, Trigger, Echo and
Ground respectively. This sensor is a very popular sensor used in many applications where
measuring distance or sensing objects are required. The module has two eyes like projects in
the front which forms the Ultrasonic transmitter and Receiver.
The Ultrasonic transmitter transmits an ultrasonic wave, this wave travels in air and when it
gets objected by any material it gets reflected back toward the sensor this reflected wave is
observed by the Ultrasonic receiver module.

Now, to calculate the distance using the above formulae, we should know the Speed and time.
Since we are using the Ultrasonic wave we know the universal speed of US wave at room

ECE 2 Kumari Priya Sharma 10013202821


18
Date: _ _ /_ _ / 2024

conditions which is 330m/s. The circuitry inbuilt on the module will calculate the time taken
for the US wave to come back and turns on the echo pin high for that same particular amount
of time, this way we can also know the time taken. Now simply calculate the distance using a
microcontroller or microprocessor.

• Gas Sensor
A gas sensor is mainly used to detect multiple gasses in the atmosphere. It is a device that
responds to the concentration of gasses (in parts per million or ppm) in the environment
where it is installed. The device works by creating a potential difference by altering the
material's internal sensor's resistance.

• Touch sensor
Touch sensors work similar to a switch. When they are subjected to touch, pressure or force
they get activated and acts as a closed switch. When the pressure or contact is removed, they
act as an open switch. Capacitive touch sensor contains two parallel conductors with an
insulator between them.

When these conductor plates come in contact with our fingers, our finger acts as a conductive
object. Due to this, there will be an uncertain increase in the capacitance. A capacitance
measuring circuit continuously measures the capacitance C0 of the sensor. When this circuit
detects a change in capacitance it generates a signal. The resistive touch sensors calculate the
pressure applied on the surface to sense the touch. These sensors contain two conductive

ECE 2 Kumari Priya Sharma 10013202821


19
Date: _ _ /_ _ / 2024

films coated with indium tin oxide, which is a good conductor of electricity, separated by a
very small distance.

• Flame OR sensor
Flame sensors, also known as flame detectors or flame sensors, are devices designed to detect
the presence of an open flame, fire, or other sources of intense heat and light. They are widely
used in various applications, primarily for safety and control purposes. Flame sensors operate
on the principle of detecting the specific wavelengths of light emitted by flames, and they play
a crucial role in preventing fires and ensuring safety in many industries.

The flame sensors available in the market with two categories one is having three pins (D0,
Gnd, Vcc) and second one is having four pins (A0, D0, Gnd, Vcc) both are can be easily
interfaced with Arduino and Arduino compatible boards.

• Smoke sensor

Smoke sensors, such as photoelectric or ionization detectors, operate based on distinct


principles. Photoelectric sensors use a light source and a sensor to detect smoke particles that

ECE 2 Kumari Priya Sharma 10013202821


20
Date: _ _ /_ _ / 2024

scatter the light. When smoke is present, it scatters the light, triggering an alarm. Ionization
detectors contain a small radioactive source that ionizes the air, creating a small electrical
current. When smoke enters the chamber, it disrupts the current, causing the alarm to
activate. Both types of sensors provide early fire detection by detecting smoke particles or
changes in ionization due to combustion, thereby alerting occupants to potential fire hazards.

• Heartbeat sensor
Heartbeat sensors, commonly found in medical devices like pulse oximeters, work on the
principle of photoplethysmography (PPG). PPG measures blood volume changes in peripheral
tissues as blood pulses through them. When light (typically an LED) is shone onto the skin, the
absorption of this light varies with blood volume changes, as blood absorbs more light than
surrounding tissue.

A photodetector measures the light that passes through or reflects off the skin, resulting in a
waveform that corresponds to the heartbeat. By analysing the variations in this waveform, the
sensor can calculate heart rate and oxygen saturation levels in the blood, among other vital
signs.

• Soil sensor
Soil sensors operate on the principle of measuring soil moisture content and sometimes other
parameters like temperature and salinity. They typically use either capacitive or resistive
sensing methods. Capacitive sensors measure changes in electrical capacitance as the soil
moisture level changes, while resistive sensors gauge the electrical resistance between two
electrodes in the soil, which varies with moisture levels. By analysing these electrical changes,
the sensors provide data on soil moisture, enabling precise irrigation and agriculture
management, as well as environmental monitoring. This information helps optimize water
usage, increase crop yield, and prevent overwatering or underwatering of plants, ultimately
conserving resources.

ECE 2 Kumari Priya Sharma 10013202821


21
Date: _ _ /_ _ / 2024

4) Raspberry pi
The Raspberry Pi is a small, affordable, credit card-sized computer that has gained immense
popularity for its versatility. It features a CPU, RAM, and GPU on a single board. Users can load
various operating systems onto an SD card, transforming it into a full-fledged computer. It
offers a range of ports, including HDMI, USB, and GPIO, making it suitable for diverse projects.
The Raspberry Pi is widely used for educational purposes, as a media centre, for IoT
applications, robotics, and more. Its low cost, compact size, and community support have
made it a favourite among hobbyists, educators, and developers for innovative and practical
computing projects.

The Raspberry Pi is a credit card-sized single-board computer designed for diverse


applications. Its working principle involves a compact system-on-chip (SoC) architecture,
featuring a CPU, RAM, GPU, and various interfaces. Upon power-up, the operating system
loads from an SD card, enabling users to run a wide range of software and programs. The GPIO
(General Purpose Input/Output) pins facilitate hardware interaction, and it connects to
peripherals through USB, HDMI, and Ethernet ports. Users can customize and expand its

ECE 2 Kumari Priya Sharma 10013202821


22
Date: _ _ /_ _ / 2024

capabilities, making it ideal for education, DIY projects, and even embedded systems, thanks
to its affordability and versatility.
5) SD card
An SD (Secure Digital) card is a compact, portable flash memory storage device used in various
electronic devices, such as cameras, smartphones, and digital music players. These small,
durable cards offer high data storage capacity and fast data transfer speeds, making them ideal
for storing photos, videos, documents, and more. They come in different sizes, with microSD
cards being the most common. SD cards are also used in embedded systems and single-board
computers. Their reliability, versatility, and ease of use make them a popular choice for
expanding device storage and transferring data between devices.

It works by using non-volatile memory to store digital data. Inside the SD card, a flash memory
chip stores data as electrical charges. When data is written, these charges are trapped in
memory cells, and when data is read, the charges are measured to retrieve the stored
information. SD cards have a controller that manages data storage and retrieval, file systems,
and wear-levelling to ensure even usage of memory cells.

Experiment - 3
AIM: To demonstrate analog read/write function using potentiometer with Arduino UNO.

Apparatus used:

• Arduino UNO
• USB 2.0 cable type A/B
• Potentiometer
• Breadboard
• Wires

Circuit diagram:

Connect the three wires from the potentiometer to your board. The first goes from one of
the outer pins of the potentiometer to ground.

ECE 2 Kumari Priya Sharma 10013202821


23
Date: _ _ /_ _ / 2024

The second goes from the other outer pin of the potentiometer to 5 volts. The third goes
from the middle pin of the potentiometer to the analog pin A0.

Theory:

A potentiometer is a variable resistor with three terminals. By adjusting the resistance, it


divides the voltage in a circuit, acting as a voltage divider. In this setup, the varying
resistance of the potentiometer changes the voltage at its output terminal, and Arduino
reads this analog voltage. it is possible to measure the amount of resistance produced by a
potentiometer (or pot for short) as an analog value. In this example you will monitor the

ECE 2 Kumari Priya Sharma 10013202821


24
Date: _ _ /_ _ / 2024

state of your potentiometer after establishing serial communication between your Arduino
and your computer running the Arduino Software (IDE).

Procedure:

1. Plug the potentiometer on the breadboard, with each leg on an independent line.
Note: some potentiometers have a different layout, with 2 pins facing one side, and
the middle pin facing the other side. In this case, plug the potentiometer in the
middle of the breadboard so it will be easier to add wires to the circuit.
2. Connect one of the external leg of the potentiometer to the ground of the Arduino
(GND).
3. Connect the other external leg to the power supply (5V).
4. Plug the middle leg to an analog pin of the Arduino, for example here A0.
5. Enter the code in Arduino IDE given below and run the program/sketch:

Code:

Conclusion:

ECE 2 Kumari Priya Sharma 10013202821


25
Date: _ _ /_ _ / 2024

The experiment successfully demonstrates the analog read function using a


potentiometer with Arduino. The code reads the varying voltage from the
potentiometer, and the values are printed to the serial monitor. This can serve as a basis
for various applications such as controlling motor speed, LED intensity, or any other
system where analog input is required. Understanding analog read and write functions is
crucial for developing interactive and responsive Arduino projects.

Experiment - 4
AIM: Demonstrate digital read/write function by blinking built in LED with Arduino UNO.
Apparatus used:

• Arduino UNO
• USB 2.0 cable type A/B

Circuit diagram:

• Connect the longer leg of the LED to digital pin 7 of the Arduino board.
• Connect the shorter leg of the LED to the ground (GND) pin of the Arduino
board.

ECE 2 Kumari Priya Sharma 10013202821


26
Date: _ _ /_ _ / 2024

Theory:

The built-in LED on an Arduino board is a small light-emitting diode (LED) that is connected
to one of the board's digital pins. It is typically used as a simple debugging tool or to provide
feedback on the board's operation.

The built-in LED is usually located near the reset button on the board. It is connected to the
digital pin that is designated as LED_BUILTIN. The pin number for LED_BUILTIN varies
depending on the specific Arduino board. For example, on the Arduino Uno, the built-in LED
is connected to pin 13.

To control the built-in LED, you can write a program that sets the LED_BUILTIN pin to HIGH to
turn the LED on, or to LOW to turn the LED off. You can also use the built-in LED to create
simple blinking patterns.

Procedure:

ECE 2 Kumari Priya Sharma 10013202821


27
Date: _ _ /_ _ / 2024

1. In the setup function, initialize digital pin 13 as an output with the command:
pinMode(13, OUTPUT).
2. In the main loop of your code, turn the LED on with the command:
digitalWrite(13, HIGH).
3. Wait for a second with the command: delay(2000).
4. Turn the LED off with the command: digitalWrite(13, LOW).
5. Wait for another second with the command: delay(2000).

Code:

ECE 2 Kumari Priya Sharma 10013202821


28
Date: _ _ /_ _ / 2024

Conclusion:

The experiment effectively demonstrates the digital read and write functions of Arduino
by blinking the built-in LED. By manipulating the state of the digital pin, the LED
alternates between on and off states. This foundational understanding of digital control
is essential for programming various applications, from simple LED blinking to more
complex projects involving digital sensors, actuators, and communication.

ECE 2 Kumari Priya Sharma 10013202821


29
Date: _ _ /_ _ / 2024

Experiment - 5

AIM: To measure light intensity using LDR with Arduino UNO.

Apparatus: Arduino UNO Board, Resistors, Breadboard, LED, Connecting wires,


LDR(Light dependent Resistor), IDE Software.

THEORY:

Light Intensity is usually measured to control the switching on and off of the light in the
Home Automation system. LDR sensor is the photoresistor that plays a major role in the
Light Intensity Measurement circuit. Arduino is the brain behind smart lightning. LDR
sensor full form is Light Dependent Resistor. The final step before deploying the smart
lighting system is to fine-tune the Arduino code using the Arduino IDE, adjusting the
thresholds for light intensity levels to ensure seamless and precise control over the LED
brightness. Devices and circuits are usually designed and simulated on software before
building the circuit itself.

This ensures circuit safety and makes it easy to build the circuit without worrying about
any hazards from the design. Tinker Cad is an online simulation software for electronic
circuits. Let us explore how to measure Light Intensity using LDR and Arduino.

CIRCUIT DIAGRAM:

ECE 2 Kumari Priya Sharma 10013202821


30
Date: _ _ /_ _ / 2024

PROCEDURE:
1. Connect the Circuit:

• Connect one leg of the LDR to the 5V pin on the Arduino.


• Connect the other leg of the LDR to the A0 analog input pin on the Arduino.
• Connect one leg of the resistor (10kΩ) to the A0 pin on the Arduino.
• Connect the other leg of the resistor to the GND (ground) pin on the Arduino.
• Connect the junction between the LDR and resistor to the A0 pin.
2. Set Up Arduino IDE:

• Make sure you have the Arduino IDE installed on your computer.
• Connect your Arduino Uno to your computer using a USB cable.
3. Write and upload the Arduino Code:

• Open the Arduino IDE.


• Write or copy the provided Arduino code into the IDE.
• Upload the code to your Arduino Uno

4. Open Serial Monitor: Open the Serial Monitor in the Arduino IDE (Tools -> Serial Monitor).
RESULT: As the light conditions change, the LDR readings and voltage will vary, resulting in
different light intensity percentage values. Higher values indicate higher light intensity

ECE 2 Kumari Priya Sharma 10013202821


31
Date: _ _ /_ _ / 2024

Experiment - 6
AIM: To measure humidity and temperature using DHT11 with Arduino UNO.
Apparatus: Arduino UNO Board, DHT11 (Temperature and humidity Sensor), Resistor,
Potentiometer, Breadboard, Connecting Wires, IDE Software.
THEORY :
We need the temperature and humidity measurement to understand the environmental
conditions for a given zone. We might use google or any whether predicting site for the same
but often they do not show the real time data and most of the data is averaged out and often
based on predicting algorithms. We might also need to measure temperature and humidity
level of a closed chamber manufacturing process where controlling the temperature and
humidity of a process is of utmost importance. In this project we will be using Arduino Uno
and DHT11 Temperature and Humidity Sensor to measure the ambient temperature and
humidity in the air and display the measured values on a 16x2 LCD screen.

PROCEDURE:
1. Connect the Circuit:

• Connect the DHT11 sensor to the Arduino Uno using jumper wires.
• Connect the VCC pin of the DHT11 to the 5V pin on the Arduino.
• Connect the GND pin of the DHT11 to the GND pin on the Arduino.
• Connect the Data pin of the DHT11 to a digital pin on the Arduino, e.g., D2.
2. Set Up Arduino IDE:

• Make sure you have the Arduino IDE installed on your computer.
• Connect your Arduino Uno to your computer using a USB cable.
3. Open the Arduino IDE.

• Go to "Sketch" -> "Include Library" -> "Manage Libraries..."

ECE 2 Kumari Priya Sharma 10013202821


32
Date: _ _ /_ _ / 2024

• In the Library Manager, type "DHT" in the search bar.


• Find the "DHT sensor library" by Adafruit, and click "Install."
4. Write and Upload the Arduino Code:

• Open a new sketch in the Arduino IDE.


• Write or copy the following Arduino code:

5. Upload the Code: Upload the code to your Arduino Uno.


6. Open Serial Monitor: Open the Serial Monitor in the Arduino IDE (Tools -> Serial Monitor).

Result: This system is compact to an extent and cost effective when compared to prices of
instruments used to measure the environmental factors.

ECE 2 Kumari Priya Sharma 10013202821


33
Date: _ _ /_ _ / 2024

Experiment -7
AIM: Design and implement a smoke level detector using Arduino IDE.
THEORY:
The MQ2 sensor is one of the most widely used in the MQ sensor series. It is a MOS (Metal
Oxide Semiconductor) sensor. Metal oxide sensors are also known as Chemiresistors because
sensing is based on the change in resistance of the sensing material when exposed to gasses.

The MQ2 gas sensor operates on 5V DC and consumes approximately 800mW. It can detect
LPG, Smoke, Alcohol, Propane, Hydrogen, Methane and Carbon Monoxide concentrations
ranging from 200 to 10000 ppm.
Note that the MQ2 gas sensor detects multiple gasses, but cannot identify them! That is
normal; most gas sensors operate in this manner. Therefore, it is best suited for measuring
changes in a known gas density rather than detecting which one is changing.

Apparatus: Arduino UNO, MQ2 gas sensor, Breadboard(optional), Jumper cables, USB cable,
Buzzer, 7-12 V DC battery

Diagram:

ECE 2 Kumari Priya Sharma 10013202821


34
Date: _ _ /_ _ / 2024

Procedure:
1. Connect the VCC pin of the sensor to the 5V of the Arduino.
2. Connect the GND of the sensor to the GND of the Arduino.
3. Connect the digital pin of the sensor D0 to the digital pin number 8 of the Arduino
4. Connect the analog pin of the sensor to the analog pin A0 of the Arduino.
Now connect the buzzer to the Arduino using D3 and GND pin

Code:

Result:

Conclusion:
In conclusion, the MQ2 gas/smoke sensor demonstrated promising capabilities in detecting
and responding to the targeted gas or smoke. Its quick response time, recovery
characteristics, and sensitivity make it a valuable tool for applications requiring gas
monitoring. However, careful consideration of its limitations and appropriate calibration are
necessary for accurate and reliable results in diverse environmental conditions

ECE 2 Kumari Priya Sharma 10013202821


35
Date: _ _ /_ _ / 2024

EXPERIMENT-8
AIM: IOT Project: Attaching Flow Sensor to an Arduino Uno to measure liquid flow.
Theory: We will be attaching a Flow Sensor to an Arduino Uno to measure liquid flow. This
type of flow sensor is designed to measure the volume of liquid traveling past a given point,
a great way to keep tabs on how much water your drip irrigation system is using, or any
other project were the flow of liquid needs to be tracked. We like this basic flow sensors
because of its relatively low cost and ease of use.
Flow Sensor The water flow sensor consists of a plastic valve body, a water rotor and a hall-
effect sensor. When the water flows through the rotor, rotor rolls and the speed of it
changes with a different rate of flow. The hall-effect sensor outputs the corresponding pulse
signal. This type of sensor can be found on different diameters, water pressure (MPa) and
flow rate (L/m) ranges.

Working of the Flow Sensor:


The sensor itself is very simple inside, there is a small flapper wheel that spins as water flows
past. A magnet on the flapper wheel triggers a Hall Effect sensor which sends a momentary
pulse down the output wire with each revolution. Knowing that there are 450 pulses per
litre, we can then determine the flow rate over time or the total volume that has passed
both.

ECE 2 Kumari Priya Sharma 10013202821


36
Date: _ _ /_ _ / 2024

Features and Specifications


• Sensor Type: Liquid Flow Meter – YF-S201
• Operating Voltage: Operating seamlessly within a voltage range of 3.5 to 24VDC, this
system accommodates various power inputs, offering adaptability for diverse
electrical setups.
• Maximum Water Pressure: With a maximum water pressure tolerance of 1.2 MPa,
this system is engineered to withstand and efficiently manage high-pressure water
environments.
• Working Temperature Range: Designed to function within a temperature spectrum
of 1°C to 80°C, this system ensures reliable performance across a broad range of
thermal conditions.
• Working Flow rate: This system operates with a variable flow rate ranging from 1 to
60 litres per minute, providing flexibility in fluid handling for diverse applications

CIRCUIT DIAGRAM:

Procedure:
1. Power To The Breadboard:

• Start by connecting one of the jumper wires from the 5V pin on the
• Arduino and running it over to the positive rail on the side of the solder less
breadboard.
• Next, run a wire from the Ground pin on the Arduino over to the negative rail on the
solder less breadboard.
2. The sensor’s wire harness:
This particular sensor has a nice long wire harness complete with a connector. We do not
happen to have the connector laying around but luckily we can use our Male/Male
Prototyping Wires to connect this sensor to the breadboard. Alternatively, any long 0.100″
pitch breadboard compatible header pins could also be used. We chose this method as it is
much easier to visually follow the wires.

ECE 2 Kumari Priya Sharma 10013202821


37
Date: _ _ /_ _ / 2024

3. The Pull up resistor:


Next we are going to use a 10K Ohm resistor (Brown, Black, and Orange) as a pull up resistor.
The pull up resistor prevents a situation where the Arduino digital input pin ends up floating
(think of this as the input not definitively being on or off). When an input is floating it may
hold the last value, it may flip between off and on, quite random – generally not a good
thing when we are trying to tell if it is on or off.
Bend the legs of the resistor and placed it between the positive 5V rail on the breadboard
and a row of pins. We are also going to go ahead and extend the sensor’s wire harness by
plugging jumper wires into the connector.
4. Connecting the sensor to the breadboard:
In the last step we extended the sensor’s wire harness – we can now plug these jumper
wires into the breadboard. The Black wire is the sensor ground and should be connected to
the negative (ground) rail on the breadboard. The Red wire should be connected to the
positive 5V rail to give the sensor power. The yellow wire should be plugged into the same
row as the pull up resistor we added last step – this is the output from the sensor.
5. The Final Connection:
We have one last wire to add – this connects the pull up resistor and the sensor output to
the Arduino’s digital input. In this example we will be using an interrupt pin so we will need
to use pin 2 on the Arduino Uno.

Code:

Result:
In the experiment, we utilized an Arduino Uno in conjunction with a water flow sensor to
measure the rate of water flow. The Arduino collected data from the flow sensor, translating
it into meaningful flow rates or volumes per unit of time.

ECE 2 Kumari Priya Sharma 10013202821

You might also like