Smart home based on Arduino controllers: design and organization of controlled space

Amir Gumarov
Checked by a specialist: Amir Gumarov
Author: Mikhail Yashin
Last update: May 2019

The development of automation has led to the creation of integrated systems that improve the quality of human life. Many well-known manufacturers of electronics and software environments offer ready-made standard solutions for various objects.

Even an inexperienced user will be able to develop independent projects and assemble a “smart home” on Arduino to suit his needs. The main thing is to understand the basics and not be afraid to experiment.

In this article, we will consider the principle of creation and the basic functions of an automated house based on Arduino devices. Also consider the types of boards used and the main modules of the system.

Creation of systems on the Arduino platform

Arduino is a platform for developing electronic devices with automatic, semi-automatic or manual control. It is made according to the principle of a constructor with clearly defined rules for the interaction between elements. The system is open, which allows third-party manufacturers to participate in its development.

Classic “smart House”Consists of automated units that perform the following functions:

  • collect the necessary information through sensors;
  • analyze data and make decisions using a programmable microprocessor;
  • implement the decisions made by issuing commands to various devices.

The Arduino platform is good precisely because it does not close to a specific manufacturer, but allows the consumer to choose the components that suit him. Their choice is huge, so you can implement almost any ideas.

We recommend you to get acquainted with the best smart devices for home.

Arduino Starter Kit
To learn how to work with Arduino, you can purchase the Starter Kit on the manufacturer’s website. Knowledge of technical English is required, since the documentation is not Russified

In addition to the variety of connected devices, the programming environment implemented in C ++ adds variability.The user can not only take advantage of the created libraries, but also program the response of the system components to emerging events.

Main board elements

The main element of a smart home is one or more central (motherboard) boards. They are responsible for the interaction of all elements. Only having determined the tasks that will need to be solved, we can proceed to the selection of the main system node.

The motherboard combines the following elements:

  • Microcontroller (processor). Its main purpose is to issue and measure voltage in ports in the range of 0-5 or 0-3.3 V, store data and perform calculations.
  • Programmer (not all boards have it). Using this device, a program is written in the memory of the microcontroller, according to which the “smart home” will work. It is connected to a computer, tablet, smartphone or other device using a USB interface.
  • Voltage regulator. A 5 volt device is needed, required to power the entire system.

Under the Arduino brand, several motherboard models are available. They differ from each other in form factor (size), number of ports and memory size. It is for these indicators that you need to choose the right device.

Original Arduino Board
Arduino boards and shields for them are best purchased from the manufacturer, since they are better than compatible devices that are released in China

There are two types of ports:

  • digitalthat are marked on the board with letters “D”;
  • analogmarked with a letter “A”.

Thanks to them, the microcontroller communicates with connected devices. Any port can work both on receiving a signal and on its output. Digital ports marked “pwm” are intended for input and output of a PWM type signal (pulse width modulation).

Therefore, before purchasing a board, you must at least approximately evaluate the level of its load on various devices. This will determine the desired number of ports of all types.

It should be understood that the “smart home” system does not have to be tied into a control unit based on one motherboard. Such functions as, for example, switching on artificial lighting of the local area depending on the time of day and maintaining the water reserve in the storage tank are independent of each other.

From the standpoint of ensuring the reliability of the electronic system, it is better to separate unrelated tasks into different blocks, which the Arduino concept makes it easy to implement. If you combine many devices in one place, it is possible that the microprocessor overheats, software libraries conflict, and difficulties in finding and fixing software and hardware malfunctions.

Arduino based robot
The connection of many different types of devices to one board is usually used in robotics, where compactness is important. For a “smart home” it’s better to use its own foundation for each task

Each microprocessor is equipped with three types of memory:

  • Flash memory The main memory where the system management program code is stored. A small part of it (3-12%) is occupied by the wired bootloader.
  • SRAM RAM, which stores temporary data necessary for the program. Differs in high speed of work.
  • EEPROM. Slower memory, where data can also be stored.

The main difference between the types of memory for storing data is that when the power is turned off, the information that is recorded in SRAM is lost, but remains in the EEPROM. But the non-volatile type also has a drawback - a limited number of write cycles. This must be remembered when creating your own applications.

Unlike the use of Arduino in robotics, for most tasks of the “smart home” you do not need a lot of memory either for programs or for storing information.

Types of boards for building a smart home

Consider the main types of boards that are most often used when assembling a smart home system.

View # 1 - Arduino Uno and its derivatives

The most common smart home systems use the Arduino Uno and Arduino Nano boards. They have sufficient functionality to solve typical problems.

Arduino Battery Powered
The availability of power for full-format boards from a voltage of 7-12 volts provides many advantages. First of all, it is the possibility of long-term autonomous operation from standard batteries or accumulators

Main parameters of Arduino Uno Rev3:

  • processor: ATMega328P (8 bit, 16 MHz);
  • number of digital ports: 14;
  • of which with PWM function: 6;
  • number of analog ports: 6;
  • flash memory: 32 KB;
  • SRAM: 2 KB;
  • EEPROM: 1 KB.

Not so long ago, a modification came out - Uno Wi-Fi, which contains an integrated module ESP8266, which allows you to exchange information with other devices according to the standard 802.11 b / g / n.

The difference between the Arduino Nano and its larger analogue is the lack of its own power socket from 12 V. This is done to achieve a smaller device, which makes it easy to hide in a small space. Also for these purposes, the standard USB connection is replaced by a chip with a mini-USB cable. Arduino Nano has 2 more analog ports compared to Uno.

There is another modification of the Uno board - Arduino Mini. It is even smaller than Nano, and it is much more difficult to work with it. Firstly, the lack of a USB port creates a problem with the firmware, since for this you will have to use USB-Serial Converter. Secondly, this board is more picky in terms of power - it is necessary to provide an input voltage range of 7-9 V.

For the reasons described above, the Arduino Mini board is rarely used to operate a “smart home”. Usually it is used either in robotics, or in the implementation of ready-made projects.

View # 2 - Arduino Leonardo and Micro

The Arduino Leonardo board is similar to Uno, but a bit more powerful. Another interesting feature of this model is its definition when connected to a computer as a keyboard, mouse or joystick. Therefore, it is often used to create original gaming devices and simulations.

Dimensions and Weight Arduino Boards
A table of sizes and dimensions of the Uno, Leonardo models and their miniature analogues. The developers did not follow the logic in the names - “nano” should be the smallest

The main parameters of the Arduino Leonardo are as follows:

  • processor: ATMega32u4 (8 bit, 16 MHz);
  • number of digital ports: 20;
  • of which with PWM function: 7;
  • number of analog ports: 12;
  • flash memory: 32 KB;
  • SRAM: 2.5 KB;
  • EEPROM: 1 KB.

As you can see from the list of parameters, Leonardo has more ports, which allows loading this model with a large number of sensors.

Also for Leonardo there is a completely identical miniature analogue, called Micro. It lacks power from 12 V and instead of a full-fledged USB input, there is a chip for a mini-USB cable.

Modification of Leonardo called Esplora is a purely game model and does not fit the needs of a “smart home”.

View # 3 - Arduino 101, Arduino Zero and Arduino MKR1000

Sometimes for the operation of “smart home” systems implemented on the basis of Arduino, a large computing power is required, which 8-bit microcontrollers are not able to provide. Tasks such as voice or image recognition require a fast processor and a significant amount of RAM for such devices.

To solve these specific problems, powerful boards are used that operate according to the Arduino concept. The number of ports they have is about the same as that of Uno or Leonardo boards.

Arduino 101 Board
Arduino 101 has the same dimensions as Uno or Leonardo, but weighs almost twice as much. The reason for this is the presence of two USB inputs and additional chips.

One of the easiest to use, but powerful boards - Arduino 101 has the following characteristics:

  • processor: Intel Curie (32 bit, 32 MHz);
  • flash memory: 196 KB;
  • SRAM: 24 KB;
  • EEPROM: no.

Additionally, the board is equipped with BLE-functionality (Bluetooth Low Energy) with the ability to easily connect ready-made solutions, such as a heartbeat sensor, receiving weather information outside the window, sending text messages, etc. A gyroscope and an accelerometer are also integrated into the device, but they are used mainly in robotics.

Another similar board - Arduino Zero has the following indicators:

  • processor: SAM-D21 (32 bit, 48 MHz);
  • flash memory: 256 KB;
  • SRAM: 32 KB;
  • EEPROM: no.

A distinctive feature of this model is the presence of an integrated debugger (EDBG). Using it is much easier to search for errors when programming the board.

Debugging a program for Arduino
When writing voluminous code, even highly qualified programmers have errors. To find them use a debugger (debugger)

Arduino MKR1000 is another model suitable for powerful computing.It has a microprocessor and memory similar to Zero. Its main difference is the presence of an integrated Wi-Fi chip with 802.11 b / g / n protocol and a crypto chip with support for the SHA-256 algorithm to protect the transmitted data.

View # 4 - Mega family models

Sometimes it is necessary to use a large number of sensors and control a significant number of devices. For example, this is necessary for the automatic functioning of distributed air conditioning systems that maintain a certain temperature for individual zones.

For each local area, it is necessary to track the readings of two temperature sensors (the second is used as a control) and, in accordance with the algorithm, adjust the position of the damper, which determines the amount of warm air.

If there are more than 10 such zones in the cottage, then more than 30 ports are needed to control the entire system. Of course, you can use several Uno boards under the general control of one of them, but this creates additional switching difficulties. In this case, it is advisable to use models of the Mega family.

Arduino Mega Board
The size of the Mega family boards (101.5 x 53.4 cm) is larger than that of the previously reviewed models. This is a technical necessity - otherwise you cannot place so many ports

The Arduino Mega is based on a fairly simple 8-bit 16-MHz aTMega1280 microprocessor.

It has a large amount of memory:

  • flash memory: 128 KB;
  • SRAM: 8 KB;
  • EEPROM: 4 KB.

But its main advantage is the presence of many ports:

  • number of digital ports: 54;
  • of which with PWM function: 15;
  • number of analog ports: 16.

This board has two modern varieties:

  • Mega 2560 is based on the aTMega2560 microprocessor, featuring a large flash memory - 256 KB;
  • In addition to the aTMega2560 microprocessor, the Mega ADK is equipped with a USB interface with the ability to connect to devices based on the Android operating system.

The Arduino Mega ADK model has one feature. When connecting the phone to the USB input, the following situation is possible: if the phone needs charging, it will start to “pull” it out of the board. Therefore, there is an additional requirement for a source of electricity - it must provide a current strength of 1.5 amperes. When supplying batteries, this condition must be considered.

Arduino powered by battery pack
You can make autonomous power for Arduino with the help of connected batteries or batteries. By combining serial and parallel connection, you can achieve the desired voltage and long operating time

Due is another Arduino model that combines the power of a microprocessor and a large number of ports.

Its characteristics are as follows:

  • processor: Atmel SAM3X8E (32 bit, 84 MHz);
  • number of digital ports: 54;
  • of which with PWM function: 12;
  • number of analog ports: 14;
  • flash memory: 512 KB;
  • SRAM: 96 KB;
  • EEPROM: no.

The analog contacts of this board can work both in the usual 10-bit resolution for Arduino, which is done for compatibility with previous models, and in 12-bit resolution, which allows you to get a more accurate signal.

Features of the interaction of modules through ports

All modules that will be connected to the board have at least three outputs. Two of them are power wires, i.e. “Ground”, as well as a voltage of 5 or 3.3 V. The third wire is a logical one. It is transmitting data to the port. To connect the modules, use special wires grouped in 3 pieces, which are sometimes called jumpers.

Since Arduino models usually have only 1 port with voltage and 1-2 ports with ground, in order to connect several devices, you will either need to solder the wires or use breadboard boards.

Using a breadboard
You can connect not only the power and ports of the Arduino board to the breadboard, but also other elements, such as, for example, resistance, registers, etc.

Soldering is more reliable and is used in devices that are subject to physical impact, for example, control boards for robots and quadrocopters. For a smart home, it is better to use breadboards, as it is easier both during installation and when removing a module.

For some models (for example, Arduino Zero and MKR1000), the operating voltage is 3.3 V, so if a higher value is applied to the ports, then the board may be damaged. All power information is available in the technical documentation for the device.

Addition Cards (Shields)

To increase the capabilities of motherboards use shields (Shields) - expanding the functionality of additional devices. They are made for a specific form factor, which distinguishes them from modules that connect to ports. Shields are more expensive than modules, but working with them is easier. They are also equipped with ready-made libraries with code, which speeds up the development of their own control programs for the “smart home”.

Shields Proto and Sensor

These two standard shields do not bring any special features. They are used for a more compact and convenient connection of a large number of modules.

Proto Shield is an almost complete copy of the original in terms of ports, and in the middle of the module you can stick a breadboard. This makes assembly easier. Such add-ons exist for all full-length Arduino boards.

Motherboard and Proto Shield
Proto Shield is placed on top of the motherboard. This slightly increases the height of the structure, but saves a lot of space in the plane

But if there are a lot of devices (more than 10), then it is better to use more expensive Sensor Shield patch boards.

They do not have a bradboard, however, all the conclusions of the ports are individually supplied with power and ground. This allows you not to get confused in wires and jumpers.

Sensor Shield for Arduino Board
The surface area of ​​the motherboard and sensor boards are the same, but the chip does not have chips, capacitors, or other elements. Therefore, a lot of space is freed up for full connections

Also on this board there are pads for easy connection of several modules: Bluetoots, SD cards, RS232 (COM-port), radio and ultrasound.

Connecting auxiliary functionality

Shields with integrated functionality designed for solving complex, but typical tasks. If you need to implement original ideas, it is better to choose the right module.

Motor Shield. It is designed to control the speed and rotation of low-power engines. The original model is equipped with one L298 chip and can work simultaneously with two DC motors or with one servo drive. There is a compatible part from a third-party manufacturer, which has two L293D chips with the ability to control twice as many drives.

Relay Shield. A frequently used module with smart home systems. Board with four electromechanical relays, each of which allows the passage of current with a force of up to 5A. This is enough to automatically turn on and off kilowatt devices or lighting lines, designed for alternating current 220 V.

LCD shield. Allows you to display information on the built-in screen, which can be upgraded to a TFT device. This extension is often used to create weather stations with temperature readings in various residential premises, outbuildings, a garage, as well as temperature, humidity and wind speed on the street.

LCD board
Buttons are built into the LCD Shield that allow you to program the paging of information and the choice of actions for issuing commands to the microprocessor

Data Logging Shield. The main task of the module is to record data from sensors on a full-format SD card up to 32 Gb with support for the FAT32 file system. To record on a micro SD card, you need to purchase an adapter. This shield can be used as a repository of information, for example, when recording data from a DVR. Production of the American company Adafruit Industries.

SD-card shield. A simpler and cheaper version of the previous module. Such extensions are released by many manufacturers.

EtherNet Shield. The official module for connecting Arduino to the Internet without a computer. There is a micro SD card slot, which allows you to record and send data through a worldwide network.

Wi-Fi Shield. Allows you to wirelessly exchange information with support for encryption. Serves to connect to the Internet and devices that can be controlled via Wi-Fi.

GPRS Shield. This module, as a rule, is used to communicate “smart home” with the owner by mobile phone via SMS messages.

Smart Home Modules

Connecting modules from third-party manufacturers and the ability to work with them using the built-in programming language is the main advantage of the open Arduino system compared to “proprietary” solutions for “smart home”. The main thing is that the modules have a description of the received or transmitted signals.

Ways to get information

Information can be entered via digital or analog ports. It depends on the type of button or sensor that receives the information and transmits it to the board.

Analog and digital signal
For a computer program, a digital signal corresponds to periods from “0” and “1”, while the analog signal determines the range of values ​​in accordance with its dimension

The signal to the microprocessor can be sent by a person who uses two methods for this:

  • Pressing a button (keys). The logical wire in this case goes to the digital port, which receives the value “0” in the case of the released button and “1” in the case of pressing it.
  • Rotation of the cap of the rotary potentiometer (resistor) or shift lever slider. In this case, the logical wire goes to the analog port. The voltage passes through an analog-to-digital converter, after which the data goes to the microprocessor.

The buttons are used to start an event, for example, turning on and off the lights, heating or ventilation. Rotary knobs are used to change the intensity - increase or decrease the brightness of the light, the sound volume or the speed of rotation of the fan blades.

Rotary potentiometer with cap
The potentiometer is the simplest device, so it is very cheap. Its main characteristics are electrical resistance and rotation angle

Sensors are used to automatically determine the parameters of the environment or the origin of an event.

The following varieties are most in demand for the operation of a “smart home”:

  • Sound sensor. The digital versions of this device are used to trigger an event using a pop or voice. Analog models allow you to recognize and process sound.
  • Light sensor. These devices can operate both in the visible and in the infrared range. The latter can be used as a fire warning system.
  • Temperature sensor. For the house and the street they use different models, since the outdoor ones are better protected from moisture. There are also remote devices on the wire.
  • Humidity sensor. The DHT11 model is suitable for indoor use, and the more expensive DHT22 for outdoor use. Both devices can also give a temperature reading. Connect to a digital port.
  • Air pressure sensor. To work with Arduino boards, Bosh analog barometers have proven themselves: bmp180, bmp280. They also measure temperature. The bme280 model can be called a weather station, as it additionally gives out also a humidity value.
  • Motion and presence sensors. They are used for security purposes or to automatically turn on the light.
  • Rain sensor. Reacts to water entering its surface. It can also be used to trigger an alarm about leaks in the water or heating circuit.
  • Current sensor. They are used to detect broken electrical appliances (burned out lamps) or to analyze voltage to prevent overload.
  • Gas leakage sensor. It is used to detect and respond to increased concentrations of propane.
  • Carbon dioxide sensor. It is used to determine the concentration of carbon dioxide in living rooms and in special rooms such as wine cellars where fermentation takes place.

There are many different sensors for specific tasks, for example, to measure weight, water flow rate, distance, soil moisture, etc.

Wind speed meter
Some sensors, such as an anemometer designed to measure wind speed and direction, are complex electromechanical instruments

Many sensors and sensors can be made independently using simpler components. It will cost less.But, unlike the use of serial devices, you will have to spend time on calibration.

Instrument and system management

In addition to collecting and analyzing information, a “smart home” must respond to emerging events. The presence of advanced electronics on modern household appliances allows you to access them directly using Wi-Fi, GPRS or EtherNet. Usually, for Arduino systems they implement switching of a microprocessor and high-tech devices via Wi-Fi.

In order to use the Arduino to turn on the air conditioner at a high temperature in the house, block the TV and the Internet at night in the children's room or start the heating boiler at the arrival of the owners, three steps must be performed:

  1. Install the Wi-Fi module on the motherboard.
  2. Find unoccupied frequency channels to avoid systems conflict.
  3. Understand instrument commands and program actions (or use ready-made libraries).

In addition to “communication” with computerized devices, tasks often arise related to the performance of any mechanical actions. For example, you can connect a servo drive or a small gearbox to the board, which will be powered from it.

5 volt servomotor
The servo drive consists of a motor and several gearboxes. Therefore, despite the low current (5 V), it can develop a decent power, which is enough, for example, to open the window

If it is necessary to connect powerful devices operating from an external power source, use two options:

  1. Inclusion in a relay circuit.
  2. Connecting the power key and triac.

Electrical circuit electromagnetic or solid state relay closes and opens one of the wires on command from the microprocessor. Their main characteristic is the maximum permissible current (for example, 40 A), which can pass through this device.

As for connecting the power switch (mosfet) for direct current and triac for alternating current, they have a lower value of permissible current (5-15 A), but can smoothly increase the load. It is for this reason that PWM ports are provided on the boards. This property is used to control the brightness of lighting, fan speed, etc.

Using relays and power switches, you can fully automate all the electrical circuits of the house and start the generator in the absence of current. Therefore, on the basis of Arduino, it is realistically possible to independently provide an apartment or building, including all especially important functions - heating, water supply, drainage, ventilation and security system.

Do you want your home to be smarter, but with programming for “you”? In this case, we recommend that you look at ready-made solutions from Xiaomi and Apple, which are easy to install and configure even for a beginner. And you can even issue commands and control their execution even from your smartphone.

More about smart home from Xiaomi and Apple in the following articles:

Conclusions and useful video on the topic

An example of a self-assembled entry-level blank for a “smart home”:

The openness of the Arduino platform allows the use of components from various manufacturers. This makes it easy to design a “smart home” for user requests. Therefore, if there is at least insignificant knowledge in the field of programming and connecting electronic devices, it is worth paying attention to this system.

Are you familiar with the Arduino platform in practice and want to share your experience with newcomers to this business? Maybe you want to supplement the above material with useful recommendations or comments? Write your comments under this post.

If you have any questions about designing an automated house system based on Arduino, ask our experts and other visitors to the site in the block below.

Was the article helpful?
Thanks for your feedback!
No (5)
Thanks for your feedback!
Yes (31)

Pools

Pumps

Warming