Iot Rec
Iot Rec
Apparatus:
1. Raspberry Pi 3 Kit
2. micro USB power adapter (5V, 2.5 Amp)
3. HDMI cable
4. micro SD memory card (16 GB)
5. 5mm LED x1
6. 100 Ω resistor x1
7. White bread board
8. Connecting wires (Male-to-female jumper wires)
9.Keyboard
10. Mouse
Theory:
1. Introduction to Raspberry Pi 3
The Raspberry Pi 3 is a small, affordable, and powerful single-board computer that can run a full
operating system (usually Raspberry Pi OS). It has General Purpose Input/Output (GPIO) pins that
allow it to interface with external hardware, such as LEDs, sensors, and motors.
2. GPIO Pins and Their Role
Raspberry Pi 3 comes with 40 GPIO pins, which include:
Power pins (3.3V and 5V)
Ground (GND) pins
GPIO pins (used for input/output operations)
PWM pins (used for Pulse Width Modulation)
3. Working with an LED
An LED (Light Emitting Diode) is a small electronic component that emits light when current flows
through it. Since LEDs are polarized components:
Anode (+) should be connected to a voltage source.
Cathode (-) should be connected to ground (GND).
Procedure:
1. Connect anode of the LED is connected to GPIO25 (Physical Pin 22) through a 1KΩ current limiting
resistor. The cathode of the LED is connected to the GND Pin.
2. Open the Terminal shell and create a file using “nano” command
3. Write the program in GNU window
4. Save the program using “Ctrl+o”
5. Go back to the Terminal shell : press “Ctrl+x”
6. Connect LED with Raspberry Pi board
7. To run the code: $ python (file name.py)
8. To terminate the operation: press “Ctrl+z”
Precautions:
1. Use a Current-Limiting Resistor – Always connect a 330Ω - 1kΩ resistor in series with the LED to
prevent excessive current flow, which could damage both the LED and the Raspberry Pi’s GPIO pin.
2. Proper GPIO Shutdown – Always use GPIO.cleanup() in your Python script or manually reset the
GPIO before exiting to avoid leaving pins in an undefined state, which could cause unexpected behavior
or damage.
Result:
RASPBERRY PI WITH PUSH BUTTON AND BUZZER USING MQTT
Aim: Write a python program to make buzzer generating beeps using Raspberry Pi 3.
Apparatus:
1.Raspberry Pi3 Kit
2.Micro USB power adapter (5V, 2.5 Amp)
3.HDMI cable
4.Micro SD memory card (16 GB)
5. Buzzer(6V DC)
Theory:
1. Introduction to Buzzers
A buzzer is an electronic device that generates sound when an electrical signal is applied. It is commonly
used in alarm systems, timers, and notifications.
There are two types of buzzers:
1. Active Buzzer – Generates a sound when powered (simpler to use).
2. Passive Buzzer – Requires a varying frequency signal (can produce different tones).
2. Working with Raspberry Pi 3 GPIO
The Raspberry Pi 3 has 40 GPIO pins that can be used to control external devices like buzzers, LEDs, and
sensors. A buzzer can be connected to a GPIO pin and controlled using Python.
Procedure:
1. Connect the +ve and -ve of polarities of Buzzer to GPIO17 and GND of Raspberry Pi
2. Open the Terminal shell and create a file using “nano” command
3. Write the program in GNU window
4. Save the program using “Ctrl+o”
5. Go back to the Terminal shell : press “Ctrl+x”
6. To run the code: $ python (file name.py)
7. To terminate the operation: press “Ctrl+z”
Precautions:
1.Avoid Directly Connecting a High-Power Buzzer – If the buzzer requires more than 3.3V or high
current, use a transistor (like BC547 or 2N2222) as a switch to prevent damage to the Raspberry Pi’s
GPIO pin.2
2. Use Proper GPIO Shutdown (GPIO.cleanup()) – Always call GPIO.cleanup() at the end of the script to
reset GPIO pins, preventing unexpected behavior or keeping the buzzer active after the program stops.
Result:
RASPBERRY PI WITH PUSH BUTTON USING MQTT
Aim: Write a python program to interface a push button using Raspberry Pi3.
Apparatus:
1.Raspberry Pi3 Kit
Theory:
1. Introduction to Push Buttons
A push button is a simple switch that allows current to flow when pressed and stops the flow when released.
It is commonly used in electronic circuits for user input, toggling devices, and triggering events.
Types of Push Buttons
1. Momentary Button – Only stays pressed while being held down.
2. Toggle Button – Stays in one state until pressed again.
Precautions:
1. Use Pull-Up or Pull-Down Resistors – If you don’t enable Raspberry Pi’s internal pull-up resistor
(GPIO.PUD_UP), use an external 10kΩ pull-up resistor to avoid floating pin values, which can
cause erratic behavior.
2. Debounce the Button Input – Mechanical buttons can create false multiple signals due to bouncing. Use
software debouncing (e.g., time.sleep(0.2) or bouncetime=200 in GPIO.add_event_detect()) to ensure
accurate button presses.
Result:
RASPBERRY PI WITH DHT11 SENSOR USING MQTT(DATA UPLOADING)
Aim: Write a python program to read the value of humidity & temperature from DHT11 sensor using
Raspberry Pi3
Apparatus:
1. Raspberry Pi3 Kit
2. Micro USB power adapter (5V, 2.5 Amp)
3. HDMI cable
4. Micro SD memory card (16 GB)
5. DHT11 Temperature and Humidity sensor
6. Connecting wires
7. White bread board
8. Keyboard
9. Mouse
Theory:
The DHT11 sensor is a digital temperature and humidity sensor that uses a capacitive humidity sensor and a
thermistor to measure environmental conditions. It communicates with the Raspberry Pi via a single-wire
digital interface, making it easy to integrate. The sensor provides readings with an accuracy of ±2% for
humidity and ±0.5°C for temperature. The Raspberry Pi3 reads the sensor data using GPIO pins and a Python
script with the Adafruit_DHT library. Regular polling of the sensor allows for real-time monitoring of
temperature and humidity values.
Procedure:
1. Connect the VCC and GND pins of the DHT11 Sensor to +5V and GND of Raspberry Pi and then connect
the Data OUT of the Sensor to the GPIO4 i.e. Physical Pin 7 of the Raspberry Pi. 2. Open the Terminal shell &
Install Adafruit package using pip command
3. Create a file using nano command
4. Write the program in GNU window
5. Save the program using “Ctrl+O”
6. Go back to the Terminal shell : press “Ctrl+x”
7. To run the code: $ python (file name.py)
8. To terminate the operation: press “Ctrl+z”
Precautions:
1. Stable Power Supply – Ensure the DHT11 sensor is powered with a stable 3.3V or 5V supply to prevent
inaccurate readings or sensor malfunction.
2. Proper Wiring – Connect the data pin with an appropriate pull-up resistor (4.7kΩ to 10kΩ) to avoid signal
interference and ensure reliable communication with the Raspberry Pi.
Result:
RASPBERRY PI WITH DHT11 SENSOR USING MQTT(DATA EXCHANGE)
Aim: Raspberry pi with DHT11sensor for cloud data exchange using MQTT.
Apparatus:
1. Raspberry Pi3 Kit
2. Micro USB power adapter (5V, 2.5 Amp)
3. HDMI cable
4. Micro SD memory card (16 GB)
5. DHT11 Temperature and Humidity sensor
6. Connecting wires
7. White bread board
8. Keyboard
9. Mouse
Theory:
Raspberry Pi, integrated with a DHT11 sensor, can be used to collect temperature and humidity data and
transmit it to the cloud using the MQTT (Message Queuing Telemetry Transport) protocol. MQTT is a
lightweight, publish-subscribe messaging protocol ideal for IoT applications due to its low bandwidth
usage and efficient communication. The Raspberry Pi reads sensor data using Python and the paho-mqtt
library, then publishes it to an MQTT broker such as Mosquitto or a cloud service like AWS IoT or
HiveMQ.
Procedure:
1.Connect the VCC and GND pins of the DHT11 Sensor to +5V and GND of Raspberry Pi and then connect
the Data OUT of the Sensor to the GPIO4 i.e. Physical Pin 7 of the Raspberry Pi.
2. Open the Terminal shell & Install Adafruit package using pip command
3. Create a file using nano command
4. Write the program in GNU window
5. Save the program using “Ctrl+O”
6. Go back to the Terminal shell : press “Ctrl+x”
7. To run the code: $ python (file name.py)
8. To terminate the operation: press “Ctrl+z”
Precautions:
1. Secure MQTT Communication – Use authentication (username/password) and encryption (TLS/SSL) to
protect data from unauthorized access during transmission to the cloud.
2. Stable Network Connection – Ensure a reliable internet connection on the Raspberry Pi to prevent data
loss or delays in transmitting sensor readings to the MQTT broker.
Result: