IoT Lab Manual
IoT Lab Manual
IoT Lab Manual
The DHT11 uses just one signal wire to transmit data to the Arduino. Power comes from
separate 5V and ground wires. A 10K Ohm pull-up resistor is needed between the signal line
and 5V line to make sure the signal level stays high by default (see the datasheet for more info).
There are two different versions of the DHT11 you might come across. One type has four pins,
and the other type has three pins and is mounted to a small PCB. The PCB mounted version is
nice because it includes a surface mounted 10K Ohm pull up resistor for the signal line. Here are
the pin outs for both versions:
How to Set Up the DHT11 on an Arduino:
Wiring the DHT11 to the Arduino is really easy, but the connections are different depending on
which type you have.
Connecting a Three Pin DHT11:
For connections, the PIR Sensor has three pins namely VCC, DATA and GND. Also, the PIR
Sensor has two potentiometers: one for adjusting the sensitivity of the sensor (or rather the
sensing distance of the sensor) and the other for adjusting the time for which the Output stays
high upon detecting any human movement.
The Fresnel lens covering the Pyroelectric Sensor play an important role in focusing the
infrared energy onto the sensor. With the help of this lens, the PIR Sensor can detect objects in
1200 angle. The range of the sensor is 8 meters i.e. it can detect human movement up to 8 meters.
PIR Sensor Adjustments
As mentioned earlier, there are two potentiometers for manually adjusting the sensitivity
and output timing.
With the help of the first potentiometer, you can adjust the Sensitivity i.e. the Sensing
Distance of the PIR Sensor. The range can be adjusted from 3 meters up to 8 meters. To increase
the sensing distance, turn the POT in clockwise direction and to decrease, turn it in anti-
clockwise direction.
Coming to the second potentiometer, you can adjust the duration for which the Output of
the PIR Sensor stays HIGH. It can be varied anywhere between 0.3s to 600s. To increase the
time, turn the POT in clockwise direction and in anti-clockwise direction to decrease the time.
PIR Motion Sensor using Raspberry Pi
As mentioned in the introduction, the aim of this project is to interface a PIR Sensor with
Raspberry Pi and implement a PIR Motion Sensor using Raspberry Pi and Python Programming.
Circuit Diagram:
The following Fritzing based images shows all the connections with respect to the PIR Motion
Sensor using Raspberry Pi.
Components Required:
Raspberry Pi 3 Model B
PIR Sensor
5V Buzzes
Connecting Wires
Mini Breadboard
Power Supply
Computer
Circuit Design:
Connect the VCC and GND pins of the PIR Motion Sensor to +5V and GND pins of the
Raspberry Pi. Connect the DATA Pin of the PIR Sensor to GPIO23 i.e. Physical Pin 16 of the
Raspberry Pi. A 5V Buzzer is connected to GPIO24 i.e. Physical Pin 18 of the Raspberry Pi. The
other pin of the buzzer is connected to GND.
NOTE:
I have directly connected the Buzzer to Raspberry Pi. But if you are not sure, connect it
through an NPN Transistor.
From the previous Raspberry Pi Projects, you already know that Raspberry Pi Input pins
are 3.3V tolerant i.e. they work on 3.3V Logic.
If you are wondering why I connected the output Data pin of the PIR Sensor directly to
the Raspberry Pi, then you need to be confused as I have checked the output levels of the
PIR Sensor on HIGH state and got a result of around 3.5V.
You can also check for the same and then proceed with a level converter circuit (voltage
divider) if it is required.
Code:
The Programming part of the project is implemented using Python. The following is the Python
Script for the PIR Motion Sensor using Raspberry Pi.
import RPi.GPIO as GPIO
import time
sensor = 16
buzzer = 18
GPIO.setmode(GPIO.BOARD)
GPIO.setup(sensor,GPIO.IN)
GPIO.setup(buzzer,GPIO.OUT)
GPIO.output(buzzer,False)
time.sleep(12)
try:
while True:
if GPIO.input(sensor):
GPIO.output(buzzer,True)
while GPIO.input(sensor):
time.sleep(0.2)
else:
GPIO.output(buzzer,False)
except KeyboardInterrupt:
GPIO.cleanup()
Working:
The working of the PIR Motion Sensor using Raspberry Pi is very simple. If the PIR Sensor
detects any human movement, it raises its Data Pin to HIGH. Raspberry Pi upon detecting a
HIGH on the corresponding input pin, will activate the Buzzer.
Applications
The applications of the PIR Motion Sensor using Raspberry Pi project have already been
mentioned. Some of them are:
Automatic Room Light
Motion Detection
Intruder Alert
Automatic Door Opening
Home Security System
References:
https://www.electronicshub.org/pir-motion-sensor-using-raspberry-pi/
Practical 7: To interface PI Camera with Arduino/ Raspberry Pi and write a program to
start the camera and to place the clicked pictures on the desktop.
The Raspberry Pi camera module is a great addition to your Pi. It will allow you to develop more
advanced applications with vision. And if you thought that taking pictures with the Pi camera
would be hard, here you’ll see that it’s just the opposite.
Setup and enable the Pi camera:
First, make sure to shutdown and power off your Raspberry Pi. Localize the camera port (don’t
confuse it with the display port which has a similar connector). The camera port is between the
HDMIs ports and the jack port. You can see “CAMERA” written next to it. Once you’ve located
the camera port, now make sure to plug the connector in the right way. The blue part should face
the jack and USB ports. Now, power on your Raspberry Pi. To open the settings for the Pi
camera, click on the Raspberry Pi icon > “Preferences” > “Raspberry Pi Configuration”.
Regulators established several license free radio bands as early as 1947. But these did not attract
much interest until mobile phones really caught on in the late 1990s. IEE 802.15.4 standard has
frequencies of two bands at 902-928 MHz and 2400-2483 MHz.(There are other standards, such
as Zigbee, in one or both of these bands.)
One configuration that uses these bands is a mesh network. It consists of many small,
low-power radios connected to each other to relay data from remote sensors at the outer edges of
an area to radios at a collection point. Each collection point has access to the cloud. This allows
for wide-area usage by deploying sensors connected to very low-power radios.
Sensor To Wi-Fi Router To Cloud:
The 2400-2483 MHz band and another license-free band at 5130-5835 MHz were the original
frequency bands of the 802.11 Wi-Fi Standard (created in 1997). They are used primarily for Wi-
Fi access points, which is widely available in cities these days. The largest number of these
routers are in homes, businesses, and public gathering places (coffee shops, malls, and airports).
Industry and infrastructure used a small number of more specialized routers. This is the most
widely-used way today to connect mobile devices (laptops, tablets, smart phones) to the cloud. In
fact, most applications in smartphones connect to the cloud primarily through a Wi-Fi router.
Shortly after Wi-Fi-capable smartphones became available, remote sensors that could connect
directly to a Wi-Fi router also began to appear. Small sensors with low power Wi-Fi radio are
placed within the range of wifi routor. Internet connection is provided later.
Sensor To Mobile Phone To Cloud:
The sensor just needs to connect to a mobile phone instead of connecting directly to a Wi-Fi
router. The main reason for this is to allow the mobile-phone user to interact directly with the
sensor before sending the information up to the cloud.
These applications are served by the Bluetooth standard, created in 1998. It was added to
the 802.15.4 standard in 2003 but continues to maintain its own independent working group. It
works in the same 2400-2483 MHz license-free band used by one of the Wi-Fi bands.
From Sensor to Cloud: A Plug and Play Approach Evolving
Today, more powerful, evolved gateways, can function either as dedicated devices or as a virtual
part of a system. They play a new role in receiving, translating, processing and transmitting data
as transparent information to the spectrum of cloud interfaces. So this is enabled by the new
cloud API for IOT gateways. It is essentially a middle-ware and glue logic solution to enable
simple orchestration of wired and wireless sensor networks as well as embedded system
configurations. The cloud API provides application-ready software modules. They act as
blueprints for original equipment manufacturers (OEMs) to develop their own applications.
Therefore it helps in removing complexity and creating a smart path to connect all types of
sensor networks to any cloud platform.
Amplifying the importance of gateways:
Gateways are complex devices with excellent transcoding and decision-making capabilities.
Using integrated logic, these collect, analyse and transcode sensor data. Later it determines
whether it goes to the field, the cloud or perhaps another gateway. Their secure end-to-end
encryption further allows them to structure and move data consistently. For example, enabling
bidirectional communication with a specific cloud solution.
Enabled with the new cloud API, the IoT gateway communicates locally with intelligent
sensors. Now it is capable of processing and converting the received sensor data. Embedded
driver modules (EDMs) interface with hardware and third-party expansion cards, providing the
glue logic that translates received data into the semantics of the application-specific IoT gateway
logic. This sensor engine, with EDM modules incorporated in its structure, was the first software
components which was standardised as a cloud function module. Its critical value is in moving
data from local sensors to a generic middleware, independent of protocols.
References:
https://readwrite.com/2015/10/13/sensor-data-device-to-cloud/
https://iot4beginners.com/how-does-a-sensor-data-travel-from-one-device-to-the-cloud/