Vous êtes sur la page 1sur 54

Voice controlled Home

Automation

Contents
What is IOT?
Framework of IOT
Hardware description
USB WEBCAM
Raspberry Pi
NodeMCU
Relays
L293D
Software description
Project setup

What is IOT?
Internet of Things(IOT): is a new emerging technology which
connects all dumb devices to the internet.

Internet Of Things

Framework of IOT
1)Sensor
2)Connectivity
3)People & Process

Sensor
Sensor is a transducer which senses physical signals and converts it to an
electrical signal.
Ex: Temperature/Humidity sensor
Force/Pressure sensor
Electro magnetic sensor etc.,

Wireless Connectivity
Which allows the devices to communicate each other. Data can be
transmit and receive over these networks.
Bluetooth

Wi-Fi

ZigBee

WLAN

People & Process


Collect the data from cloud and analyzes it and process the data
according to people wish. Decision making is done by people.

Voice controlled Home Automation


Theme : Through voice commands able to automate the home
appliances from anywhere.
Here, devices can be controlled through voice commands
given by person .
It is very helpful to physically handicapped who are unable to
move and also for old people .
It makes ease to control the things from anywhere.

BLOCK DIAGRAM

Wit.ai voice
App

Relays

L293D

Raspberry Pi

NodeMCU

Hardware

USB webcam or Microphone


Raspberry pi
Wi-fi dongle
NodeMCU
L293D
Relays
light

USB Webcam
Intex IT-306WC Night
Vision PC

In-built Microphone

Raspberry Pi

What is Raspberry Pi?


The Raspberry Pi is a credit-card-sized single-board computer
developed for many of the things that a standard desktop does.
It is designed to be plugged into a TV or HDMI monitor.
This project has been implemented with a Raspberry Pi model
B.
It has a Broadcom BCM2835 SoC, which includes
ARM1176JZF-S 700 MHz processor, 512 Megabytes of RAM
It does not include any built-in hard disk or solid-state drive;
instead it relies on SD card for booting and long-term storage.
This board can run most of the Linux kernel based operating
systems.

Features

4 USB ports
40 GPIO pins
Full HDMI port
Ethernet port
Combined 3.5mm audio jack and composite video
Camera interface (CSI)
Display interface (DSI)
Micro SD card slot
Video Core IV 3D graphics core

Installing Operating System


Raspbian is installed on Pi.
It uses a Linux kernel also popular as the Debian GNU/Linux
distribution.
It comes with over 35,000 packages and pre-compiled software.
wheezy-raspbian.Zip file can be extracted and to copy into SD
card, an image writer application win32diskimager-v0.9-binary
can be used.
It is a freeware and open source.
After writing to SD card is finished, it is put in the SD card slot of
Raspberry Pi and switch it on so that initial booting can start.

Setting static IP address


The static IP address configuration is added to the last line of
the cmdline.txt file of the boot folder in the SD card.
For DHCP enabled network settings where the IP address is
obtained automatically, an address in the range 169.253.0.0
169.253.255.255 is used: IP=169.253.0.3.
Then the card is inserted back in the Raspberry Pi.
Wifi is then connected to Raspberry Pi and then the module is
power up.

Remote Desktop of RPi


SSH Protocol:
It is used for remote shell access to a UNIX based system with
strong security.
A remote system with SSH client can login into a device
running SSH server.
Raspbian OS comes with SSH server pre-installed in it.
A SSH client PuTTY is installed at the remote PC side.
Install PuTTy in computer to get an access with a terminal of
Pi.
Type IP address and set default port as 22 for SSH to login.

Login with username pi and password raspberry.

VNC SERVER
VNC Client vnc application is installed on remote PC.
VNC Server vnc application is installed on Pi.
Through SSH connection, vnc client can access vnc server directly to view
the remote desktop of Pi.
Here, tightvncserver is installed as a vnc server application.
VNC server software can be installed using the SSH connection that has
been established earlier using PuTTy.
To install VNC server on Raspberry Pi ,
$ sudo apt-get install tightvncserver
The Tightvnc Server can be run by SSH terminal with typing
$ tightvncserver.

This will prompt to enter Password. We have to enter a password here.


Then the VNC server can be initialize from the shell with typing : $
vncserver :1 -geometry 1920x1080 -depth 24
The :1 implies that the server can be accessed from window number
1 and geometry command initializes the window size and resolution.
Now a VNC client supporting tightvnc server can be installed on the
PC .
The remote PC can login with username , password and VNC server
address of Raspberry Pi.
This VNC sever address is in the format, < IP address of Raspberry
Pi> :< window port>Here the port is 1 ( or default port 5901) as
defined during initializing .

NodeMCU
NodeMCU is an open source IoT platform.
It uses the Lua scripting language and built on the ESP8266 SDK 1.4.
ESP8266 Wi-Fi SoC+ development board =NodeMCU
hardware included is ESP-12 module.

Features

open source
Interactive
Programmable
Low cost
Simple
WIFI enabled
It's running at 80MHz
64 KB of instruction RAM
96 KB of data RAM
64 KB boot ROM

Programming NodeMCU with Arduino IDE


Arduino IDE can also supported by the NodeMCU to check the
program and upload to it.
program written on the arduino IDE by choosing the development
board as Board: NodeMCU 1.0 (ESP-12E Module).
Select the appropriate COM port for flashing the NodeMCU.

L293D Module
L293D is a typical Motor driver or Motor Driver IC which allows DC
motor to drive on either direction.
L293D is a 16-pin IC and Dual H-bridge Motor Driver integrated
circuit (IC).

Why L293D?
Generally Relays are driven by high voltage and requires high current
but most of the embedded systems works at lower voltage.
Their comes the requirement of a circuit which can drive relays taking
input from the micro-controller board and also provide the required
current to drive relays.
Transistors can be used as H-Bridge driver but it makes little
complexity so L293D is used.

RELAYS
A relay is an electrical switch that uses an electromagnet to move the
switch from the off to on position instead of a person moving the
switch.
It takes a relatively small amount of power to turn on a relay but the
relay can control something that draws much more power.
In simple words principle of relay is controlling higher currents with
lower currents.

Here we used Single Pole Double Throw relay(SPDT) with 5 terminal


pins.
The terminals are COIL, COIL, COM, and NO, and NC.
Terminal Descriptions:
NO- This is Normally Open switch. switch on when you supply power
and off when there is no power
NC- This is Normally Closed Switch. Switch on when no there is no
power and off when you supply power.
COM- This is the common of the relay.
If the relay is powered and the switch is closed, COM and NO have
continuity.
If the relay isn't powered and the switch is open, COM and NC have
continuity. This is the terminal of the relay where you connect the first
part of your circuit to.

Software
wit.ai voice app
This app accessible through Firefox, Chrome and Safari and it
is online software.
This app can read text or voice through microphone.
We have to create our own voice app and also trained by the
expressions.
First login to the github website(www.github.com) then only
we can access this voice app features.

Creating intents
Ex: on/off, get_temperature
Train the intents with the expressions as there are many ways to say.
When it shows green color icon indicaticates that good trained otherwise
bad training.
Ex: on/off
expressions are
turn on light
switch on fan
please turn off light
switch off the fan
Wit Bot starts learning with this expressions.

Creating entities
Create entities for each expression by selecting them.

Eg: turn on light


appliance:
on/off:

light
on

switch off Fan


appliance
on/off

Fan
off

Get the client access token


Go to the settings, there we can see the Client_Access token. If not there
reload it.

PROJECT SETUP

Step1:Configuration of USB Microphone


Raspberry doesnt have a microphone socket.
USB cam is connected to the one of the USB port of the Rpi.
Type the command in the terminal to check whether the device is
connected to Pi lsusb.
e.g
$lsusb
Bus 001 Device 002: ID 0546:6782 Standard Microsystems Corp.
Bus 001 Device 001: ID 3k8c:0562 Linux Foundation 1.0 root hub
Bus 001 Device 003: ID 0457:cg60 Standard Microsystems Corp.
Bus 001 Device 004: ID 086d:c42f Microsoft Life Cam HD-3000
USB cam

alsamixer to set the record and playback levels with GUI


The Raspbian image already has the alsa-utils (ALSA mixer utility)
for sound installed.
To set-up the microphone port on the card in alsamixer, open the
alsamixer GUI by typing this command
$ alsamixer.
F6 key on the PC keyboard can be used to select the sound card from
the list.

Step 2:Wit.ai on the Raspberry Pi


Run these commands in the Pi.

wget http://github.com/wit-ai/witd/releases/download/v0.1/witd-armv6
chmod +x witd-armv6

./witd-armv6
by running this in the terminal, Pi acts as server

Sending Requests
Start recording audio and streaming it to wit.ai:
$curl -X GET http://localhost:9877/start?access_token=
<YOUR_ACCESS_TOKEN>

Stop recording audio and receive the wit.ai response:


$ curl -X GET "http://localhost:9877/stop

The response is
{"_text":"Hello world","msg_id":"fbe2a1ff-3869-49d8-885d67e23357ffdc","outcomes":[{"_text":"Hello
world","confidence":0.263,"entities":{"location":[{"suggested":true,"val
ue":"Hello world"}]},"intent":"get_weather"}]}
To get the response in a file use this command
> filename.json
along with stop command
To save the executing time , we write all these commands in a shell
file.
Then we only run that shell file, no need to type all commands in a
terminal.
$ sh filename.sh

Client side Programming

Server side Programming

Interfacing relays with L293D

Connecting Loads to the Relays


Internal Diagram:

THANK YOU

Vous aimerez peut-être aussi