Menu
Is free
registration
home  /  ON/ Homemade socket for a smart home. Smart socket

Homemade socket for a smart home. Smart socket

This project will allow you to independently assemble a "smart" socket, controlled from a computer. The basis of such a socket is the popular Arduino Uno board and a solid-state relay.



First of all, you need to assemble the following solid state relay circuit based on the MOC3041 optocoupler and some additional components. The MOC3041 is a simple, low cost optocoupler with LED and photodiode. Then connect the Arduino board to J1 of the assembled power switch. We use the D12 I / O line to control the relay. Input connectors J2 will be directly a 220 V high voltage socket alternating current, and the load, in this case a lamp, will be connected to the J3 connectors. Attention: be extremely careful when working with mains voltage! On contact with unprotected skin, it can cause irreparable injury, burns or even death!



Now connect the Arduino Uno board to your computer via USB port, copy the below code to Arduino IDE and upload it to Arduino. This sketch is pretty simple. It reads an ASCII-encoded character through the serial port and changes the logical state of the D12 line / When receiving "1", the D12 line goes into a high logical state (the relay closes), when "2" is low (the relay opens).


int drivePin = 12; // relay control output signal int incomingByte; void setup () (Serial.begin (9600); // start the serial port pinMode (drivePin, OUTPUT);) void loop () (if (Serial.available ()> 0) (incomingByte = Serial.read (); Serial .println (incomingByte);) if (incomingByte == 50) (digitalWrite (drivePin, LOW); // 50 is ASCII number 2 on the keyboard) else if (incomingByte == 49) (digitalWrite (drivePin, HIGH); // 49 in ASCII encoding is the number 1 on the keyboard))

Automatic reset


The Arduino Uno board is designed in such a way that the software has the option to reset this board when it is connected to a computer. One of the hardware flow control (DTR) lines on the ATmega8U2 is connected to the ATmega328 reset line through a 100nF capacitor. When a low logic level appears on this line, the microcircuit is reset. The software uses this feature so you can program your Arduino with a single click of a button in the Arduino IDE. But here there are some unpleasant moments for us - the board is reset every time it is connected programmatically to the computer. Fortunately, the Arduino Uno has a RESET-EN track that can be cut to disable auto-restart. To turn it back on, just solder it contact pads this track.


As an alternative to the hardware solution to the auto reset problem, you can use software solutions... For example, install the HTERM terminal or try Google's serial monitor Chrome Browser Serial Port Monitor.

Yes Yes Yes. One more. I understand everyone is tired of it. But I really wanted to do it myself, my own "smart" socket, with bingo and female students. Built-in (hidden wiring in the house). Controlled over WiFi (local) and Internet (global). With the receipt of the current status (in the future - with information on consumption). With the connection of several sockets in one block (up to four). With temperature, light and presence sensors. With a camcorder, after all!

The first part is just checking the overall performance of the circuit. In fact, it is a kind of analogue of WeMo Switch, only built into a standard socket box and therefore not tied to any specific design (in order to fit into any already existing interior).

So what do you want? I would like to independently control each of the four sockets (in my house, in one of the rooms, the sockets are combined into blocks of two two-socket modules close to each other, in two standard plastic sockets, respectively). All units (lighting, filter pump, heater, compressor) of the aquarium with a beautiful brocade catfish are connected to one of these blocks, so we will control them. Somik is like this, if anything (a picture to attract attention):

So what do we need?
1. Receive commands via WiFi and issue appropriate control signals to close contacts. Those. need a controller module with WiFi. Since I have our scarf on AR9331 (a piano in the bushes, yes: in fact, I originally wanted to try it out in real business), it will be such a controller.


2. Relay for 16A 220V. In order not to bother - I took a ready-made module from Amperka. At the same time, there is also an LED to indicate the operating mode of the socket.


3. Power these two modules with 5V. Disassembled the compact USB power supply.


4. A socket with a depth of 60mm.


5. Actually the outlet (for the time being I took the first one I found in a nearby hardware store for experiments):


6. LED to indicate the operating mode of the socket (On / Off). I found green and red in my nightstand. At first I wanted to use green (I like the color better), but it was not bright enough, so I ended up using red.

I figured out the scheme (primitive, yes):


Decomposed components:


Cut the wires, soldered:


I cut off pieces of heat-shrinkable tubes, insulated the modules:


I stuffed everything into a socket box, plugged in the cable, plugged it into an outlet. While it is still too early to shove into the wall, it is necessary to debug on the table.


To make the LED more visible, I made a small hole in the socket with a thin soldering iron tip.

The test bench is ready.

The software for the initial simple check was taken from the post uv. Ariman "a.

Well ... Surprisingly, everything works. The relay clicks, the LED blinks, electricity is supplied to the outlet. The first step has been taken. It took about an hour and a half in total. Money:
1. Controller on AR9331 - I don't even know how to evaluate. Let it be 750r - at this price we are going to sell it when we make the batch.
2. Relay module - 290r.
3. Power supply unit - well, let it be 200r (I saw it in the underground passage at such a price, mine has been lying around for a couple of years).
4. Power socket - 45 rubles.
5. Socket - 120r.

Total: 1405r.

Now we need to bring the software to mind (first of all, the firmware). About this - in the next part, if the people are interested. And then I will connect sensors and three more relay modules to control four sockets, not one.

P.S. I connected the camcorder - it works, where will it go? But it is necessary to somehow fit it into the interior, I have not yet figured out how ... And in terms of software - you need to learn how to broadcast a stream to the Internet, and not just to the local area.

Smart socket- what is it, and what is it for? Why bother with Wi-Fi in an outlet? How does everything connect and work? I decided to talk about all this in this short article. We will also try to find out whether it is worth buying a smart outlet, and what benefit it might have.

To begin with, Wi-Fi is now being crammed wherever possible: washing machines, TVs, kettles, multicooker, and even light bulbs. We have already got to the sockets. The very concept, like the Smart Socket device, appeared not so long ago. But now many manufacturers have released several models of such sockets. And these outlets are even sold a little.

Let's first find out what kind of device it is. I will explain in simple words.

- a device that plugs into a regular outlet (if it is a socket-plate, there are simply recessed ones), and other electrical appliances are already connected to it. As a simple adapter. The socket connects to your home Wi-Fi network. Across special application for a smartphone or tablet, you can control the outlet. From a distance turn it off and on (even via the Internet, far from home)... Turn on / off by timer, work statistics, and even view statistics of electricity consumption by a connected device (select models only)... The functionality depends on the manufacturer and model of the device.

I have experience in setting up and using only TP-Link smart plugs. This manufacturer has two models: HS100 and HS110. I have already written about them in more detail in separate articles:

There are also other manufacturers. For example, Xiaomi - Mi Smart socket... There is REDMOND SKYPLUG 100S. I'm not even talking about some Chinese, nameless models.

What tasks can you use a smart plug for?

To be honest, I don't use my outlet. I have an HS110, which is pictured above. I set it up, played for a couple of days and that's it. I never found a use for it.

But if you think about it, you can find many different options where you can use a wall outlet with Wi-Fi. For instance:

  • Turn off and on lighting. For example, in the children's room.
  • Before coming home, you can turn on the heater, or some other device.
  • Set up a schedule for a specific device.
  • When you go on vacation, you can turn on the lights remotely. As if you are at home.
  • And of course, connect the iron through a smart outlet and not think if you forgot to turn it off. Since you can always check it from your smartphone.

You can think of a lot of options. It is clear that each user will find their own application.

How do you feel about all these smart sockets, etc. For what purposes do you use, or would you like to use these devices? Write in the comments.

What is a Wi-Fi socket for? Its main purpose is to control electrical appliances that are in the house, from a distance. The device works by connecting it via a wireless Wi-Fi network with tablet or mobile smartphone... Smart electrical accessories are gaining more and more power in the electrical products market, so in this article we decided to talk about the principle of operation, device and function of a Wi-Fi socket.

Varieties and characteristics

Principle work wi-fi sockets of any type are exactly the same. As for the design, it is divided into two types: invoice and built-in. The invoice looks like an adapter with one connector. The design of the device consists of the following elements: the case itself, an indicator, a button with which the device and the wi-fi module are turned on or off. The second option is a plug-in. Its purpose is to replace an ordinary electrical point. The photo below shows both versions:

The principle of operation of two types is that, thanks to the microprocessor inside the device, a connection is made to the control mechanism that regulates the inclusion or shutdown. But more complex models may also come across, which are produced in the form of a surge protector, which has several connectors.

In addition, there are models that include additional sensors that can detect gas leaks, the presence of smoke or water leaks, as well as motion and temperature sensors.

Each wi-fi socket, depending on the manufacturer and model, has a special technical characteristics... Manufacturing companies are constantly striving to improve their development and regularly make their additions and innovations to it. The main differences are:

  • originality in the design of the device and its packaging;
  • the quality of the material used;
  • elements from which the product is made.

A Wi-fi socket of any model consists of a case, which is made of heat-resistant plastic, and various elements that fill this case. The use of non-flammable materials helps protect people from the release of harmful halogens. The heat resistance of the material is 748 degrees Celsius. Thanks to this, manufacturing companies guarantee the safety of using Wi-Fi equipment.

Main functions

The purpose and scope of the Wi-Fi socket is described in the following functions:

  • turning on and off household appliances at a distance;
  • thanks to the temperature sensor, the fire safety of the house is ensured;
  • it is possible to monitor and recognize the electricity readings that are consumed by electrical appliances powered by this device;
  • if necessary, you can reboot the equipment;
  • control of children due to the presence of a timer that turns off the TV or light after a certain time.

Terms of use

A Wi-fi socket, as a rule, operates in the operating voltage range of 100 - 240 V (meaning use in a home or office environment). The output power has its own range, which ranges from 2 to 4 kW. Thanks to this, it is possible to connect devices with large short-term loads. For example, a heater, electric kettle, or food processor.

Despite the fact that all manufacturers create their own individual instructions for using the device, the principle of operation and their purpose are almost the same. The only difference is additional customization certain parameters and functions that a wi-fi socket has.

First you need to install a special application on your smartphone or tablet. Then check if there is a connection to your home wireless internet... There is a QR code on the box or in the instructions for the fixture that you can use to access software to download.

After that, you need to find an option in the program that will search for a new Wi-Fi connection. Opposite the necessary wireless network a window will appear in which you should enter the password for connection. After confirming the password, the wi-fi socket is connected to a 220V network and turned on by pressing the on / off button. An LED indicator will indicate that the wi-fi socket is ready for further use.

After all the settings have been made and the required functions have been set, any household appliance and customize for it. How to do this correctly is indicated in the instructions. If there is a need to reset all settings to the factory settings, then just press the on / off button of the device for six seconds and the socket will return to its original position, in which it was released from production.

Advantages and disadvantages

The main advantage is that, thanks to such a smart device, you can control electrical appliances from a distance. Among the disadvantages are the following:

  1. If there is a power outage, then all settings are reset and must be set again.
  2. There are models that are incompatible with the router. To fix this, it is necessary to call the master, since only his experience and knowledge will help to correct the situation.
  3. The Wi-fi socket has its own time zone, which may not coincide with the real one. This is due to the fact that the device is set to the time zone that the manufacturer has. This leads to self-tuning of the system.
  4. If an emergency occurs in the electrical network, the devices are automatically turned off.
  5. It is possible to change the operation and functions of the device only if there is one wireless network. If they are different, then this will lead to negative results.
  6. If there is no Internet connection, then the device will not connect at the time specified in the settings. This is because all settings and changes are saved on servers that do not work without the Internet. And there is no special microchip that will include a memory block.

I really wanted to make my own "smart" socket, with bingo and female students. Built-in (hidden wiring in the house). Controlled over WiFi (local) and Internet (global). With the receipt of the current status (in the future - with information on consumption). With the connection of several sockets in one block (up to four). With temperature, light and presence sensors. With a camcorder, after all!

The first part is just checking the overall performance of the circuit. In fact, it is a kind of analogue of WeMo Switch, only built into a standard socket box and therefore not tied to any specific design (in order to fit into any already existing interior).

So what do you want? I would like to independently control each of the four sockets (in my house, in one of the rooms, the sockets are combined into blocks of two two-socket modules close to each other, in two standard plastic sockets, respectively). All units (lighting, filter pump, heater, compressor) of the aquarium with a beautiful brocade catfish are connected to one of these blocks, so we will control them. Somik in the photo above, if that (a picture to attract attention).

So what do we need?
1. Receive commands via WiFi and issue appropriate control signals to close contacts. Those. need a controller module with WiFi. Since I have our scarf on AR9331 (a piano in the bushes, yes: in fact, I originally wanted to try it out in real business), it will be such a controller.

2. Relay for 16A 220V. In order not to bother - I took a ready-made module from Amperka. At the same time, there is also an LED to indicate the operating mode of the socket.

3. Power these two modules with 5V. Disassembled the compact USB power supply.

4. A socket with a depth of 60mm.

5. Actually the outlet (for the time being I took the first one I found in a nearby hardware store for experiments):

6. LED to indicate the operating mode of the socket (On / Off). I found green and red in my nightstand. At first I wanted to use green (I like the color better), but it was not bright enough, so I ended up using red.

I figured out the scheme (primitive, yes):

Decomposed components:

Cut the wires, soldered:

I cut off pieces of heat-shrinkable tubes, insulated the modules:

I stuffed everything into a socket box, plugged in the cable, plugged it into an outlet. While it is still too early to shove into the wall, it is necessary to debug on the table.

To make the LED more visible, I made a small hole in the socket with a thin soldering iron tip.

The test bench is ready.

The software for the initial simple check was taken from the post uv. Ariman "a.

Well ... Surprisingly, everything works. The relay clicks, the LED blinks, electricity is supplied to the outlet. The first step has been taken. It took about an hour and a half in total. Money:
1. Controller on AR9331 - I don't even know how to evaluate. Let it be 750r - at this price we are going to sell it when we make the batch.
2. Relay module - 290r.
3. Power supply unit - well, let it be 200r (I saw it in the underground passage at such a price, mine has been lying around for a couple of years).
4. Power socket - 45 rubles.
5. Socket - 120r.

Total: 1405r.

Now we need to bring the software to mind (first of all, the firmware). About this - in the next part, if the people are interested. And then I will connect sensors and three more relay modules to control four sockets, not one.

P.S. I connected the camcorder - it works, where will it go? But it is necessary to somehow fit it into the interior, I have not yet figured out how ... And in terms of software - you need to learn how to broadcast a stream to the Internet, and not just to the local area.