Multi-Language Voice Control IoT Home Automation Using Google Assistant and Raspberry Pi

I. Summary

The purpose of this project is to build a multi-language voice control IoT home automation using Google Assistant and Raspberry Pi. This project will enable the user to control a home despite the language being used. This will be enables by using IoT devices, various components and the Raspberry Pi Smart devices and home automation is growing with the advancement of technology, specially IoT devices. It is important for upcoming engineering students to have basic knowledge about IoT devices, so the student can thrive in a job dealing with the design of smart cities, smart homes, smart devices and more.

II. Objectives

The purpose of this project is to build a multi-language voice control IOT home automation using Google Assistant and Raspberry Pi. The project will teach the student about image processing and to program the Raspberry Pi device.

III. Industry-Based Applications

This project is related to industry by many companies are implanting the internet of things into many products. These products are seen in everyday lives products, such as, televisions, refrigerators, smart speakers and more. Therefore, it is important for student to become familiar with IoT devices and the construction of them. The IoT devices will be the future of many engineering design projects. This project will develop the students programming skills and circuit design for real world application of a product.

In another paragraph (or same previous paragraph), you should tell where the importance of your project can be used in industry and use reference number ([xx]). References should be all at the end of the paper.

I. Project Methodology

a. Parts

  1. Raspberry Pi Zero W
    1. Raspberry Pi Camera
    1. Raspberry Pi Case
    1. 5V Relay
    1. Servo motor and wires

b. Procedure

i. Setting Up Raspberry Pi

  1. Set up an Apache server in Raspberry Pi.
  • Open the terminal window and run the command “sudo apt-get install apache2 -y”
    • Check it by typing the I.P address of your Raspberry Pi in any web browser
  • If the server is working fine, the Apache page in the web browser.

Use the Apache server to process PHP Files, for this the latest version of PHP module for Apache. To get this module run the command, “sudo apt- get install php libapache2-mod-php –y”

  1. Create a PHP file to control the GPIO of Raspberry Pi. To do so, open terminal in Raspberry Pi and go to its html directory by this command as you can see in Figure 1.
    1. Create a PHP file by using the command “sudo nano lightsoff.php” and write the code:
      1. <?php
  • System    (“gpio -g mode 27 out”);
  • System (“gpio -g write 27 0”);
  • ?>
  • Press Ctrl+X to save and exit the editor.
  • Create a lightson.php file for turning the lights on and paste the code into the files:
    • <?php
  • System    (“gpio -g mode 27 out”);
  • System (“gpio -g write 27 1”);
  • ?>
  • Repeat the same process for controlling other GPIO of Raspberry Pi.

ii.   Setting Up Google Assistant

  1. Open the language settings of google assistant and select the language of your choice.
  2. Open the google assistant settings and go to “Routines” option.
  3. Click on the plus floating button in the menu of Routines to set the voice command.

iii.   Connection

  1. Use the illustration below to connect relay board and Raspberry Pi

iv.   App Making

  1. Open Android studio to create a new project with button navigation bar and do coding as illustrated in Figures 10 through 14.
    1. Set the Permission in app to access the internet to use Wi-Fi to control GPIO of Raspberry Pi.
    1. Go to Mainactivity.java to create a WebView and String variables like in Figure 11.
    1. Create the navigation Bar.

v. Testing

  1. Power the Raspberry PI with 5V DC.
  • Connect Raspberry PI and phone to a Wi-Fi network or hotspot.
  • Next, say “hey google” followed by the voice command that is set in the preferred language
  • It will turn on the lights
  • The app can be controlled using the app as well.
  • Open the app and press the icons in navigation to turn the lights on/off

II. Photos and References

  1. https://electronicsforu.com/electronics-projects/multi-language-voice-

control-iot-home-automation-system-using-google-assistant-and-raspberry-pi

Code: https://electronicsforu.com/wp-contents/uploads/2019/05/CODE.zip

Figure 2- This is the code in PHP
Figure 3- Setting up the language in google assistant
Figure 4- Finding the google assistant settings
Figure 5- Google assistant setting menu
Figure 6- Google assistant routines settings
Figure 7- Google assistant command settings
Figure 8- Shows the connection between the relay, light and raspberry pi
Figure 9- The picture above shows the physical connection enclosed into a box
Figure 10- The code shows how to set the permission in manifest
Figure 11- the code shows how to create WebView
Figure 12- This figure shows how to create the code to load URLs of RPi server
Figure 13- This is creating the navigation bar

About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Scroll to Top