0% found this document useful (0 votes)
30 views30 pages

IoT and Arduino Lab Manual Guide

Idea Lab

Uploaded by

divyanshdixit691
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views30 pages

IoT and Arduino Lab Manual Guide

Idea Lab

Uploaded by

divyanshdixit691
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LAB MANUAL

ON
IDEA LAB

Incharge- [Link] Saraswat

PREPARED BY:
[Link] Saraswat
Internet of Things (IOT)
Introduction: IOT stands for “Internet of Things”. The IOT is a name for
the vast collection of “things” that are being networked together in the home
and workplace (up to 20 billion by 2020 according to Gardner, a technology
consulting firm).

Characteristics of the IOT

These IOT devices talk to one another (M2M


communication) or to servers located in the
Networkin local network or on the Internet. Being on the
g network allows the device the common ability
to consume and produce data.

Sensin
g IOT devices sense something about their environment.

Actuators
IOT devices that do something. Lock doors,
beep, turn lights on, or turn the TV on
Communications in IoT

Communications are important to IOT projects. In fact, communications are


core to the whole genre. There is a trade-off for IOT devices. The more
complex the protocols and higher the data rates, the more powerful processor
needed and the more electrical power the IOT device will consume.
TCP/IP base communications (think web servers; HTTP-based commutation
(like REST servers); streams of data; UDP) provide the most flexibility and
functionality at a cost of processor and electrical power.
Low-power Bluetooth and Zigbee types of connections allow much lower
power for connections with the corresponding decrease in bandwidth and
functionality. IOT projects can be all over the map with requirements for
communication flexibility and data bandwidth requirements.

Arduino in IoT
In IoT applications the Arduino is used to collect the data from the
sensors/devices to send it to the internet and receives data for purpose of
control of actuators.
Arduino Uno
Introduction: The Arduino Uno is an open-source microcontroller board
based on the Microchip ATmega328P microcontroller and developed by
[Link]. 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 the
USB cable or by an external 9-volt battery, though it accepts voltages between
7 and 20 volts. The word "uno" means "one" in Italian and was chosen to mark
the initial release of Arduino Software.

Features of the Arduino


1. 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.
2. The board functions can be controlled by sending a set of instructions to the
microcontroller on the board via Arduino IDE.
3. Arduino IDE uses a simplified version of C++, making it easier to learn to
program.
4. Arduino provides a standard form factor that breaks the functions of the micro-
controller into a more accessible package.
Arduino IDE
(Integrated Development
Environment)
Introduction: The Arduino Software (IDE) is easy-to-use and is based
on the Processing programming environment. The Arduino Integrated
Development Environment (IDE) is a cross-platform application (for
Windows, macOS, Linux) that is written in functions from C and C++.
The open-source Arduino Software (IDE) makes it easy to write code
and upload it to the board. This software can be used with any Arduino
board.

The Arduino Software (IDE) – contains:

• A text editor for writing code


• A message area
• A text consoles
• A toolbar with buttons for common functions and a series of menus.
It connects to the Arduino hardware to upload programs and
communicate with them.
Installation of Arduino Software (IDE)

Step1: Downloading
➢ To install the Arduino software, download this page:
[Link] and proceed with the installation by
allowing the driver installation process.

Step 2: Directory Installation


➢ Choose the installation directory.
Step 3: Extraction of Files

➢ The process will extract and install all the required files to execute properly
the Arduino Software (IDE)
Step 4: Connecting the board

The USB connection with the PC is necessary to program the board and
not just to power it up. The Uno and Mega automatically draw power from
either the USB or an external power supply. Connect the board to the
computer using the USB cable. The green power LED (labelled PWR)
should go on.

Step 5: Working on the new project


➢ Open the Arduino IDE software on your computer. Coding in the Arduino
language will control your circuit.
➢ Open a new sketch File by clicking on New.
Step 6: Working on an existing project
To open an existing project example, select File → Example → Basics →
Blink.
Step 7: Select your Arduino board.
To avoid any error while uploading your program to the board, you must select the
correct Arduino board name, which matches with the board connected to your
computer.
Go to Tools → Board and select your board.

Step 8: Select your serial port


Select the serial device of the Arduino board.
Go to Tools → Serial Port menu. This is likely to be COM3 or higher (COM1
and COM2 are usually reserved for hardware serial ports).
To find out, you can disconnect your Arduino board and re-open the menu,
the entry that disappears should be of the Arduino board. Reconnect the board
and select that serial port.
Step 9: Upload the program to your board.
Click the "Upload" button in the environment.
Wait a few seconds; you will see the RX and TX LEDs on the board, flashing.
If the upload is successful, the message "Done uploading" will appear in the
status bar.

A Verify

B Upload

C New

D Open

E Save

F Serial Motor
Experiment 1
Interfacing Light Emitting Diode(LED)-

Blinking LED.
Introduction: Interfacing a Light Emitting Diode (LED) and making it
blink is one of the simplest projects you can do with an Arduino. Below is a
basic procedure for interfacing an LED and making it blink using an
Arduino.
Components Required:

1. Arduino board (e.g., Arduino Uno)


2. Breadboard and jumper wires
3. LED (any color)
4. Resistor (220-330 ohms)

Procedure:

1. Connect the components on the breadboard according to the circuit


connections mentioned above.
2. Connect the Arduino to your computer using a USB cable.
3. Open the Arduino IDE on your computer.
4. Copy and paste the provided Arduino code into the IDE.
5. Select the correct board and port from the Tools menu in the Arduino IDE.
6. Click the "Upload" button to upload the code to the Arduino.
7. Observe the LED on Pin 13 blinking on and off at a 1-second interval.

Circuit Connections:
• Connect the positive (longer leg) of the LED to a digital pin on the Arduino (
Pin 8).
• Connect the negative (shorter leg) of the LED to a current-limiting resistor
(220-330 ohms).
• Connect the other end of the resistor to the ground (GND) on the Arduino.
Arduino Code:
Precautions:
1. The pushbutton is square so it is important to set it appropriately on
breadboard.
2. While making the connections make sure to use a pull-down resistor
because directly connecting two points of a switch to the circuit will
leave the input pin in floating condition and circuit may not work
according to the program.
3. It is very important to set pinMode() as OUTPUT first before using
digitalWrite() function on that pin.
4. If you do not set the pinMode() to OUTPUT, and connect an LED to a
pin, when calling digitalWrite(HIGH), the LED may appear dim.
Experiment 2
Interfacing the RGB LED with the Arduino
Introduction: There are actually two types of RGB LED’s; the common
cathode one and the common anode one. In the common cathode RGB led, the
cathode of all the LED’s is common and we give PWM signals to the anode
of LED’s while in the common anode RGB led, the anode of all the LED’s is
common and we give PWM signals to the cathode of LED’s. Inside the RGB
led, there are three more LED’s. So, by changing the brightness of these
LED’s, we can obtain many other colors. To change brightness of RGB led,
we can use the PWM pins of Arduino. The PWM pins will give signal different
duty cycles to the RGB led to obtain different colors.
Hardware Required:

Component Name Quantity

Arduino UNO 1

RGB LED 1

220Ω/330Ω resistor 3

USB Cable 1

Breadboard 1

Jumper wires several

Connection Diagram:
Steps of working
1. Insert the RGB LED into your breadboard and connect its cathode pin
to the GND of the Arduino.
2. Insert the LED into the breadboard. Attach Red pin to pin 8, Green pin
to pin 9 and Blue pin to pin 10 of the Arduino via the 220-ohm resistor,
and the negative leg to GND.
3. Upload the code as given below.
4. Observe the changes in the color of the RGB LED.

Arduino Code
This sketch works by setting pinsD8, D9, D10 as for the different legs of RGB
LED. After that the run a loop that continually reads the value from the pins
and sends that value as voltage to the LED. The voltage value is between 0–5
volts, and the blinking of the LED will vary accordingly.
Experiment 3
Interfacing Temperature Sensor(LM35)
and/or humidity sensor (e.g.DHT11).
Introduction: Interfacing a temperature sensor (such as LM35) and/or a
humidity sensor (such as DHT11) with an Arduino is a common project in
the realm of environmental sensing. Below, there is a simple procedure for
connecting both the LM35 temperature sensor and the DHT11 humidity
sensor to an Arduino.

Component Required:
1. Arduino board (e.g., Arduino Uno)
2. Breadboard and jumper wires
3. LM35 temperature sensor
4. DHT11 humidity and temperature sensor (optional)
5. Resistors (if needed for DHT11)
6. Capacitor (if needed for DHT11)
Procedure:
1. Connect the components on the breadboard according to the circuit connections
mentioned above.
2. Connect the Arduino to your computer using a USB cable.
3. Open the Arduino IDE on your computer.
4. Copy and paste the provided Arduino code into the IDE.
5. Select the correct board and port from the Tools menu in the Arduino IDE.
6. Click the "Upload" button to upload the code to the Arduino.
7. Open the Serial Monitor to observe the temperature and humidity readings.

Working Diagram:
Steps of working
• For LM35 Temperature Sensor:
• Connect the LM35's VCC pin to 5V on the Arduino.
• Connect the LM35's GND pin to GND on the Arduino.
• Connect the LM35's OUT pin to an analog pin on the Arduino ( A0).
• For DHT11 Humidity and Temperature Sensor:
• Connect the DHT11's VCC pin to 5V on the Arduino.
• Connect the DHT11's GND pin to GND on the Arduino.
• Connect the DHT11's DATA pin to a digital pin on the Arduino (D2).
• Optionally, add a pull-up resistor (5k ohms) between the VCC
and DATA pins of the DHT11.

Arduino Code:
Experiment 4
Interfacing Air Quality Sensor-pollution (e.g.
MQ135) – display data on LCD switch on
LED when data sensed is higher than
specified value.

Introduction: Interfacing an Air Quality Sensor (e.g., MQ135) with an


Arduino, displaying data on an LCD, and activating an LED when the
sensed pollution level exceeds a specified threshold is a valuable project for
monitoring air quality. Below is a step-by-step procedure for setting up this
project

Component Required:
1. Arduino board (e.g., Arduino Uno)
2. Breadboard and jumper wires
3. MQ135 Air Quality Sensor
4. LCD (16x2 or 20x4)
5. Potentiometer (10k ohms) for adjusting LCD contrast
6. LED
7. Resistor (220-330 ohms) for the LED
8. Resistors (if needed for MQ135)
9. Capacitors (if needed for MQ135)

Procedure:
1. Connect the components on the breadboard according to the circuit
connections mentioned above.
2. Connect the Arduino to your computer using a USB cable.
3. Open the Arduino IDE on your computer.
4. Install the "LiquidCrystal_I2C" library from the Library Manager in
the Arduino IDE (Sketch -> Include Library -> Manage
Libraries...).
5. Copy and paste the provided Arduino code into the IDE.
6. Select the correct board and port from the Tools menu in the Arduino IDE.
7. Click the "Upload" button to upload the code to the Arduino.
8. Adjust the potentiometer to set the LCD contrast.
9. Observe the air quality readings displayed on the LCD, and the
LED should turn on when the pollution level exceeds the specified
threshold.

Circuit Connections:
• Connect the MQ135 sensor to the Arduino:
• Connect the VCC pin of the MQ135 to 5V on the Arduino.
• Connect the GND pin of the MQ135 to GND on the Arduino.
• Connect the OUT pin of the MQ135 to an analog pin on the Arduino (A0).
• Connect the LCD to the Arduino as described in the previous answer.
• Connect the LED to the Arduino:
• Connect the anode (longer leg) of the LED to a digital pin on the Arduino
(D7).
• Connect the cathode (shorter leg) of the LED to a current-
limiting resistor (220-330 ohms).
• Connect the other end of the resistor to GND on the Arduino.
Arduino Code:
Experiment 5
Interfacing of the Active Buzzer with
Arduino.
Introduction:
A piezo buzzer is a type of electronic device that’s used to produce beeps and
tones. The working principle of the device is piezoelectric effect. The main
component of this device is a piezo crystal, which is a special material that
changes shape when a voltage applied to it. The active buzzer will only
generate sound when it will be electrified. It generates sound at only one
frequency. This buzzer operates at an audible frequency of about 2 KHz.

Specifications:

Specification Range

VoltageRange 3.3-5V

Frequency 2KHz
Pin Name Description

Positive Identified by (+) symbol or longer terminal


lead. Can be powered by 6V DC

Negative Identified by short terminal lead. Typically


connected to the ground of the circuit

Components Required:

Component Name Quantity

Arduino UNO 1

Buzzer / piezo 1
speaker

220-ohm resistors 1

USB Cable 1

Breadboard 1

Jumper wires several


Connection Diagram:

Steps of working:
Connect the Supply wire (RED) of the buzzer to the Digital Pin 9 of the
Arduino through a 100-ohm resistor.
Connect the Ground wire (BLACK) of the buzzer to any Ground Pin on the
Arduino.
Upload the code
Observe the changes in the pitch and volume of the buzzer.
Aurduino Code

Common questions

Powered by AI

To perform a basic LED blinking experiment with an Arduino, you will need an Arduino board (such as Arduino Uno), a breadboard, jumper wires, an LED, and a resistor (220-330 ohms). First, connect the positive leg of the LED to a digital pin on the Arduino (Pin 8) and the negative leg to a resistor connected to the GND on the Arduino. After setting up the hardware, connect the Arduino to a computer via USB. Open the Arduino IDE, enter the code to make the LED blink at intervals, and select the correct board and port from the Tools menu. Finally, upload the program to the Arduino, and the LED should blink on and off at a 1-second interval .

Precise temperature readings using an LM35 sensor with an Arduino involve accurate calibration and stable connections. Connect the LM35 sensor's VCC to 5V, GND to ground, and OUT to an analog pin (A0). Ensure the connections are secure to prevent signal interference. Use a suitable voltage reference to enhance measurement accuracy. Upload a program that reads the analog input, converts it to temperature using the LM35's calibration factor (typically 10 mV/°C), and outputs this data, ideally displayed on a serial monitor. The precision of the readings can be affected by external temperature fluctuations and electrical noise, which should be minimized for best results .

Selecting the correct board and port in the Arduino IDE is critical because it ensures that the program is compiled and uploaded correctly. The board selection sets specific parameters within the IDE to align with the hardware specifications of the microcontroller on the connected Arduino board, affecting how the code interfaces with the hardware. Similarly, choosing the correct port guarantees a successful communication link between the computer and the Arduino. Incorrect selections can lead to upload failures, resulting in errors and preventing the program from running on the Arduino board. This step effectively aligns the software environment with the physical hardware, ensuring compatibility and operability .

Interfacing an air quality sensor like the MQ135 with an Arduino and displaying data on an LCD involves several steps and challenges. The setup requires an Arduino board, MQ135 sensor, LCD display, resistor, and potentiometer. First, connect the MQ135 to the analog pin of the Arduino (A0). The LCD requires a potentiometer for contrast adjustment, connected with the LiquidCrystal_I2C library for control. A significant challenge is ensuring stable readings, which may necessitate adding capacitors for smoothing the sensor signal. The practical setup must handle the concurrent control of LED indicators and LCD updates efficiently, maintaining clear and timely data display when the pollution levels exceed thresholds .

To set up an Arduino board using the Arduino IDE, follow these steps: First, download and install the Arduino software from the official Arduino website. Connect the Arduino board to your computer using a USB cable, which powers the board and allows program uploading. Open the Arduino IDE and, after writing your code, select the correct board type and serial port under the Tools menu to match your connected board. Finally, click the 'Upload' button in the IDE to transfer your program to the Arduino. Successful uploading is indicated by flashing RX and TX LEDs on the board and a 'Done uploading' message in the status bar .

Common cathode and common anode RGB LEDs differ in how they're connected and used with an Arduino. In a common cathode RGB LED, the cathode of all the LEDs is shared and connected to ground, while PWM signals are applied to the anodes. Conversely, a common anode RGB LED shares its anode, which is connected to a positive voltage supply, and PWM signals are applied to the cathodes. These design differences affect circuit diagrams and the polarity of input signals when interfacing with Arduino. Common cathode LEDs are more commonly used due to easier circuit logic handling, whereas common anode LEDs may be chosen for specific applications needing higher forward current paths .

The Arduino Uno's PWM (Pulse Width Modulation) pins are used to control the brightness of the individual red, green, and blue LEDs within an RGB LED by varying the duty cycle of the PWM signals. This allows for mixing different intensities of the primary colors to produce a variety of colors. By assigning PWM signals to specific pins (e.g., pins 8, 9, and 10 for red, green, and blue respectively), users can adjust the brightness of each color component, thus changing the overall color output by adjusting the duty cycles of the PWM signals .

Electrical power consumption significantly impacts IoT device design, influencing the choice of communication protocols based on the power/complexity trade-off. For battery-powered or energy-constrained IoT devices, low-power protocols like Bluetooth and Zigbee are often preferred because they consume less energy even though they offer reduced data rates and functionalities. Technology choices that minimize energy use are pivotal for extending the operational life of such devices. In contrast, devices that have access to continuous power supply might opt for high-complexity, high-power protocols like TCP/IP to benefit from superior bandwidth, flexibility, and functionality, which supports advanced applications and data processing tasks .

The Arduino IDE plays a pivotal role in making Arduino boards accessible to beginners due to its user-friendly interface and simplified coding environment. The IDE uses a simplified version of C/C++, allowing those new to programming to write, compile, and upload code without deep programming knowledge. Its cross-platform nature and integration with various board types further enhance accessibility. By encapsulating complex tasks such as library management and board communication within an intuitive GUI, the Arduino IDE lowers the barrier to entry, making it easier for beginners to experiment and learn about electronics and programming .

IoT devices typically communicate using machine-to-machine (M2M) communication or by connecting to servers on a local network or the internet. There is a trade-off between the complexity of communication protocols and the amount of power they consume. More complex protocols like TCP/IP provide greater flexibility and functionality but require more powerful processors and consume more power. Conversely, simpler protocols such as Bluetooth and Zigbee consume less power but offer reduced bandwidth and functionality .

You might also like