Skip to main content
Skip to main content

Home automation with AI

Integrating Digital Technologies
Years 5-6; 7-8

DT+ Design Technologies; DT+ Science

Home automation is all the rage. You talk to your mobile phone to control the lights, the fan, the air conditioner, or your pool pump. But how does it work? In this lesson, we explore the AI that could power a home automation system.

This lesson provides a level of differentiation to cater for students’ range of programming skills.

Developed in collaboration with Digital Technologies Institute.

Preliminary notes

Key terms

Screenshot of the My Computer Brain tool showing different input patterns, such as switch, light, on, off, dark, bright, warm, cold and the resulting outputs that can occur, such as lights on or off, and fan on or off.

Tool used in the plugged part of the MyComputerbrain activity

This image shows the view in the MyComputerbrain application for the level 1 differentiation of the activity. On the right, we see four actions that our home automation system can execute. It can turn the lights on or off, and the fan on or off.

The left-hand side of the image depicts an artificial neural network (ANN), described here as the ‘input pattern’. The boxes in the input, hidden and output layers are called ‘perceptrons’. These can be likened to neurons in the brain. Within the input pattern, we see all the words that the ANN is able to understand. The three black boxes, ‘switch’, ‘light’ and ‘on’, represent one set of training data. You can drag the slider above the ‘input pattern’ label to see all training data.

Suggested steps

Unplugged activity

  1. Discuss the internet of things (IoT), which has made it possible to automate many processes we undertake in our daily lives. Now with the emergence of AI and the opportunities for voice commands, another level of automation is possible.

    In pairs, ask students to sketch the floor plan of a typical house, and draw and label five ways that they could make the home a ‘smart home’ through automation. As a class, have the students share the different ideas. Which of them require AI? Which require sensors? How would digital and electrical systems interact with each other?

  2. Discuss home automation:

    • Have you used home automation personally? What were your experiences?
    • Why do people use home automation?
    • What are some typical use cases for home automation?
    • How might a person with a disability benefit from home automation?

    Explain that computers can be programmed to be intelligent or, at least, smart. Ask the class if they think a computer could understand the meaning of something they say or write. How would it do that? At this point, students might mention their use of Siri, Alexa or similar technologies.

  3. This step relates to the main components of common digital systems and how they may connect in the context of home automation.

    • Input: What forms of human input might a home automation system process (speech, written text, gestures etc)?
    • Decision-making: How might a home automation system process human input in order to decide what needs to be done?
    • Output: How might a home automation system turn a decision into a physical action? This question alludes to what is known as ‘actuators’, such as computer-controlled electronic switches or motors.

Input, decision-making and output, in the context of a home automation system, are highly suitable for covering a range of content descriptors in the Australian Curriculum: Digital Technologies. Consider flow charts or any other form of diagram to conceptually explore sequences, branching and iterations.

The purpose of this step is not to write any code, but to explore and visualise possible steps and actions that might occur in a home automation system. This step also provides an opportunity to discuss scientific ideas about electrical systems and how they can be controlled by a digital system.

Plugged activity

The plugged activity explores input and decision-making, as discussed in Step 3 above. For the output step separate activities can be undertaken with Arduino, Raspberry Pi, or BBC micro:bit. These activities demonstrate how code drives actuators.

This plugged activity allows students to interact with an AI application to recognise written commands and make meaningful decisions, such as turning the lights on or off. No coding is required by the teacher or students. Students can use a total of 12 expressions, including single words and whole sentences, to train the AI.

The underlying AI runs locally in the browser, so it’s learning speed only depends on the speed of the local processor, rather than internet speed. For example, the training process will take approximately 30 seconds on a 2012 laptop.

To increase the speed of the learning process, the lines representing the synapses can be hidden by clicking on 'Hide wires' in the menu.

Screenshot of Hide Wires button.

To see the colour changes of the lines representing the synapses, drag the slider to the left.

Screenshot of the colour slider.

Note, however, that this will slow the learning process.

The activity has been levelled to enable differentiation.


  1. When the AI has been trained, highlight the level of shading for the four output perceptrons of the ANN to represent the confidence level.
  2. Hover over any of the output perceptrons to display a pop-up that shows the perceptron’s internal values.
  3. Discuss the scale. If the box is fully black this means that the AI was very sure, whereas a light grey means that it was not quite sure.
    • When was the AI very sure of its guess?
    • When was it not so sure?
    • In the example below, the AI is 0.91 sure that the input ‘lights’ is to be understood as a command to switch the lights on.
    Screenshot showing the various inputs that an AI might hear, such as too dark, bright, fan, warm, cold, and the AI's confidence level that it has produced an appropriate output in response.

    Confidence level

  4. Observe the table with the headings ‘input’, ‘weight’, ‘product’, ‘sum’ and ‘output’.
    • Each perceptron receives input data from other perceptrons.
    • Each input is multiplied by a weight, leading to a product.
    • The products are added up, leading to a sum, and then pushed through a function, which determines the output of the perceptron.
    • Notice that the mathematics is not very difficult, but quite effective.
    • Hover your mouse over any perceptron to check its data. Observe that the colour of the lines that connect to the input of a perceptron on its left correspond to the colours in the ‘weight’ column in the table.
  5. Let students visually compare the ANNs on their computers. Note that the colours of the lines will be different among ANN instances. The reason that each ANN is unique is that each starts with different random values in the synapses. These are represented in the weight column. If we had assigned the same value to each weight at the start, then the ANN could not have learned. The learning process leverages these small differences to achieve a successful learning outcome.
  6. Reset the experiment and retrain the ANN. Observe how the colours of the lines change as the AI learns. Green indicates positive values, red indicates negative values and black is neutral (close to zero). These lines regulate the data flow between the perceptrons and can be compared to the synapses in our brains and they.
  7. Is green more valuable to the learning than red or black? No, they are all equally required to achieve the learning outcome.
  8. Note that the words from the training data are provided to the ANN as binary numbers. The ANN–internal representations of the words are 1’s and 0’s.

    Background note

    The function depicted above is a Sigmoid-function: f(x)= 1 / (1 + e^(-x)). During the learning process, the ANN also uses the following derivative of the Sigmoid function: df(x)/dx = f(x) * (1 - f(x)).

Why is this relevant

AI is the ability of machines to mimic human capabilities in a way that we would consider 'smart'.

Machine learning (ML) is an application of AI. With ML, we give the machine lots of examples of data, demonstrating what we would like it to do so that it can figure out how to achieve a goal on its own. The machine learns and adapts its strategy to achieve this goal.

In our example, we are feeding the machine with words. The more varied data we provide, the more likely the AI system will correctly classify the input as the appropriate output. In ML, the system will provide a confidence value. In this case, it is a decimal value between 0 and 1, and the output box is coloured white, shades of grey or black. The confidence value provides us with an indication of how sure the AI is of its classification.

This lesson focuses on the concept of classification. Classification is a learning technique used to group data based on attributes or features.