Project: “Smart home on Arduino. Smart home based on the Arduino system - is it difficult to do it yourself Smart home arduino tablet

Life without the Internet, household appliances, smartphones is hard to imagine. Many rich people would add the Smart Home system to this list. In the article we will analyze what it is, how to install it and how to use it.

What is the system?

As it has already become clear, not everyone can purchase the Smart Home system. But if you have the necessary skills, you can create it yourself through a special application. Accordingly, we will further talk about the Smart Home system and try to create it for our living quarters.

What actually is this system? This is a set of sensors and controllers. They exist in various types, so they can respond to both movement and thermal energy. Such devices are able to control the work of the house: communications, security system, and so on. There are also more “reasonable” structures that can independently turn on heating, start various processes, and so on. Everyone wants to come home, where a hot bath, a heated dinner will be waiting for him. "Smart" home is the best solution for those who live alone. If there are no funds for such a system, then it can be done independently.

How do sensors work?

Sensors are able to read information and data, then process them and transmit the appropriate command. They are able to respond to temperature, sudden movements and sound.

The simplest and most affordable tracking sensors are often used on landings - everyone is familiar with the automatic switching on of lights. In addition, they are often used in fire safety systems. As soon as the temperature rises sharply, an alarm immediately goes off.

Before you start working with the system in your own building, you need to create a project that will correctly distribute the sensors and all possible controllers. It is important to note that for this you need to have skills in the field of programming and electronics. If there are none, then devices of a simple plan, that is, created for a novice consumer, should be preferred. These are the Arduino systems. The manufacturer supplies devices that are absolutely easy to install and operate.

Why Arduino?

This question is quite logical and understandable. It has already been written above that the company produces easy-to-understand systems, but this is not the only reason why you should choose Arduino. Kits for "Smart Home" can be purchased in the store or ordered on the website. It is allowed to carry out the installation on your own, but no one will refuse to provide a qualified master. He will do all the work without errors and will not neglect the beautiful design (for example, hide the wires, and not “dump” them for everyone to see). But most of the clients still decide to carry out all the work on their own. Why? It's much easier and cheaper. All the companies that produce such projects are great at winding up the price and verbally overestimate the quality of many models. The described company does not do this. Reviews on the Internet confirm this 100%.

The cost for components and installation of the Arduino system (Smart Home projects are very popular) is much cheaper than other manufacturers. Even the company itself offers to carry out the entire installation on its own, since in the event of a breakdown, the owner must understand the schemes and the project as a whole. Also, knowing the system thoroughly, you can easily and easily adjust it for yourself.

There are a lot of libraries on the Arduino platform, so finding the right program for yourself is not difficult.

Sets

Smart home kits are on sale. In them, the buyer can find all the necessary components for creating automated systems in his own home: motherboard and breadboard, electronic parts and rules for use. This set will teach a person to connect diodes correctly, turn on devices by clapping and control devices remotely.

"Dare" was created for children from 14 years old. The kit comes with instructions. Using the set, you can create five ready-made projects: a stopwatch, a night light, and so on.

The Arduino Starter Kit is the basic kit that all owners are advised to get started with. It comes with Arduino UNO board, sensors, shield, resistors and so on. It costs about 80 euros.

"Matryoshka" is intended for children from 10 years old. It is sold in several versions, which differ from each other in the number and type of parts, respectively, with the help of each of them, completely different experiments can be carried out. Made in Italy Arduino UNO Rev3 board shipped. With this set, you can make a night lamp, mixer, battery tester and so on.

"Amperka", as a rule, is purchased for educational institutions. It is made for children from 12 years old. At the end of the lesson, children will be able to create a robot that moves in a straight line. The controller comes with an Arduino Uno model.

Sets "Dare" ("Smart Home") on Arduino are currently the most popular.

Platforms

The standard platform is Arduino Uno. "Smart home" often works on its basis. It is the most common because it is inexpensive. Using it, you can easily control microcontroller equipment. If a person is not familiar with Arduino boards, then all owners advise him to start getting acquainted with this one.

Arduino Leonardo costs a little less than the above option. The fact is that, unlike Uno, it can be used as a USB device. For example, thanks to this board, you can control the mouse and keyboard.

Why is the "Smart Home" most often created on the Arduino Mega2560? It only looks slightly different from Uno, but has more functionality. It is often used to work simultaneously with a large number of devices. Accordingly, it is much easier to work with when it comes to large-scale projects. In general, if you plan to create a "Smart Home" , Arduino Mega is the most suitable option.

System Benefits

The Arduino company is in great demand among people who are poorly versed in programming. All provided systems have a clear interface. However, the benefits are not limited to this.

The manufacturer has provided the ability to create their own programs - the source code is open. The language used is as easy to learn as possible. If necessary, you can transfer programs using a USB cable. The Smart Home kits are quite interesting.

That is, if you know the programming language, you can purchase only one version of the software and adjust it as much as possible for yourself.

If additional utilities are needed, they can be downloaded for free from the official website. The system can be controlled from a computer and phone using the program.

Work principles

Sensors transmit information to a computer or phone using wireless data transmission technology. A special utility processes data - a command is executed. There is a main sensor (central), which can either be purchased or made independently. Arduino boards (Smart Home projects are developed on them) have standard connectors. Thanks to this, you can easily pick up all the accessories.

What is needed for assembly?

If there is a desire to assemble the project on your own, then you need to assemble some devices and take the devices. Which?

  • Sensors and controllers.
  • Internet module.
  • Twisted pair (cable).
  • Switch.
  • Resistor.
  • Wire for the Internet module.
  • Relay.

From accessories you will need a soldering iron, screwdrivers and so on.

Arduino kits must be purchased from trusted stores. Why? All the necessary devices are needed to work with electricity, which is why it is dangerous to use fakes. All necessary utilities can be downloaded from the Internet. Therefore, it is quite simple to create a “Smart Home” with your own hands based on Arduino.

Sensors need to be chosen based on your preferences: turning on or off the light, temperature control, and so on.

Installation process

You need to pay attention to the fact that the "Smart Home" should only have LED-type lamps. Ordinary options will not be able to withstand the stress - they will either burst or simply burn out.

After the Smart Home project on Arduino is ready, you need to start connecting controllers and sensors. They do this without deviating from the drawing and diagram that were created earlier. Contacts must be isolated.

All work can be presented in stages in the form of an algorithm:

  1. Installing the code.
  2. Setting up the application for a computer or phone.
  3. Port forwarding.
  4. Testing sensors and software.
  5. Troubleshooting, if any, during testing.

It is better to download software from a trusted archive source. After the latter is opened and all the utilities are installed, you should restart the application or reboot the device.

The Smart Home software on the Arduino will display the status of the sensors and information from them. If necessary, you can always change the network address, turn off the alarm.

Working with a router

You need to open a port on the router. What must be done to complete this action? Open the configuration menu, write the Arduino network address and enable the port.

Immediately after that, you can set the domain name. Now nothing prevents the owner from starting testing the system, which was created with his own hands.

Remote control

Thanks to the company's server, you can connect all the equipment with each other. It is allowed to use cloud services that allow you to visualize processes. Thanks to the Internet, you can fully control your home. You can turn on / off the boiler or heating, being on the other side of the city.

There is another way to help manage the house - SMS messages. It does not always happen that there is an Internet connection, so this method is quite relevant.

Results

You need to pay attention to the fact that the Arduino-based Smart Home cannot work with a public network address, otherwise it will be easy to hack. All buildings that operate on a "smart" system can help save energy for everyone, as well as use all resources correctly. The main thing is to correctly select all the components without any fakes.

It is also important that Arduino has many libraries that include thousands of program codes. That is why it will be more than easy to create a Smart Home system on Arduino using only the Internet.

Smart home is a special system that automates many processes in the house. For example, you can control heating systems, turn on lighting at certain points in time, monitor the situation, monitor the state of engineering communications, and so on.

There are many systems of this kind on the consumer market, which have a wide range of functions and support work with different devices and actuators. True, there is still the opportunity to independently create a smart home with your own hands based on Arduino.

The principle of operation of a smart home based on Arduino

The system on the Arduino platform works similarly to a regular factory one. It should include a controller with a processor that will process incoming signals and generate pulses to control external devices.

Light control scheme using "Smart Home"

The devices that generate input signals are various sensors that control certain parameters in the room. After processing these signals by the controller, according to the established algorithm, an executive signal will be generated, transmitted to external devices that control the inclusion of electricity, the operation of the heating system, the security system, etc.

A smart home created on Arduino is controlled via a Web interface, which will allow you to remotely control the operation of the system from any device connected to the Internet. It also supports Arduino GSM control by common mobile phones or smartphones.

What sensors and controllers can be connected and how they work

The basis of an Arduino-based smart home is a processor board, which is a microcontroller. It owns a processor that, with the help of created software, processes data from sensors and controls the operation of actuators.

In order to be able to connect various functional sensors to the controller, shields are used - expansion boards that are connected to the processor module, and the required number of sensors are already connected to the shields. The system of the controller, expansion boards and sensors can function both autonomously and in conjunction with a computer via wired or wireless communication.

Sensors and components of "Smart Home" based on Arduino

Through the shields, sensors of different functionality can be connected to the controller.

  1. Sensors that control the parameters and characteristics of the environment inside or outside the premises. It can be, humidity, pressure, light level, presence of precipitation.
  2. Sensors that control the spatial orientation of the object they are attached to. These include gyroscopes, compasses, accelerometers.
  3. Sensors that register the presence of moving objects. These include motion sensors, thermal sensors, ultrasonic sensors.
  4. Emergency control sensors. These include devices that allow you to control the integrity of engineering communications in the house. Sensors detect gas leaks, power outages, .

Many of these devices are included in the Arduino smart home kit, offered by manufacturers for those who are going to automate their home on their own.

Smart home building process

Creating a smart home based on Arduino is a bit like working with a Lego constructor. It provides for connecting the necessary sensors to the microprocessor controller, programming the created system and connecting it to control tools via the global Internet. Let's take a closer look at each of these processes.

Connecting all peripherals

The process of connecting all Arduino modules and sensors is very simple and even a person who is not very familiar with electronics will figure it out. It is a serial connection to the central controller of sensors and actuators, using expansion boards and connecting conductors for this.

Attaching the Smart Home Motion Sensor

In order not to get confused during the connection process, you must first draw up a detailed diagram of the future system and provide for the places where the controller, functional sensors and actuators will be placed in the house. The presence of such a plan will eliminate errors in the connection and incorrect operation of the smart home.

Programming and Debugging

To program a smart home on Arduino with your own hands, you need to know the C ++ programming language or use a special Arduino IDE shell. The first option is suitable for advanced users who know and can program in this language. The second option is suitable for those who are just taking their first steps in programming algorithms for devices created on the Arduino platform.

The Arduino IDE is a simplified version of C++. It has a built-in text editor, project manager, pre-processor, compiler, and tools needed to upload code to the Arduino microprocessor.

Versions of the Arduino IDE are available to users for different operating systems. It can be Windows, Mac OS X or Linux.

After the created code is uploaded to the microprocessor, you can debug the system and check how efficiently the interaction between sensors, controller and actuators works.

To ensure that the smart home system is always under control, there are various applications that can be installed on your smartphone. For example, you can download and configure the SmartHome.apk application. With it, you can receive data from the smart home controller at any time, as well as manage its functions.

Using this application will allow you to control the status of the security alarm, receive notifications from it when it is triggered. By setting the frequency of polling motion sensors, information about the current state of the room can be obtained in real time.

Internet connection

A DIY smart home built with Arduino can be configured and controlled via the internet. To do this, you must first configure a router that provides Internet distribution in the house.

Initially, you need to go to the router settings section and enter the IP address for the Arduino system in it. Then port 80 is opened.

If there is a need to assign a domain name to the address of the smart home system, you can use the capabilities of the https://www.noip.com service. After registering on this platform, you should use the “Add host” function and register the IP address of the created smart home system there. After that, access can be obtained both by IP address and by domain name.

Scheme for connecting "Smart Home" based on Arduino to the Internet

To control a smart home deployed on Arduino, it was possible from any place where there is Internet, you need to carry out a simple configuration of the browser used. To do this, in its address bar, type the following code "xxx.xxx.xxx.xxx/all".

Here, xxx.xxx.xxx.xxx means the IP address used by the smart home system. After this procedure, the user will be able to receive information from the created home automation system, as well as set the parameters for its operation.

Conclusion

Today, there are many ready-made Arduino smart home projects that can be found on the Internet. You can also create your own project, which will be the most suitable for a specific object. Systems built on Arduino have the advantage that they can always be upgraded and scaled.

For example, you can start with Arduino lighting control, and then add functional sensors that will control the movement in the room, monitor the leakage of water and gas. To simplify the procedure for creating an automated system in online stores, you can find many ready-made Arduino smart home kits. They provide a basic system configuration that you can later customize to suit your needs.

Video: Smart home on Arduino

If you briefly describe the principle of operation of Arduino, then everything is very simple. For example, when implementing the Smart Home project, this device works as follows. Throughout the house, sensors are placed in certain places that react to the external situation and transmit information to the microprocessor, which makes a decision.

The microprocessor can be connected to a computer, tablet, laptop, or smartphone. Programs for arduino can be easily downloaded from the Internet. Manufacturers perform all components, connectors as standard, for any connections. Let's take a closer look at how you can implement "Smart Home".

Designing "Smart Home"

Technique every year penetrates deeper and deeper into our lives. Without electronics, it is no longer possible to imagine everyday life, as technology makes it much more interesting and easier.

Any person who has at least basic knowledge of electrical engineering can independently make any device useful for the home. If your apartment or house has special sensors that read information, which also perform various functions, then this is a “smart home”.

In practice, not everything is as beautiful and magical as in science fiction films, where robots prepare morning breakfasts, wash clothes and clean the house. Real computers are still far from this level of development.

Smart home sensors can only perform the following functions:

  • Automatic control of household devices. The system itself connects and disconnects the kettle, TV, microwave and other devices.
  • Ensure fire safety. The system gives a signal to the owner about the occurrence of fire, the presence of smoke in the room. In more complex systems, not only the alarm is turned on, but the fire brigade and other necessary services are automatically called.
  • Weather control. The system monitors and gives a signal about changes in weather conditions on the street. It helps a person to plan his day properly.
  • Control of indoor climate conditions. The device works in conjunction with heating, ventilation and other climatic devices. Its principle of operation is to automatically increase or decrease temperature, humidity, etc., depending on the program settings.
  • Control of entry into the premises. The system is interconnected with motion sensors, and is able to automatically lock door locks, determine the exact number of people in the room.
  • Control of electrical energy consumption by automatically connecting and disconnecting lighting devices. In more complex versions of the systems, the lighting is turned off both from the control panel, and the automatic complete shutdown of the light, in the absence of the owner of the house.

There are not so many qualified specialists involved in the arrangement of such smart homes. Their services cost a lot of money. However, this work can be done independently. The whole system consists of sensors and controllers. For example, to control the temperature in a room, a sensor is installed that responds to a temperature drop below a programmed level. In this case, the microprocessor automatically turns on the heating devices. Similar sensors are located throughout the house, which perform various functions.

The control system is quite reliable and rarely fails. It contains an open source code, it is possible to connect to a computer. In the factory settings, the microprocessor contains several standard programs. However, the code of these programs can be easily modified, and even replaced with your own projects.

The operation of the arduino system

Sensors transmit information to a computer wirelessly. These data are processed using a special program. Next, a command is given to perform certain actions. The central board can be purchased or assembled by yourself. All connectors on the board are standardized, which makes it easy to assemble the system.

Required accessories

For self-assembly, you will need the following and accessories:

  • Screwdrivers.
  • Pliers.
  • Resistors.
  • Relay.
  • Sensors.
  • Communication module.
  • Arduino UNO.

It is better to buy kits for similar systems in certified stores, since the use of fake elements is very dangerous. The necessary programs for setting up the system can be easily found on the Internet.

Sensors must be purchased such that will correspond to the parameters they control.

Features of installing arduino

In a smart home system, it is advisable to use only energy-saving lamps, LEDs are best. The use of conventional lamps is not allowed, since the device is not designed for such a load.

After preparing the project and purchasing all the components, you can start connecting all the elements to the system. All connections are made strictly according to the scheme. All contacts and connections must be insulated.

  • Installing the program code.
  • Set up the program for your tablet or computer.
  • Setting up ports on the communication module.
  • Functionality check.
  • Correction of the program code (if necessary).

For the gadget you use, a special program is downloaded on the Internet, which is then installed. It is recommended to download from official sources in order to avoid crashes in the program. After installing the program, the computer or tablet is restarted.

The program should show information from sensors located in different rooms. If necessary, the program settings can be changed.

Setting up a router

You need to open a port on the communication module (router). This is done in the following way:

  • Open the properties of the router.
  • Specify the IP address of the device.
  • Open port 80.
  • Assign a domain name to the new address.
  • Test the operation of the entire system.

For such projects, it is inappropriate to use an open type of IP address, since such a system can be hacked by hackers via the Internet and disrupt the functioning of the system.

Such "smart home" systems can significantly save electrical energy. The main step is the correct choice of certified components, otherwise there is no guarantee of high-quality system operation. For arduino, there are a large number of ready-made program codes. This makes it easy to assemble such a system yourself.

To date, systems like "smart home" from an amazing exotic, available only to the wealthiest individuals, have become commonplace, which anyone can join. There are plenty to choose from: the release of such hardware and software systems has been mastered by many developers. Among the most famous is the Arduino company, whose products we will now get acquainted with.

What is a "smart home"

This term has a more understandable analogue - "home automation". The essence of such solutions is to ensure the automatic execution of various processes occurring in a home, office or specialized facilities. The simplest example is the automatic switching on of lighting at the moment when one of the tenants enters the room.

The Arduino smart home system is a set of equipment for controlling the operation of various devices using an Android mobile phone.

In any "smart home" system, the following components can be distinguished:

  1. touch part. This is a set of devices, the main part of which is represented by various sensors that allow the system to register events of a different nature. Examples are temperature and motion sensors. Other devices of the touch part are used to transmit user commands to the system. These are remote buttons and remote controls with receivers.

    One of the most commonly used smart home elements is a motion sensor.

  2. Executive part. These are devices that the system can control, thus reacting to an event in accordance with a user-defined scenario. First of all, these are relays, through which the smart home controller can supply power to any electrical device, that is, turn it on and off. For example, by clapping in the palm of your hand (the system will “hear” it with a microphone), you can configure the activation of the relay that supplies power to the fan. Please note: in this example, the fan can be anything. But you can also use a device specially released to work as part of a particular system. For example, the Arduino company produces electric motors for its systems, with the help of which, for example, you can close or open the window, and Xiaomi (a Chinese manufacturer of such systems) - air cleaner control devices. Such a device is fully controlled by the system, that is, it can not only turn it on, but also change the settings.

    An electric motor is an actuating device that is activated by a signal from the system controller and drives the mechanism connected to it.

  3. CPU. May also be called a controller. This is the "brain" of the system, which coordinates and coordinates the work of all its components.

    The processor (or controller) board controls the actuators based on the firmware and data received from the sensors

  4. Software. This is a set of instructions that the processor is guided by. In systems of some manufacturers, including those from Arduino, the user can write a program on his own, in others, ready-made solutions are used in which only typical scenarios are available to the user.

Modern systems "smart home" are divided into several varieties:

  1. Equipped with its own controller.
  2. Using in this capacity the processor of the user computer (tablet, smartphone).
  3. Processing information using a remote server owned by the developer company (cloud service).

The system can not only activate a particular device, but also inform the user about the event by sending a message to the phone or in some other way. Thus, alarm functions, including fire prevention, can be assigned to it.

Scenarios can be much more complex than we have described in the examples. For example, you can teach the system to turn on the boiler and transfer the hot water supply to it when the centralized supply is turned off, if the presence of one of the residents in the house is detected (infrared, ultrasonic sensors, as well as motion sensors help).

Getting to know Arduino

Arduino is an Italian company that designs and manufactures components and software for simple smart home systems aimed at non-specialists. It is noteworthy that this developer made the architecture of the systems he created completely open, which made it possible for third-party manufacturers to develop new and copy existing Arduino-compatible devices, as well as release software for them.

The Arduino Uno kit contains the necessary components to implement the devices described in the accompanying book.

This approach has ensured the high popularity of the systems of the Italian company, but it also has a drawback: due to the fact that, so to speak, all and sundry take on the production of components for Arduino systems, it is not always possible to purchase a quality product the first time. Often you have to deal with the problem of compatibility of components from different manufacturers.

A potential user should be aware that since 2008 there are two companies that make products under the Arduino brand. The first one, which started this direction, has an official website at www.arduino.cc; the second, newly formed one, at www.arduino.org. What was developed before the split is presented in the same way on both sites, but the range of new products is already different.

The software for Arduino smart home systems has the form of a software shell (called an IDE) in which you can write and compile programs. Distributed for free. Programs are written in C++.

The versions of the Arduino IDE program presented on these sites are also very different, although they have the same not only the name, but also the version numbers. Because of this, it is quite easy to get confused in them. The difference is that each software supports its own libraries and boards.

The "hardware" of the system consists of a board with a microcontroller (processor board) and expansion boards installed on it, which are commonly called shields. Connecting the shield to the processor board allows you to add new components to your smart home. The assembled system can be either completely autonomous or working in conjunction with a computer via a standard wired or wireless interface.


On the processor board, you can install special extensions (shields) that increase the functionality of the system

Benefits of the Arduino System

This hardware-software complex attracts the user with such advantages:

  • the possibility of autonomous operation, due to the presence of its own controller;
  • wide possibilities for setting up the system operation (the user himself writes a program in which scenarios of any complexity can be provided);
  • simplicity of the process of loading the program into the controller: a programmer is not required for this, it is enough to have a USB cable (the microcontroller has a Bootloader firmware);
  • affordable cost of components, due to the lack of monopoly rights for one or another manufacturer (the architecture is open).

If the Bootloader began to malfunction, or it was not in the purchased microcontroller, the user has the opportunity to flash it on his own. The IDE provides support for some of the most accessible and popular programmers for this purpose. In addition, almost all Arduino processor boards have a pin header that allows in-circuit programming.

The Arduino IDE program, presented on the arduino.cc website, has the ability to create custom hardware and software platforms, while the version of the program on arduino.org does not have such a function.

What solutions does Arduino offer?

Since many companies are involved in the production of Arduino-compatible sensors and devices, the range of these products is quite wide. Here is what is used most often:

  1. Sensors monitoring climatic parameters:
  2. Sensors that allow you to determine the spatial position of the object on which they are fixed:
  3. Sensors that allow you to register the presence of various objects:
  4. Emergency sensors:
  5. Other devices such as:
    • microphone;
    • clock;
    • door opening sensor;
    • remote controls (radio frequency and infrared) with receivers;
    • remote buttons.

Some of these devices are included in the basic Arduino Start kit, which some manufacturers call the StarterKit.


The Arduino system starter kit includes a processor board and some of the most commonly used devices.

The executive part contains a huge set of devices, for example:

  • electric motors;
  • relays and various switches;
  • dimmers (allow you to smoothly change the intensity of lighting);
  • door closers;
  • valves and 3-way valves with servomotors.

If you plan to connect lighting through the Arduino relay, then it is more correct to use LED lamps as lamps. Incandescent lamps, when connected through such relays, burn quickly.

Video: getting started with Arduino - controlling an LED via a web interface

Building a project on Arduino

We will show the process of creating and configuring an Arduino “smart home” using the example of a system that will include the following functions:

  • temperature monitoring outdoors and indoors;
  • window state tracking (open/closed);
  • monitoring weather conditions (clear/rainy);
  • generation of a sound signal when the motion sensor is triggered, if the alarm function is activated.

We will configure the system in such a way that the data can be viewed through a special application, as well as a web browser, that is, the user can do this from anywhere where there is Internet access.

Abbreviations used:

  1. "GND" - ground.
  2. "VCC" - food.
  3. "PIR" - motion sensor.

Necessary components for the manufacture of a smart home system

The Arduino smart home system will require the following:

  • Arduino microprocessor board;
  • Ethernet module ENC28J60;
  • two temperature sensors brand DS18B20;
  • microphone;
  • rain and snow sensor;
  • Motion Sensor;
  • reed switch;
  • relay;
  • resistor with a resistance of 4.7 kOhm;
  • twisted pair cable;
  • Ethernet cable.

All components cost approximately $90.


To make a system with the functions we need, we need a set of devices worth about $ 90.

Assembling a "smart home": step by step instructions

Here is the sequence to follow.

Connecting executive and sensor devices

We connect all the components according to the diagram.


Assembling the system basically comes down to connecting actuators to the corresponding contacts of the processor board

Program code development

The user writes the entire program in the Arduino IDE shell, for which the latter is equipped with a text editor, project manager, compiler, preprocessor and tools for uploading program code to the microprocessor of the Arduino board. IDE versions have been developed for Mac OS X, Windows and Linux operating systems. The programming language is C++ with some simplifications. User programs for Arduino are usually called sketches (sketch) or sketches, the IDE program saves them in files with the extension ".ino".

The main() function, which is mandatory in C++, is automatically created by the IDE shell, prescribing a number of standard actions in it. The user must write the setup() (performed once at startup) and loop() (performed in an infinite loop) functions. Both of these functions are mandatory for the Arduino.

You don't need to insert the header files of the standard libraries into the program - the IDE does this automatically. This does not apply to user libraries - they must be specified.

Adding libraries to the IDE's "Project Manager" is done in a somewhat unusual way. As source code written in C++, they are added to a special folder in the working directory of the IDE shell. After that, the names of these libraries will appear in the corresponding IDE menu. Those that the user marks will be included in the compilation list.

The IDE provides a minimum of settings, and there is no possibility to configure the compiler at all. Thus, a novice programmer is insured against mistakes.

Here is an example of the simplest program that makes the LED connected to the 13th output of the board blink every 2 seconds:

void setup() ( pinMode(13, OUTPUT); // Assign Arduino pin 13 as output)

void loop () ( digitalWrite (13, HIGH); // Turn on output 13, the digitalWrite function call parameter HIGH is a sign of a high logic level

delay(1000); // Delay loop for 1000ms - 1 second

digitalWrite(13, LOW); // Turn off pin 13, call parameter LOW - a sign of a low logic level

delay(1000); // Delay loop for 1 second)

However, at the moment, the user does not always have to personally write a program: a lot of ready-made libraries and sketches are posted on the network (take a look here: http://arduino.ru/Reference). There is also a ready-made program for the system considered in this example. It needs to be downloaded, unpacked and imported into the IDE. The text of the program is provided with comments explaining the principle of its operation.


All Arduino programs work on the same principle: the user sends a request to the processor, and it loads the necessary code on the screen of a computer or smartphone

When the user presses the "Refresh" button in the browser or the application installed on the smartphone, the Arduino microcontroller sends data to this client. From each of the pages designated as "/tempin", "/tempout", "/rain", "/window", "/alarm", program code comes in, which is displayed on the screen.

Installing the client application on a smartphone (for Android OS)

To receive data from the smart home system on the network, you can download a ready-made application.

Here is what the owner of the gadget needs to do:


With this application, you can not only receive information from the smart home system, but also manage it - turn the alarm on and off. If it is enabled, then when the motion sensor is triggered, a notification will be sent to the application. The application polls the Arduino system for triggering the motion sensor once a minute.

By activating the "Settings" icon, you can edit your IP address.

Configuring the browser to work with "smart home"

In the browser address bar, enter XXX.XXX.XXX.XXX/all, where "XXX.XXX.XXX.XXX" is your IP address. After that, it will be possible to receive data from the system and manage it.

The code presented here allows you to turn the light on and off through the browser, while this function is not implemented in the Android smartphone application.

Working with a router


Setting up an account on noip.com

This step is optional, but it is necessary if you want to assign a domain name to the address. To do this, you need to register on the site https://www.noip.com/, go to the "Add host" section and enter the system's IP address.


After registering on the site noip.com, access to the system can be obtained not only by IP address, but also by the fully qualified domain name

The creation of the project is completed, you can check the performance of the system.

Video: smart home on Arduino

Features of some Arduino hardware

Due to the fact that Arduino-compatible components are produced by many third-party companies, the quality of which Arduino itself has no control over, it is very likely that a user may purchase a component that does not work quite correctly.

A similar situation exists in the development of personal computers. At one time, IBM made the architecture of its computers open, as a result of which many companies began to produce IBM-compatible computers and individual components. As a result, “personal computers” of this type have spread widely around the world, however, the quality of components and the degree of their compatibility in many cases turned out to be not at the highest level. Apple has taken the opposite tack. It limited the circle of developers who had access to the architecture, and the same policy was carried out in the field of software development. As a result, Apple computers turned out to be less common and more expensive, but in terms of quality they are an order of magnitude superior to IBM-compatible devices running Windows.

With regard to some components for Arduino systems, users have noticed the following:

  1. The temperature sensor DHT11, supplied with the basic kit (StarterKit), gives a significant error of 2-3 degrees. Indoors, it is recommended to use the DHT22 temperature sensor, which gives more accurate readings, and for outdoor installations - DHT21, which can operate at low temperatures and is protected from mechanical damage.
  2. On some Arduino microprocessor boards, when the relays connected to them close, the COM port fails. Because of this, the sketch cannot be loaded onto the microcontroller: as soon as the pouring starts, the processor reboots. The relay clicks, the COM port is disabled, and the sketch loading process stops.
  3. The window / door closing sensor sometimes surprises in the form of false positives. With this in mind, the sketch is written in such a way that the system performs the necessary action only upon receiving several signals in a row.
  4. To set up process control using claps, some users, out of inexperience, order a sound detector with a manual threshold setting instead of a microphone. For such purposes, this component is not suitable, as it has a too small range: you have to clap no further than 10 cm from the detector. In addition, this sensor transmits signals in pulses of short duration, so that if there is a large sketch, which takes a relatively long time to process, the microcontroller simply does not have time to fix them.
  5. A smoke detector should be used for the fire alarm device, not a fire detector. The latter registers the flame no further than 30 cm from itself.
  6. In the event of a microcontroller malfunction or a code error, it is better to use normally closed relays with manual switches connected in series.

To avoid buying low-quality components, experienced users recommend that you first study reviews about them published on the Web. Inexpensive sensors can be purchased in several varieties to see for yourself which one works best.

Perhaps the Arduino smart home system is not the highest quality, but the widest choice of components and their affordable cost have definitely made it one of the most popular. Using our tips, you will quickly learn how to create Arduino projects by automating various household processes.

The history of creating a project for automated systems and robotics Arduino dates back to 2005. Then, at the Italian Institute, student Hernando Barragan created a platform with hardware and software, which later became the basis for this project. At the moment, the Arduino platform is enjoying incredible success. Now with its help, automated systems are created that are used at various stages of production.

Also, this board has been widely used in various variations of robotic systems and in smart home projects, where many additional sets of modules are used. The main advantage of such a project over other automation systems is its price. Due to the low price, any user who has basic programming skills and the necessary set of components can assemble an automated smart home system based on Arduino.

A variety of Arduino boards and their use in a smart home

Relevant at the moment are the versions of such sets of Arduino boards:

  • MICRO;
  • PRO MINI;
  • NANO.

as well as new items that will appear in the near future:

  • MEGA 2560;
  • ZERO;

In addition to the official manufacturer of Arduino boards, the processor giant Intel joined the creation of Arduino-like boards by releasing the Intel Galileo. Already, Intel has officially launched three boards under this program:

  • Intel Galileo;
  • Intel Galileo Gen 2;
  • Intel Edison.

In addition to boards, you can find dozens of different sets of modules that can be connected to Arduino to increase its functionality.

The most popular board is the Arduino Uno. This board is relatively inexpensive and is popular with both beginners and professionals. Using such a board, you can create basic automated smart home mechanisms. For example, with the help of Arduino Uno and additional sets of modules, you can automate such smart home processes that will allow you to:

  • Control the air conditioner through the application on Andoid or iOS;
  • Remotely control the power supply system in the house;
  • Remotely learn information about the temperature of the house;
  • Control the TV through the application on Andoid or iOS;
  • Manage the receiver
  • Control the lighting in the house;
  • Receive all information about devices connected to the smart home via the Internet;
  • Manage solar panels;
  • Control the temperature in the house.

This is only a small part of the possibilities of the Arduino project for a smart home, which anyone can assemble with their own hands. Now you can find companies implementing ready-made smart home solutions. But the cost of such solutions is very high. Therefore, such a smart home project is now very popular all over the world. In addition, the functionality of your smart home is limited only by your imagination and means. The smart home model with a set of additional modules is shown in the figure below.

Installing the Arduino IDE

The official website has its own IDE software shell, which is free and supported by all popular operating systems. Using the IDE, the user can create their own programs that can be loaded onto the Arduino printed circuit board. You can download the IDE on the official website by going to https://www.Arduino.cc/en/Main/Software. The current version of the Arduino IDE is 1.6.6. Let's take a closer look at the process of installing an IDE for the Windows platform. Once downloaded, run the installer and click the "I Agree" button.

In the next window, leave all the checkboxes and click the "Next" button.

Select the installation location of the IDE and click the "Install" button.

The installation process will begin.

After installing the IDE, it can be launched from a shortcut on the desktop, after which the program workspace will open for you:

Let's write a simple program and upload it to Arduino

The Arduino IDE uses a simplified C++ programming language that is understandable to beginner programmers. For example, let's write a program that will turn on the LED with an interval of 1.5 seconds. To do this, launch the IDE and paste the code below:

In the line "int ledPin = 13" we declare the variable digital ledPin and give it a value of 13. In the "setup" function, we set port 13 as outgoing. In the "loop" loop, use the "digitalWrite" statement to turn the LED on and off. And with the help of the “delay” operator, we make a delay of 1.5 seconds twice. As a result, the endless loop "loop" will turn off and on our LED for 1.5 seconds.

The connection diagram using a set of Arduino Uno board and LED for our program is shown in the figure below.

To upload a program to the Arduino Uno, you need to connect the board to your computer using a USB cable. Upon successful connection, the “ON” LED will light up and the “L” LED will flash.

After that, in the "Sketch" menu, click the download button.

After compiling and downloading the program, the LED on the device will start flashing.

Outcome

Starting to master Arduino, you can make a real smart home that will best suit your needs. We hope that our article will help you get to know such a project better. You can buy Arduino boards and sets of modules both from official suppliers, which can be found both on the official website and in many online stores.

Related videos