Dipping One’s Toes in Home Automation Waters
31 August 2023
Figure 1: The classic Arduino Uno R3
Everywhere we look these days, we see new examples of automation within the domestic environment - such as smart thermostats capable of automatically learning and implementing our preferences and smart doorbells that can also be used to remotely lock/unlock doors or check against suspicious activities.
Then, of course, there are voice-controlled assistants, such as Alexa (Amazon), Bixby (Samsung) and Siri (Apple), that allow us to control almost everything from lights through to washing machines and heating/air conditioning systems.
A lot of people are becoming interested in creating and deploying their own automation projects, but it can be difficult to know where to start. Even in the case of professional engineers, hardware specialists may lack confidence with respect to their software expertise, while software developers may feel trepidation when it comes to the hardware side of things. Fortunately, technological advances coupled with the advent of open source hardware (OSH) and open source software (OSS) ecosystems have made it possible for anyone to participate in home automation projects.
The way things were
When did home automation begin? There’s a good argument to be made that the first forms of it came into being with the invention of electric motors (circa mid-1800s) coupled with the introduction of pushbutton switches (which appeared on the scene around 1880). For example, a pushbutton could be used to control a motor driving a dumbwaiter.
It should be acknowledged that not everyone is enthralled by the concept of automation. As far back as 1916, for example, as described in ‘At the Interface: The Case of the Electric Push Button, 1880-1923’, educational reformer, social activist and best-selling American author Dorothy Canfield Fisher warned; “There is a great danger of coming to rely so entirely on the electric button and its slaves that the wheels of initiative will be broken, or at least become rusty from long disuse.”
Happily for us, most people remained un-swayed by her pessimistic prognostication. There was plenty of initiative demonstrated imagining new things to activate with buttons. For example, the first basic electric garage door opener was invented in 1926, with more sophisticated versions following over time.
Similarly, when televisions arrived, it wasn’t long before their owners started to begrudge the time and effort required to stand up and walk across the room to adjust the volume or change channels. The first commercially successful TV remote control was the Zenith ‘Lazy Bones’ - which was introduced in 1950. This involved a motor-driven mechanism that operated the channel tuning knob. The viewer controlled the mechanism by means of an unsightly cable that trailed across the living room floor. As a result, although viewers enjoyed the ability to control the TV from the comfort of their armchairs, many of them complained about tripping over the cabling, and it soon became obvious that aspect had to go.
Figure 2: The new Arduino Uno R4 Wi-Fi
These days, we take the term ‘wireless’ to imply the use of radio frequency (RF) communication, but other wireless technologies are available. In 1955, for example, Zenith brought out its first optical wireless TV controller - the ‘Flash-Matic.’ This involved 4 photoelectric cells mounted in the front of the cabinet at the 4 corners of the screen. Using a flashlight-like device reminiscent of a ray-gun from a science fiction film, the viewer shone a beam of light onto the desired cell to control channel selection (up/down) and volume (higher/lower).
Wireless activation has become commonplace, whether the emitter uses RF, light, ultrasound or some other part of the spectrum. Many of the sensors involved are now essentially commodities. Wider adoption would be contingent only on availability of development kits with processors, tools and software.
Open source eases progression
Until relatively recently, anyone wishing to implement some form of home automation would have been obliged to create almost every element of that system from the ground up. One of the reasons this is no longer the case is the introduction of the OSH/OSS concept.
Another major driving factor for do-it-yourself (DIY) home automation is the availability of powerful, low-cost, open source microcontroller development platforms - such as the widely popular Uno from Arduino. The open source nature of Arduino platforms has spurred companies like Adafruit and SparkFun to create complementary open source hardware offerings like plug-in boards called ‘shields’ and break-out boards (BOBs) carrying sensors and actuators, all accompanied by open source example software, documentation, tutorials, etc.
One of the secrets to Arduino’s success is its intuitive integrated development environment (IDE), which is used to capture programs or ‘sketches’ (in the vernacular of Arduino) in C/C++ and upload them to the microcontroller. This easy-to-understand and highly usable interface has smoothed the way for hardware-centric individuals to enter the software world.
Preeminent among the various Arduino microcontroller hardware options (with their respective features, functions and capabilities) is Uno. It has achieved almost iconic status, with its header footprint into which shields can be connected. Introduced in 2011, the Arduino Uno R3 has sold more than 10 million units globally. Also, it has spawned the development of numerous shields - carrying sensors, actuators and displays - along with ones for motor control, servo control, relay operation, Wi-Fi connectivity, etc.
The processor resource employed in the Uno R3 is an 8-bit ATmega328P microcontroller. Running with a 16MHz clock frequency, this device has 2kBytes of RAM (used to store variables and data) and 32kBytes of flash memory (for storing the user’s program). When the Uno is powered up, it immediately starts to run whatever program is currently contained within its flash.
Figure 3: The Arduino 4 relays shield
Empowering interconnected projects
While it is certainly the case that classic Uno R3s have been used in a wide variety of home automation projects, it must be acknowledged that they are somewhat limited in terms of memory and processing power. Furthermore, functionality like Bluetooth and Wi-Fi must be implemented in the form of add-on shields.
For projects needing more processing capacity, Arduino recently introduced 2 new types of Uno - the Uno R4 Minima and Uno R4 Wi-Fi. Both R4s are powered by a 32-bit RA4M1 microcontroller from Renesas. Running with a 48MHz clock frequency (3x the R3), the R4’s 32-bit data bus is 4x the width of the R3’s 8-bit bus, its 32kByte SRAM is 16x greater than the R3’s, while its 256kByte flash memory is 8x more than for its predecessor. Also, the R4’s processor includes a hardware floating-point unit (FPU), allowing it to rapidly conduct floating-point operations (whereas the R3 is obliged to perform these operations in 8-bit ‘chunks’).
Furthermore, the Uno R4 Wi-Fi includes an Espressif ESP32-S3 module, enabling both Wi-Fi and Bluetooth LE connectivity. A 12 x 8 red LED matrix can be programmed to display animations, graphics, or act as a feedback interface - allowing data visualisation without use of any additional hardware (Figure 2).
The Uno R4 Wi-Fi comes with full support for the Arduino IoT Cloud, an all-in-one intuitive IoT platform upon which dashboards can be created. Dashboard access is possible from an intuitive web interface or the IoT Remote smartphone app. Cables are no longer needed to program the devices with over-the-air (OTA) updates made possible. Furthermore, it provides effortless synchronisation of variables and data between multiple devices, eliminating much of the complexity seen with previous systems.
The ‘Hello World’ of home automation
One of the first things software developers tend to do when presented with a new system is to create a ‘Hello World’ program. In addition to demonstrating that the system is functional, this exercise acts as a sanity check to ensure the tools employed to compile the source code and run the program are correctly installed and that the operator understands how to use everything.
There are 2 ‘Hello World’ equivalents employed by hardware engineers. The first is to prove the ability to read the state of a switch (i.e. on/off or active/inactive). The second is to control an LED. Oftentimes, these activities are combined, writing a program that causes a processor to read the state of a switch and use this state to control the LED.
In the case of home automation, a good ‘Hello World’ equivalent starting point would be to have a switch connected to an Uno R4 Wi-Fi, to connect that unit to the cloud, and to be able to use a web browser on a computer or smartphone to monitor/control the state of that switch from anywhere in the world. An alternative approach would be to connect an LED to the R4 Wi-Fi and to use a web browser to control the state of that LED.
Figure 4: Controlling an air conditioner remotely
Actually, as opposed to connecting the LED directly to the R4 Wi-Fi, it would be better to plug an Arduino 4 Relays Shield (Figure 3) into the R4 Wi-Fi and then use one of the relays to control the LED to provide a proof-of-concept (POC). Later, the LED could be replaced with… well, almost anything, really.
The wonderful thing about all of this for beginners is that they can take full advantage of the free-to-use Arduino IoT Cloud, which allows them to connect smart devices (like the R4 Wi-Fi) in minutes, generate dashboards and monitor/control projects from any location. All of these activities are supported by a wealth of documentation, tutorials and sample code. For example, Arduino can be used as a smart infrared repeater to provide intelligence and cloud based control to previously standalone devices, such as older air conditioning units (see Figure 4).
Once someone has the home automation ‘Hello World’ fundamentals locked down, they can find a wealth of Arduino Cloud-enabled home automation projects to play with. These include a smart pantry, smart coffee machine, smart pet feeder, smart trash can, smart window blinds, smart air quality control, smart washing machine alert, smart plant watering system, etc.
Want to take a dip into home automation? Come on in, the water’s fine!
Contact Details and Archive...