Home Automation
These days, different devices such as phones, laptops, televisions, refrigerators, etc can communicate with each other all thanks to the Internet. Things have become so easy that you can even control your lights and fans using an app on your Smartphone.
This amazing technology is called home automation, the ability to automate the control of household features, activities, and appliances.
Home Automation Advantages
- The biggest advantage is that you can easily control multiple devices from one place, e.g. your Smartphone. You’ll have to learn how to use the app to control everything!
- The ability to control your devices using an app gives you the additional advantage of controlling them even when you’re away from home.
- Home automation allows you to add new devices and features to your home and replace the old ones with advanced appliances with ease.
- Smart homes can help use energy efficiently. With home automation, you can exactly control the temperature of your home or when to turn ON a device and when to turn it OFF thus helping you save energy.
- Another big advantage of home automation is security. You can easily lock and unlock your doors with a single tap on your Smartphone. Pair this with security and surveillance and you have a highly powerful security system!
- Home automation also helps you save time and money.
Activity: Making a Home Automation System
The system will use voice commands to control the lights of the room. We’ll train it in PictoBlox to recognize various commands of similar types such that even if the command that somebody else gives does not exactly match our commands, it will still understand them and perform the corresponding action – either to turn ON or turn OFF the light. For this, we’ll use the text classifier from the last session.
Coding Steps
Follow the steps below:
- Open the
NLPproject created in the last lesson in PictoBlox App. - To recognize voice (speech), we need the
Artificial Intelligenceextension. From the extension palette, add Artificial Intelligence. - Add a recognize speech for () s in () block into the scripting area. The default time is 5 seconds and the default language is US English. To confirm if the speech was recognized correctly, we’ll make Tobi repeat whatever we said.
- Add a say () block below the recognize speech for () s in () block. Inside the say () block, drop a speech recognition result block.
- Complete the script with a when flag clicked block.
- Run the script to check it.
- Connect
QuarkytoPictoBlox. - Turning the Lights ON/OFF Using Voice Commands: Now that we know that our text classifier works accurately, let’s make the script to control the lights using a voice command. We’ll display the result on Quarky’s matrix. Follow the steps below:
- Remove the say () block.
- Add the Train Data stack block below the when green flag clicked. Now, to analyze the command and take the corresponding action, we’re going to check if the class of the command is Lights On or not. If it is Lights On, then Quarky’s matrix should light up. And if it is Lights Off, then all the LEDs should remain OFF.
- Add an if Inside the diamond-shaped space, add an () = () block from the
Operatorspalette. - Inside the first space of the () = () block, drop a get class of () block. In the second space, write “Lights On”.
- Inside the get class of () block, drop a speech recognition result block.
- Drop a display matrix as () block from the
Displaypalette and color all the squares white as shown. - Duplicate the above if-arm and write Lights Off in the place of Lights On. And replace the display matrix as () block with clear screen block.
- Click the green flag to run the script. Save the file as
Home Automation System.
Make sure you finish and submit the assignment, as well as take the quiz, before moving on to the next lesson.