Lesson 17: Home Automation System

Lesson Description

In this lesson, you will learn about home automation and its advantages. You will also learn how to make a home automation system that will use voice commands to control the lights of the room.

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

  1. 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!
  2. The ability to control your devices using an app gives you the additional advantage of controlling them even when you’re away from home.
  3. Home automation allows you to add new devices and features to your home and replace the old ones with advanced appliances with ease.
  4. 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.
  5. 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!
  6. 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:

  1. Open the NLP project created in the last lesson in PictoBlox App.
  2. To recognize voice (speech), we need the Artificial Intelligence extension. From the extension palette, add Artificial Intelligence.
  3. 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.
  4. Add a say () block below the recognize speech for () s in () block. Inside the say () block, drop a speech recognition result block.
  5. Complete the script with a when flag clicked block.
  6. Run the script to check it.
  7. Connect Quarky to PictoBlox.
  8. 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:
    1. Remove the say () block.
    2. 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.
    3. Add an if Inside the diamond-shaped space, add an () = () block from the Operators palette.
    4. Inside the first space of the () = () block, drop a get class of () block. In the second space, write “Lights On”.
    5. Inside the get class of () block, drop a speech recognition result block.
    6. Drop a display matrix as () block from the Display palette and color all the squares white as shown.
    7. 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.
  9. 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 quizbefore moving on to the next lesson.

Table of Contents