We declare that we carried out this project ourselves under the supervision of Eng. First of all, we express our sincere thanks and gratitude to Almighty Allah for His divine blessing which enables us to complete this project successfully.
Introduction
When the entire system is completed and prepared to receive voice command and work through our voice, it generates huge amounts of data. The purpose of these projects is to make human life comfortable and at the same time relieve human pressure. i) Control home appliances on human voice command;. ii) People with physical disabilities benefit more; iii) Maintaining a database based on our usage;. iv).
IoT
To Ring, a doorbell connected to our advanced mobile phone, is a clever example of the continued expansion into the Internet of Things. While the Internet is a communication network that connects people to information, the Internet of Things (IoT) is an interconnected ecosystem of uniquely addressable physical objects with different levels of sensing, processing, and actuation capabilities that share the ability to communicate and interact via the Internet as their common denominator [1].
Voice Controlled Home Automation System
As such, we expressed that the Internet of Things is the arrangement of any gadget with an on/off change associated with the Internet. Almost every thing in our life is possible to take closer to the touch of IoT.
Goals of The Project
Organization
Raspberry Pi
Specifications
Pi 3 has 1GB of LPDDR2 RAM which works at 900MHz, this also makes it faster than other older versions and Raspberry Pi zero W. Networking: Raspberry Pi 3 has 2.4GHz 802.11n wireless built in, making this device more reliable than The Pi 2 which only had Ethernet as well as it has 10/100 Ethernet connectivity as well.
General Purpose Input Output (GPIO)
Pulse Width Modulation (PWM): Although it used to express all GPIO pins on raspberry pi devices, software PWM is available and hardware PWM is available on GPIO12, GPIO13, GPIO18 and GPIO19. Serial communication protocol: Raspberry pi uses bi-directional two-wire (I2C) serial bus that provides a communication link between ICs [5]. The GPIO pin numbering system is not in numerical order, there are two numbering systems available, one GPIO.BOARD and another GPIO.BCM.
The GPIO.BOARD numbering system identifies the pins as shown in Figure: 4, and the GPIO.BCM identifies the pins as a Broadcom SOC channel.
USB Sound Card
Microphone
Speaker
DHT11 Sensor
Breadboard & LEDs
Light Emitting Diode (LED) are the two LED semiconductor light sources. LEDs are like small light bulbs that can easily be connected into an electrical circuit. These small LEDs already replace the tubes that light LCD/LED HDTVs to make the televisions thinner.
Configuring Raspberry Pi
Required Item
- Installing Rasbian Debian Wheezy Operating System using windows
- Format the SD card
- Using Etcher
- Plugging into the Raspberry Pi
- Logging into the Raspberry Pi
Insert the SD card into our SD card user (fix SD card) and check which drive letter is ejected. When we use an SD card slot on our computer and can't see the drive in the Win32DiskImager window, try using a cheap SD adapter in a USB port. Allocate the SD card drive in the browser and second click the mouse to display the context sensitive menu.
A few moments later you will see a confirmation that the format is complete and your SD card is now ready for the next stage. Then click on the folder icon and select the unmodified .img file from before that we want to put on the SD card. Start by inserting our SD card into the SD card slot on the Raspberry Pi, which will only fit one way.
Next, connect our USB keyboard and mouse to the USB slots on the Raspberry Pi. Finally, when we have plugged in all the necessary cables and SD card, plug in the micro USB power supply. If this is the first time our Raspberry Pi SD card has been used, then we will need to select an operating system and configure it.
Installing Sound System
- Installation
- Testing the sound system
To get the graphical user interface (GUI), type starts and press Enter on our keyboard. Now that we've got our device and card numbers for our microphone and audio output, we need to create a file called ".asoundrc" in the pi's home user directory. The ".asoundrc" file helps us determine which audio devices the audio driver should use.
At this moment we need our USB microphone and speaker to attach with raspberry pi. For recording we run the following command on our raspberry pi. arecord –format=S16_LE –duration=10 –rate=16000 –file-type=raw out.raw. Now that our recording is done, we can run the following command to read our raw output file and play it back to the speaker.
Actually, in this project we want the Raspberry Pi not to be able to detect every sound, but to be able to detect the 'Ok Google'. aplay –format=S16_LE –rate=16000 uit.raw.
Getting Ready for Google Assistant
Configuring Google’s Developer Project
Then we click Add/Import Project to create a new project, which drives us to another web page where we have to accept some google terms, and then the new project creation window appears. Then we select the project name Smart-Home, which is in the red marked box and click on the Create project button. After clicking the button Create project, a new window will open where we have to select the device.
On this page we select Device Registration to activate our Raspberry Pi device as a client of Google Assistant and also by selecting this option it takes us to the Device Registration page and by doing this the creation of the Google developer project was done [13 ] .
Registering the Device Model
After filling in the name of the product, the company name of the manufacturer, a drop-down menu appears from which we select the product category. In this project we select only OnOff and StartStop properties because we want to turn on our devices like light, fans with this model. When we clicked Save Properties, we created a device for the project and its drive on this page, containing the device name and model ID we need for the next step.
Access Using OAuth 2.0
After the operation, the application saved the refresh token so that you can use the access token in the future to access a Google API. And if the access token expires, the application uses the refresh token to create a new token.
Installing Google Assistant SDK
- Configuring Python Virtual Environment
- Installing Python Library Packages
- Generating the Credentials
- Setting up the Hot-word
On the client side, google OAuth 2.0 authorization begins by redirecting a browser to a Google URL that includes query parameters that select the type of access requested by the end user.. sudo apt-get install portaudio19-dev libffi-dev libssl-dev libmpg123 -dev. Using pip we can install the latest version of Python packages in the virtual environment. python -m pip install --upgrade google-assistant-library .. python -m pip install --upgrade google-assistant-sdk[samples]. Refer to the JSON file we downloaded in a previous step. google-oauthlib-tool --scope .. https://www.googleapis.com/auth/assistant-sdk-prototype \- -scope https://www.googleapis.com/auth/gcm \--save -- . no header --client-secrets /path/to/client_secret_client- id.json.
Sign in to the Google Account that created the developer project in the previous step. d) After the API permission request is approved, the code is displayed in the browser. So we run the command in the terminal. env)$ googlesamples-assistant-hotword –project-id smart-home- 223411 –user-model-id smart-home-223411-raspberry-k0mywh. Then we can communicate with the Google Assistant with a hot word like "hey google" or "ok google".
Using this assistant we want to turn off our light, fan and other devices, so we need to download some python library again to interact Raspberry Pi with Google API [15]. This Github package contains the python code for the action.device.commands.OnOff feature that can turn on our LED. In this code, we have modified the import section to control the GPIO port for executing commands.
Systm Architecture
According to our voice command, it prepares the total system for execution. When the microphone gets the command lights on, it sends it to the raspberry pi and then executes it by turning on the light. When we give a voice command to the microphone to turn the light on and off, it sends it to the microphone and then the microphone generates a signal to access the cloud. First output for turning the light on-off and another is voice confirmation.
Overview of working procedure
Finally, from the picture above, we found that the sound card is attached with the raspberry pi to connect the speaker and microphone. Then run the sample Google Assistant SDK and the device is ready to communicate as a Google Assistant client. Example : When the user says "Ok google, turn on the light", the assistant gives the output by turning on the light.
It is not only to give a more pleasant and pleasant lifestyle to the customers, but also to help the frail or disabled and individuals living alone, with the aim that they can effectively handle any undertaking their in an accommodation. Making the plan sleeker and simpler to handle, with a technique to control more machines at the same time are the next prerequisite. We have so far managed to control a similar apparatus, model, a light, meanwhile in two unique rooms and have possessed the capacity to control larger loads, for example, a forced air system.
The voice controlled home computerization framework plan is both practical and prepared to be introduced into your primary family unit circuit. We have presented versatility throughout the framework, both the voice-controlled remote control and the application end. To date, home mechanization has been considered as something that just turns on/off your gadgets from the mobile phone, yet the situation is developing rapidly, usual computerization along with a sharp remote system of sensors began to understand the human condition.