Right now, dwelling automation utilizing Web of issues (IoT) is among the main domains which is attracting consideration from giant tech corporations.
All of us need to personal a sensible dwelling, however typically language turns into a barrier in organising IOT dwelling automation system. Many of the current dwelling automation programs assist just a few languages, typically English.
Wouldn’t or not it’s good if we are able to management our dwelling with a number of languages like Hindi, Bengali, Marathi and so forth?
Sure, it’s attainable now! On this DIY challenge, we’re going to make an IOT dwelling automation system that can help you management your private home with voice instructions given in your most popular language.
This dwelling automation system makes use of google assistant to manage the good gadgets at dwelling. So, it additionally helps all of the languages supported by the google assistant. We may even make an app to manage the system.
Let’s begin the challenge –
Invoice of Materials
Setting Raspberry Pi
The very first thing we have to do is to arrange an Apache server in Raspberry Pi. To do it, open the terminal window and run the next command.
sudo apt-get set up apache2 -y
After profitable set up of the server, we are able to test it by typing the I.P tackle of your Raspberry Pi in any internet browser. If the server is working positive, we’ll get the Apache web page within the internet browser. Now, we’ll use our Apache server to course of PHP Recordsdata, for this it is advisable have the most recent model of PHP module for Apache. To get this module run this command –
sudo apt-get set up php libapache2-mod-php -y
Subsequent, we’ll create a PHP file to manage the GPIO of Raspberry Pi. To take action, open terminal in Raspberry Pi and go to its html listing by this command as you possibly can see in Fig 1.
Subsequent create a PHP file through the use of “sudo nano lightsoff.php” command
and write the next piece of code in it,
System (“gpio -g mode 27 out”);
System (“gpio -g write 27 0”);
Then press Ctrl+X to save lots of and exit from the editor.
After this create a lightson.php file for turning the lights on and paste the next code in it.
System (“gpio -g mode 27 out”);
System (“gpio -g write 27 1”);
Repeat the identical course of for controlling different GPIO of Raspberry Pi.
You possibly can obtain the entire code for turning lights on and off from the hyperlink under.
Setting Google Assistant
Now, we’re going to put together the google assistant for our voice command. First open the language settings of google assistant and choose the language of your alternative. Then open the google assistant settings and go to “Routines” choice. You’ll get a plus floating button within the menu of Routines, click on on that after which set the voice command that you just need to create. For instance, if you wish to management lights, you possibly can set the voice instructions in your most popular language to activate the lights. After this, set the motion for that voice command within the given format (Refer Fig. 3,4,5,6,7)
“search Rpi IP address/ PHP file name”.
Search 192.168……../ lightsoff.php.
Now join the elements as illustrated under.
Raspberry pi Relay Board
GPIO 13 Relay IN 1
GPIO 15 Relay IN 2
5V Relay 5V
We are able to additionally create an app to manage the lights. Let’s make the app.
Open Android studio and create a brand new challenge with backside navigation bar and do coding as illustrated under (Refer Fig. 10 ,11,12,13,14).
To start with, set the permission in app to entry the web as a result of we’re going to use Wi-Fi to manage GPIO of RPi.
Then go to Mainactivity.java and create a WebView and String variables as within the image under.
Fig 14. Creating Navigation bar
Energy the Raspberry Pi with 5V DC. Then join Raspberry Pi and your telephone to your Wi-Fi community or you may as well use telephone HOTSPOT. Then say “hey google” adopted by the voice command that we’ve got set in our most popular language. For instance, say “hey google light on kar do”
And it’ll activate the lights. You may as well management lights with the app we’ve got simply created. Open the app and press the icons in navigation to show the lights on/off