top of page

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.

Let's consider a simple artificial neural network that takes a range of input commands and turns them into decisions to turn the lights or the fan on or off.

You can follow these steps along by opening the application MyComputerbrain in a separate browser window.

The image above shows the view in the application. On the right, we see the actions that our home automation system can execute. It can turn the lights on or off, and the fan on or off.

On the left hand side we see all words that the ANN is able to understand. The three black boxes ‘switch’, ‘light’, ‘on’ represent one set of training data. Drag the slider above the words ‘Input Pattern’ to see all training data. In between the input and output is an artificial neural network (ANN). The boxes in the input, hidden and output layer are called Perceptrons, corresponding to neurons in the brain.

Training the network

Before we can use the network, we have to train it first. Let's run the training process by clicking on the start learning button in the top right corner of our screen

The training data will be shown to the AI and it will make a series of repeated improvement attempts until the error of the network falls below a preset threshold. This process is called backpropagation.

The dial at the bottom-right will eventually turn green when the training process is complete. The network is now trained.

In this scenario, we use text input, but it isn't hard to imagine how a speech to text module would listen to verbal commands and convert them into text, or, alternatively, provide the audio directly to the ANN. We use text here, because of its simplicity.

Let's now enter a command for the AI to analyse. We could try my oven is too warm. Note how the AI is initially unsure about what to make out of 'my oven is', but then the words 'too warm' lock in with the AI's knowledge base. The result is that the fan gets switched off.

Let's assume you enter a room and you say just 'lights'. Most of us would want the lights on. This is an interesting case, because the word 'lights' is used both in conjunction with turning lights on and off.

Interestingly, the AI agrees with our human notion of 'lights' and decides that turning on the lights is the right decision over and above turning the lights off. Notice how the 'Lights on' output is firmly black whilst the 'Lights off' block is grey. This is an indication of how confident the AI is. Hover your mouse over the blocks to see inside.

Try to find a scenario that turns the fan on and the lights off!

In the experiment, the scenario and the training data were fixed. This is suitable for younger students and beginners. However, you can level this up and give students a freer reign over the scenario and training data.

In the following experiment you can build a simple home automation system that can do any four different things at your command.

Discussion & Reflection

Exploring the necessary elements of home automation, let's consider the main components of common digital systems and how they may connect.

  1. Input: What forms of human input might a home automation system process (speech, written text, gestures, …)?

  2. Decision-making: How might a home automation system process the human input in order to come to a decision about what needs to be done?

  3. Output: How might a home automation system turn the decision into a physical action? This refers to what is called actuators, such computer-controlled electronic switches or motors.

These three aspects of a home automation system are very suitable to cover a range of content descriptors in the Australian Curriculum:Digital Technologies. Consider flow charts or any other form of diagrammatic representation 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 home automation system. This task also provides an opportunity to discuss scientific ideas about electrical systems and how they are controlled using a digital system.

Our activity explores the above steps 1 (input) and 2 (decision making). For 3 (output) via physical actuators, a separate activity can be undertaken with Arduino, Raspberry Pi, or BBC micro:bit activities that demonstrate how code drives actuators.

The lesson plan for this activity, jointly developed by the Digital Technologies Hub and the Digital Technologies Institute, is now available. It can be accessed on the DT Hub Website.

Let us know what you think.

Until next time,

The Doctor.

Acknowledgements. We'd like to thank Apps For Good, UK and the Digital Technologies Hub for their contributions to the inspiration and refinement of this scenario.

 

If you want to constantly improve your skills as a Maker, you should read this now...

Starting in only a couple of days (December 7th-13th), our friend Peter Dalmaris is hosting a free (limited time only) online event packed with incredible presentations by Makers, for Makers.

Whether you’re a beginner or have been a Maker for a long time, you’ll find tons of great ideas and actionable info from world-class Makers such as Simon Monk, John Teel, Jason Long, Alain Pannetrat, Richard Kolk, Karsten Schulz and many more.

Here’s just a small sample of what you’ll learn during the summit sessions:

  • How to create graphics and animation using an Arduino and an LCD display

  • How to create almost anything with a laser cutter and 3D printer

  • How to re-shape society through Making

  • How to contribute to your favourite open-source project, even if you are not a programmer.

  • How to take your electronics prototype to market.

  • How to use the BBC Micro:bit in your next project.

  • How to design (and build) your own microprocessor.

  • How to design control algorithms using model-based design methodologies.

  • How to get started with embedded system design.

  • How to use JSON in your Arduino IoT projects

  • How to get on to IoT 2.0, a network dedicated to 20 billion devices.

  • How to build a reliable wired IoT system with noCAN.

  • Plus much, much more

And, Karsten Schulz is one of the Speakers in this Summit. In his presentation, he will talk about the computer processor. In short, he will be showing the inner workings of a computer processor, and how he built his very own from scratch. The result is the B4, a 4-bit processor construction kit that demonstrates key computing concepts, including memory, load, store, addition, and subtraction. This tool is perfect for teaching students, teachers and even makers such as yourselves how a simple computer operates. It even has a virtual companion, the B4 MyComputerBrain simulator, which runs in a browser. The site hosts a series of interactive experiments that lead to a functional 4-bit processor, capable of carrying out basic arithmetic operations. Both of these items are not just concepts or prototypes, but actual products that you can purchase. You can find them in the shop.

If this or any of the other speaker's talks would interest you, register using our affiliate link for the summit here at techexplorations.com/st/summit/registration/?ref=11.

And to help you keep track of it all and get the most out of the event, Peter just released the 2019 Maker Mind Meld Summit Playbook.

>>>Get the Mind Meld Summit Playbook for FREE here: techexplorations.com/st/summit/playbook

 

In science, students conduct experiments during which they measure all sorts of things, such as time, temperature, force, etc. Students collect the data in a table, plot the data points in a cartesian plane and then try to find a curve that best fits the data. For this, they need to formulate a hypothesis. Is the relationship linear? Exponential? Logarithmic? Polynomial? Or perhaps a combination of some of them?

What if an AI could find the best curve and make predictions of what is happening between and outside our data points we have measured in the lab? For our scientist readers: Yes, we are talking about interpolation and extrapolation.

Artificial Neural Networks (ANNs) are essentially multi-dimensional optimisation engines. Let's see if they are up to the job. We start with the experiment to obtain data.

A science experiment

A student investigated the influence of temperature on the reaction rate of hydrogen peroxide and potassium sodium tartrate with the catalyst cobalt chloride. The student measured reaction times three times each for 30, 40, 50, 60, and 70 °C. The experiment didn't finish at 30°C, so the student entered the maximum elapsed time of 1200 seconds = 20 min. The student recorded the data in a table:

The student then charted the data.

AI training data

The training data is easily obtained from the experiment. Internally the ANN works with numbers from 0 to 1, so we need to normalise our data. Some ANNs do this automatically for us, so let's take a quick look at how this works. First, we find the maximum values for temperature and time. From the table, that's 70°C and 1,500 seconds. We want a little bit of margin, and go with 100°C and 2,000 seconds.

We divide all our temperature values by 100 and our time values by 2,000. This leads us to the normalised data, which the AI can work with.

The learning process

Let's run the training process by clicking on the start learning button in the top right corner of our screen.

The training data will be shown to the AI and it will make a series of repeated improvement attempts until the error of the network falls below a preset threshold. Sit back and observe how the red dots, representing the ANN's knowledge base, start moving towards the black dots (our lab data). The video below is a real-time recording. The seconds are a calculated output from the AI and not a progress indicator. The process is fast!

We can now drag the temperature slider to set temperature values between and outside of our experimental data. You can see this as the red curve in the image below. This visualisation helps us to form a hypothesis and, if we want, test this further in the lab. In this particular case, the part of the curve for temperature values above 30°C looks a lot like an exponential function in the general form y=a*e^(-bx).

If you want to try this yourself, head over here: You will need to create a free teacher account, which takes no more than 30 seconds. Student accounts can be purchased from the built-in shop for a reasonable amount of $5.

Let us know what you think.

Until next time,

The Doctor.

Acknowledgement. We want to thank Esther Schulz, year 11 student from Kenmore State High School in Brisbane for conducting the experiment and for allowing us to use her data.

Featured Posts
Recent Posts
Archive
Search By Tags
bottom of page