All about the repair and decoration of apartments

Do-it-yourself automatic curtains. Do-it-yourself electric drive for roller blinds and blinds test - piece Do-it-yourself automation for roller blinds

One day, after a hard day at work, I came home and realized that I wanted to relax, and not walk around and close the curtains. I would like to see them closed in the evening and open in the morning, while not dancing in front of the window. Googling different solutions, it was decided to do everything myself.

By popular demand, I post all my developments on converting ordinary roller blinds into automated ones with remote control. Beware, lots of photos!

Let's start with roller blinds:

  • Pros: roller blinds visually expand the space, beautiful and inexpensive. Very easy installation. You can manage each window separately. Frees up space on the windowsill.
  • Difficulties: manually opening 5 windows already takes a long time. The mechanism itself interferes with opening a completely corner window (example: the mechanism at the top of the balcony door rests against the wall and does not allow the passage to be opened completely). Because of this, it is necessary to hang curtains from the outside of the window. The price even for Chinese motorized curtains starts from 2000 rubles, we multiply by 5 and we immediately think how to do everything with improvised means.

A little about tasks:

It is necessary to add remote control to ordinary roller blinds from a hardware store and connect to a smart home on the openSource Home Assistant platform. And still it is necessary to keep the usual control of the rope.

Choice of motors:

If everything is automated, then the speed does not play a role, so you can use motors with a gearbox. Collector motors are cheap, but not the most reliable thing for daily use. Servo machines also have commutator motors and are not stable at constant rotation. Stepper motors look great. Silent, you can control the position, cost a penny. As a result, a set of 5 28BYJ-48 motors with a ULN2003 driver cost me $10

About the 28BYJ-48 engine:

There were questions about the power of this engine. Fears that he would be weak did not materialize. Or rather, if you use the full-step mode, then the engine is very frail, if you use the half-step mode, then the shaft cannot be stopped with your bare hands. To whom there will be little power, there are many articles on the Internet on how to raise the voltage, turn it into bipolar and other improvements.

About sensors:

Since we still have manual control, and we don’t want to drive the engine in vain, curtain position sensors are needed. A minimum of one sensor is required at one end, but two is better. You can use any terminal, optical, etc., but I personally chose the reed switch, because. gluing a neodymium magnet on the other side is very simple and should work stably and durable. I chose the reed switches themselves for aesthetics already in the case. Plus provided for setting the distance from the shaft. Height can be adjusted with spacers.

About the mount design:

The task was to design the case as simple as possible for manufacturing on a 3D printer with minimal modifications. Modeled in Fusion 360. The complete mount clings to the top of the window, but such a design on an FDM printer would be difficult to make with the required strength requirements, so a design with one screw for adjustment was invented.

In total, we got three parts for 3D printing. Link to download 3d models.

Main part for motor, control board on ULM2003, mounting for reed switches, motors, line to stabilize curtains, and adjusting screw.

A cover to cover all this disgrace. Clamp or otherwise hook.

The very design of the curtains contains several springs that work like a brake if you pull on the curtains (the spring tightens) or releases if you twist the rope.

When assembling, you need to do one refinement: break the rim that covers the rope with wire cutters, because. now we have our own fixed bezel, which prevents the rope from falling out.

Control:

The stepper motor will be controlled by NodeMCU on ESP8266. It was chosen because of its cheapness, the availability of a backup wi-fi channel, and it is quite easy to write the necessary scripts on it. If you need more than two curtains or additional sensors, then the legs of the microcontroller are no longer enough, you can look towards the ESP32. (esp32 is not shown in the photo, because it is in the junction box)

Software part:

The development environment can be any. The ESP32 can be programmed through the Arduino IDE. But I chose Visual Studio Code for myself because of the speed, modularity and free. In this environment, you can develop for almost any platform (not just hardware). You can even connect IAR ARM. (But that's a completely different topic)

The task of the program is simple:

Connect via WiFi
Connect to MQTT broker
Subscribe to a topic
Control the speed of two motors
Monitor the condition of the end sensors
Send broker current steps

Sources can be taken

Modern technologies are developing at a tremendous speed and are being introduced into all areas of our lives, including decorating rooms. Connoisseurs of practical solutions are increasingly choosing electric curtains for decorating houses and apartments. A wide variety of sliding curtains with a built-in panel and remote control is provided to customers to choose from. In the article, consider models of this type in more detail, and also compare the pros and cons of operation.

Introduction

Special control systems for curtains, with electric drives, decorate not only living spaces. They are also often installed in office buildings, restaurants, hotels, hotels and other establishments. The presence of this design significantly increases the level of comfort in the room. For the design of standard window openings, they are rarely used, however, in certain situations, the installation of this system is necessary.

The process of adjusting the canvases occurs automatically. The user can control the structure using the remote control or by setting a certain mode on the taskbar. You can change the position of the curtains in a matter of seconds, without approaching the eaves.

Where and when are they used?

Specialists from the field of interior design identify the following situations in which it is worth paying attention to electric curtains: If high windows are installed in the room, electric curtains will be more than appropriate. This is not only stylish, but also a convenient way to decorate an opening. Using the remote control, you can easily control the panels, without stairs and other similar structures.

Mechanized systems are ideally combined with panoramic or bay windows. As a rule, it is difficult to manually control curtains and curtains in this case. The electronic system will cope with this problem If there is a lot of furniture in the room and access to the windows is simply difficult, then electric curtains are a great option. There is no need to make your way to the windows every time to adjust the curtains or change their position. Pressing a button will be enough

designer style

In some cases, automatic control systems are used to create the desired design effect. This technique is ideal for high-tech style, which is the epitome of innovative technology and practicality. Also, these systems are an integral part of "smart" homes, where almost everything is automated and configured for remote control.

Varieties and characteristics

All curtains on the electric drive are divided into two classes, depending on the structural features of the eaves:

  • sliding curtains (horizontal);
  • lifting mechanisms (vertical).

The second group includes the following options:

  • rolled curtains;
  • Roman curtains;
  • pleated blinds.

A sliding type mechanism is placed on standard canvases that close horizontally (curtains, curtains, etc.).

This design is more complicated and includes the following components.

  • The first mandatory component is tires. This is a profile with grooves, the frequency of which directly depends on the row of eaves. For their manufacture, polymers, aluminum or stainless steel are used. If you choose tires for heavy curtains, it is recommended to opt for metal products. Plastic elements are suitable for curtains made of light fabrics.

Also, you can not do without a metal chain or a special belt. Fixing hooks and a limiter carriage are fixed on it.

  • Another mandatory component is the drive itself., which is also called a motor. It is installed in a separate housing, fixed to the side of the tire. The mechanism works in both directions, providing closing and opening of panels.

The structure of the remote control

The standard remote control used to control the electronic system has 4 buttons.

Each performs its specific function, namely:

  • closing or folding the canvases, depending on the type of cornice;
  • opening or deployment;
  • stopping the movement of curtains;
  • a separate button that allows you to remember the current placement of the curtains and use it in the future.

The appearance, dimensions and functionality of the remote control may vary depending on the manufacturer and design model.

Variety of automation

To automate the curtain control system as much as possible, you can equip it with additional elements, expanding the functionality.

The following sensors and mechanisms are used.

  • If the windows in the room are located on the sunny side, it is recommended to install a special device that reacts to the intensity of light. Depending on the illumination and the movement of the rays of the sun, the position of the canvases will change.
  • In the hot season, a sensor that reacts to temperature will be especially relevant. As soon as the room warms up to a certain point, the automatic closing of the windows starts. Also, this sensor is often used in regions with a hot climate.
  • The timer is very convenient to use, with which you can set the opening or closing of the canvas for a certain time.
  • Curtains-marquises, if they are installed outdoors in terraces or balconies, are equipped with precipitation sensors. As soon as it starts to rain, the screen closes.

Additional Information

All components, such as sensors and electronic actuators, are divided into groups, according to the type of power supply.

There are two types:

  • Wireless. Such devices work at the expense of accumulators or batteries of various types.
  • Wired. This type of device is connected to the mains.

Most buyers are inclined towards an autonomous solution, due to the fact that in the event of a power outage, the functionality of the structure is preserved.

Pros and cons of choosing

Before ordering this system, you must carefully weigh all the advantages and disadvantages of electric curtains. Based on customer reviews and model reviews, the following list of positives and negatives was compiled.

Advantages

  • Convenient remote control with a remote control. One click is enough to close or open the curtains. This feature is especially useful if the room has large windows with massive and long curtains.
  • Due to the fact that automation works carefully and carefully, the service life of the fabrics and materials from which the curtains were made is significantly extended.
  • This system can be correctly entered into almost any style of interior.
  • Convenient control at high ceilings and in hard-to-reach places.
  • Using the remote control, you can control all automatic structures of this type in the house.
  • The noise level during system operation is minimal.

Flaws

After getting acquainted with the advantages, it is necessary to note the disadvantages of curtains with automatic control.

  • The first thing that is noted as a minus is the high price, which not every consumer can afford. The cost of such structures is several times higher compared to the standard design of window openings.
  • For the system to work, an additional power line should be organized. Without proper knowledge and skills in this area, it is strongly recommended to use the services of specialists, and this is an additional expense. Also consider the cost of electricity and batteries, if necessary.
  • Installation of the system requires the participation of knowledgeable specialists. Here you can not do without special skills and tools.

After analyzing the above information, we can confidently state that the advantages of choosing are many times greater than the disadvantages. We can conclude that this is a practical, convenient and stylish design option for window openings in various styles. Installing such a system will help save personal time, which is important for the modern consumer.

Power output

The main problem faced by those wishing to install curtains on automation is the organization of a separate line. The power cable should be placed as close as possible to the location of the drive. Many users who decide to make a withdrawal on their own make a common mistake by placing the gasket on the other side.

Installation and configuration of the transformer is not required. Due to the low power consumption, the system will not reset the wiring. The power supply necessary for the operation of the system has the usual parameters: frequency - 50 Hertz, voltage - 220 Volts. Due to the low power of the automatic cornice, the line is often led to a conventional switch.

The idea was born a long time ago and matured for a long time. It all started with moving to another apartment, the windows of which face east. Nothing in the winter, but in the summer the arrogant sun rises when I just fell asleep or didn’t even go to bed yet. It shines brightly right in the eyes, says that I should not oversleep the summer. It is, of course, right, it’s not a matter of sleeping in the summer, but somehow it’s impossible not to sleep at all. From the sun, curtains have been invented for a very long time, and I even have them. Pretty dense. But not enough. Bright light pierces through them, not direct rays, but still bright. And most importantly, you must not forget to close them in the evening, open them during the day when you wake up. Someone makes a smart home at home, someone is crazy. Well, I have a lazy house, all in me. The owner should not bother himself with such hard work as moving the curtains as much as twice a day. Let the curtains open smoothly some time before the alarm (or even instead of it). The sun should wake my majesty, but not disturb his sleep, right?

Spoiler:

I began to think about how to automate this business. The first thought is obvious, a cable, an engine and hang it all on the curtains. While I was thinking about how to implement it, fix it, how to attach the end sensors, then this, while I was trying to overcome laziness and do it, three years had passed in total. But he didn't. And this is good. Because by that time another thought had crept into my mind. Instead of moving curtains that do not move easily and do not block light enough, it is better to use blinds. Well, when I got to googling about them, I found out about such a cool thing as roller blinds. Never encountered them before.


Roller blinds are the middle ground between blinds and curtains. A piece of fabric that, when not needed, is rolled up at the top. They are hung on each window separately. For opening - directly on the sash, you can open the curtains in any position. Of course there are different colors, patterns and light transmission. And, what I need, there are “blackout” options, that is, almost completely blocking the light. In the usual version, they are controlled by a hanging loop with a chain rope. There are different widths, but if necessary, you can cut it in place. Prices are also different, somewhere from 600 rubles (~$10). Here, for example, in . If you need simple, no frills, then it is quite acceptable, as it seems to me.

Bought, hung - excellent! It remains only to automate. There are no problems with the engine, the curtain is quite light, nothing powerful is needed. I decided to remove the manual cord control. Without it, the motor shaft can be rigidly connected to the reel. This simplifies the design. The case, in the presence of a 3D printer, turns from a problem into a design issue. But electronics ... There are many options for solving the problem. I’ll hide a detailed analysis of why I chose this one under the spoiler.

Options, thoughts, compromises

First we need to decide whether we want to control the curtains from a button, remote control, smartphone, or something else. Or all at once. And directly or integrate into some lazy house. If integrated, then how to connect, with wires, Wi-Fi, bluetooth, radio channel, or some other perversion. Here everyone has their own preferences. I chose Wi-Fi as a fairly versatile option. Producing wires is unnecessary. IR / radio remotes do not make sense, it is better to have one ring to rule them all, oh, that is, one smartphone for all home automation. Moreover, if you wish, redirecting commands from anywhere to Wi-Fi is quite simple. I have an IR receiver in my computer, I turn off the light and control the music with the TV remote control. It will be necessary (and if I find another unoccupied button) - it will also control the curtains from it.

Well, since Wi-Fi, then of course ESP8266. Modules built on this microcontroller are inexpensive and quite suitable for the task. I know about ESP32 (almost the same, but newer and also with bluetooth), but I haven't used it yet.

And here a compromise is brewing, which will have to be made. Pull power with wires. Because turning the motor a couple of times a day - a battery, for example 18650, will last for a long time. But continuously feed the ESP8266 - no.

According to quick estimates, the engine consumes around 220mAh, we take a 18650 battery for 2500mAh, we get 5 volts from it with a booster, 2500 * 3.6 / 5 * 80% = 1440mAh, which means you can twist it 1440/220 = ~ 6.5 hours. Raise or close takes about 2 minutes (depending on window height and speed). About 90-100 round trip cycles on a single charge. 3 months would be enough. And if you use 2 batteries, but with increased capacity - more than six months. Acceptable. But in addition to the engine, there is electronics.

The ESP8266 has several power saving modes for such cases. But if we want (and we do want) that the command to open and close the curtains can be sent at any time, then Wi-Fi cannot be turned off, and without this it will not save much. My experiments led nowhere, at least. The average consumption remained somewhere around 5-10mA, which is clearly a lot for autonomous power supply. Worse, my esp "shka periodically stopped saving energy, it was only necessary to ping it 10 times. Xs what a glitch, I didn’t understand. Well, even if I’m crooked, it can really squeeze out 2-3mA, it’s still not an option. Change batteries every a month (and this is still in a good case) is too much. Turning on Wi-Fi occasionally just to synchronize the schedule is not an option. You never know when you need to close the curtains, suddenly you want to watch a movie during the day, and the bright light of the sun interferes. So we pull the power with a wire. low-voltage, low currents, easy to lay between the frame and the sash, behind the window plinth, from the side of the balcony, or how to disguise it.But you did it once and forgot, and you don’t change the batteries every time. manual control by a wired button. I’ll think about this option for a summer residence. Either change Wi-Fi to BT, RF, IR or something else two-letter low-eating. By the way, fluent googling says what is on sale (even right here, from sellers these curtains) and battery drives with a remote control, who needs it. And I will farm as I please. With wires. Hide them really.

Another question arises, here we have 2-3 (well, I specifically have 2 each) windows (I mean separate glasses. Deaf, opening or a balcony door, in one window opening) in the room, we need the same number of curtains, engines too, how many brains? In general, of course, the computing power of the ESP is more than enough, we are not planning rocket science here. But, on the other hand, then in addition to power, you will need to lay wires to control the motors, for steppers it is 4 pins, if directly. The most common and cheap Chinese scarves on ESP also have a limited number of pins. And if you shove these handkerchiefs directly to the motors, one for each, then everything is simplified. So I decided that if a cannon and shells cost a penny, then you can shoot sparrows from it. A simple, modular, easily repairable, compact solution outweighs the match savings. The electronics of one drive will break, so the second will allow you to open the window and I will not die from lack of lighting (yes, I am that vegetable).

Usually, when making lazy automation, it is imperative to think over backup control options, since it will definitely break down someday. And if it does not break, then the light will be turned off. Or wi-fi hangs. I refused mechanical manual control, the chain at the window does not hang out. So if there are problems with food, we can’t do anything with the curtains. Okay, we'll survive somehow. You can power it from an uninterruptible power supply or make a 5 volt uninterruptible power supply. Another thing is if everything works, but Wi-Fi has dropped. There is a free pin on the board where you can stick a button to manually start the curtains. The drive is high, the button can be pulled down to hang out on a cord. But I didn't. My router is powered by UPS, it is not buggy, uptime for a year or more, it is rebooted only when updating the firmware and replacing batteries. And in the event of a house fire, as happened recently. The access cable channel was on fire, there was no light for a couple of hours, the uninterruptible power supply quickly gave up. But this is rare. In general, the button can be convenient for someone as another control channel.

Now let's get down to the details, in every sense.

Engine. Here the choice was clear for me. Widespread . The price is 1.5-3 bucks, depending on the quantity, the configuration of the driver board and the seller's greed. Sold on every corner of the Chinese Internet. There are 5 and 12 volts, I used the most common, five volts. It is a stepper motor (that is, it can be turned in small “steps” to the desired angle or the desired number of revolutions) combined with a gearbox. Due to this, with a very modest weight (~ 30 g) and dimensions (~ 3x3x2 cm), it develops good power, about 300 grams-force per centimeter. This is not much, but it is enough to wind the curtains. The reducer also provides effective braking of the shaft in the absence of power. You can scroll it by hand, but with a decent effort, more than a worker. So that the curtain does not unwind spontaneously when the power is turned off. Another plus is that it is very quiet. It is almost inaudible already a meter from the ear. When attached to a hard surface, vibrations during operation slightly increase the noise, it becomes slightly audible in a quiet room, but it is unlikely to wake anyone up. Me for sure. In general, as I understand it, they are often used to control the shutter of air conditioners. And she can move all night in swing mode (I don’t know how it is in Russian, in short, when she waves back and forth). The gearbox is plastic, but I don’t consider it a disadvantage here, the load is small, wear is unlikely to affect the “curtain” run, does it somehow live in the air conditioner? Someone generally made such mini 3D printers, and there is non-stop movement. The main thing is not to twist it too often by the shaft, this can easily kill him. It also has a fairly significant shaft play, both axial and radial. Pretty significant. But then again, in this application, this does not matter at all and does not matter. So he has, I think, only one minus, again a consequence of the gearbox, the motor is slow. 15-25 RPM, i.e. one revolution in 3-4 seconds. Slower is possible, faster is not. But the curtains are such a thing, there is no need to hurry, on the contrary, you need to raise them slowly and majestically. So it fits.

The motor can turn the curtains by a given number of revolutions. But it's all, in Einstein's way, relative. And we need, in Archimedean style, a fulcrum from which to count. If you have two such control points, top and bottom, then you can generally use a conventional engine and turn it “all the way”. But it is inconvenient to do this from below, but you can put a mikrik on top. (I saw an implementation on the Internet without limit switches at all, the curtain was trained when it was first turned on. But this is not my way, the position can be reset when the power is turned off, if you do not save it every time to flash memory, forcing it. The engine may skip for some reason steps. You never know.) The microswitch will be pressed by the fully raised curtain, and down we will unwind to the length specified during the setting. In fact, it would probably be even better to use a reed switch and a magnet at the bottom of the curtain. But I hadn't thought of that before. The comrade suggested to me when we discussed this topic in smart curtains from Xiaomi. I left the mics, but nothing prevents the use of reed switches, if desired. Mikrikas cost a little over a buck a bundle. Search for words micro limit switch, for example. We need the smallest, 13x6mm, preferably without a roller. Although the roller is always circumcised.

In terms of mechanics, the body and a couple of M3 screws are left to put together. We will draw the body, we will live to print. Ideally, the case should be made as compact as possible, for aesthetic reasons. And why waste extra plastic. So we make a board at the beginning, there is already a case on it.

Electronics.

So the heart ... although no, the brains, we will have an ESP8266. This microcontroller requires external memory, an antenna, and other small things that are difficult to solder at home. So we take the finished scarf. There are many different options, from very small to almost arduino-like. My choice is ESP-07. One of the most compact options, with a ceramic antenna. There is even a connector for an external antenna, but it is not needed within the apartment. ESP-12 is slightly larger due to the antenna "drawn" on the board. The price is 2 bucks, plus or minus how you bargain.

These brains cannot directly control the engine. Overstrained. I don’t remember how much exactly the ESP pin current is allowed, it seems to be 12 mA, but it needs to be around 200-300. You need transistors for amplification. The easiest way is to take a microchip with keys, ULN2003. At the same time, it has all the diodes necessary to control an inductive load. Often, boards with this microcircuit are sold as a kit for the motor. Only there it is in a DIP package, which is unnecessarily bulky. It is good to have such scarves for prototyping with wires, and put the ULN2003ADR in the SO-16 package into the finished product. It costs even in the retail Chip and Dip only 19 rubles, on Ali it is generally less than a dollar for a dozen.

The engine requires a power supply of 5 volts, the brain needs 3.3. So we put a microcircuit-stabilizer. Here the choice is huge. I took the most pop - AMS1117-3.3 in the SOT-223 package. The price is a dollar for a dozen, for $3 they will send a hundred at once. They are not suitable for powering ESP "shek from lithium, the voltage drop is about 1 volt, but powering from 5V is just right. I often use them for esp and STM32.

We also need resistors 0805 with a nominal value of 10KΩ, plus or minus. A triple of capacitors, also 0805, rated 1uF or more. Less desirable, can be buggy. And pins for connecting everything, so as not to solder tightly. The most common, single-row straight lines, step 2.54. Color to taste.

Powered by a 5 volt source. Current consumption up to 0.4A per curtain. An honest 1 ampere block should be enough for two curtains. If you do not raise them at the same time, then even 0.5A is probably enough. But it's better not to risk it. If possible, it is better to overclock the power supply to 6 volts, this compensates for the drop on the wires and keys of the motor driver. Especially for wide heavy curtains.

For the initial firmware, you will also need a USB-TTL adapter. Any. You can use any Arduino with a USB port as it. The adapter costs a penny, but you can also ask someone for a while, further firmware updates, if necessary, can already be done over the air.

Pay.

The circuit is simple, the connection is typical. I drew and then bred the board in DipTrace.

It turned out to be a little more difficult to separate the board. I wanted to make it as compact as possible, but without giving up 0805 small things, as the most common and comfortable enough for soldering. And the tracks are 0.4mm, it is quite acceptable for the manufacture of LUT. The payment is two-sided. It was possible to reduce the length by another millimeter or even two by throwing out the optional resistor R5 between DTR and GPIO0, but I thought about it too late.
You can also order boards in China. JLCPCB seems to still have a promotion with free shipping on the first order. Then 2 usd for a dozen (or even much more, if you file manually later). With delivery it’s already worse, it’s over the top ten. But you can look for options, there are many. I myself have never ordered, I get by with a photoresist.

Frame.

In the course of work, the case has come a long evolutionary path, starting with a simple bracket-bracket for the engine.

For some time I puzzled over how to fix the mikrik and how to press it. I tried options for attaching a fork to it, between the teeth of which I passed the curtain, so that the weighting agent at the bottom of the curtain pressed this fork when lifting. All this was unaesthetic and impractical. But in the end, a beautiful solution was found. You just need to slightly push the plastic weighting bar so that it rests against the drive housing. Make the lower wall of the case flexible, and hide the mikrik inside.

The extended tip of the plank can be closed with a vertical U-shaped profile glued to the window frame. Then the curtain will adhere to the glass even on tilting windows. For symmetry, the bar is cut in half and extended from both sides.

The case is designed for mounting in the base, which comes with the curtains. There is a rather rich choice of fastening methods, on the window over the edge, on adhesive tape, with screws. It's stupid to refuse. For other curtains, the size of the fastening bar may differ, the model will have to be edited. But it's not difficult, I drew in OpenSCAD, well, as I drew, everything is set by text there. So it should not be difficult to fix it, just change a few numbers. But right off the bat it can be difficult to figure out my shit code. To whom it will be necessary - I will prompt where and how.

We print. I am preparing a task for the printer in Slic3r "e. I try to adjust it so that it is printed only with perimeters, without filling. I set the number of upper and lower layers so that the bottom (when printing) wall is completely filled.

My settings are like this. Printing with a layer of 0.25 mm, the first layer is 0.3 mm, 3 perimeters (it is better to put more perimeters for the cover, 5-6), solid layers: 4 top, 4 bottom. I printed both ABS "ohm (it's a little difficult to print, it's better to print with a full-height protective perimeter) and PLA. But I settled on PETG, they are the easiest. It takes 17 grams to print the body, about 6 for the lid. Print time is 45- 50 minutes and 15 minutes, respectively.

After printing, it can be treated with sandpaper and thinner to get a glossy surface, but I'm too lazy, so I decided that [s] will not be visible from afar anyway.

We also print an adapter for the axle. It also needs to be adjusted to a specific curtain, if it has a different landing diameter. Mine is 15-16mm.

We solder.

I usually make boards with photoresist. For me it comes out a little longer than LUT, but a little better in quality and less marriage.

What is bad about making boards at home, jumpers will have to be soldered into the vias. On factory boards, the holes inside are coated with metal and this ensures contact between the sides of the board. Well, I make jumpers from a strand of stranded wire. I put the board on the anvil, insert the core, bite off a millimeter above the board and smack it with a hammer. It is better to raise the board a little before hitting it so that it rivets evenly from above and below. It turns out quite reliably, and if you also tin it later, it’s generally excellent. And nothing sticks out, you can make transitional ones right under the microcircuits.

We solder the details. Pay attention if you suddenly repeat. Resistor R5 - 300 Ohm (designation 301), not 10K (103), like the rest. Do not confuse. It is generally optional, you can solder the jumper. It is just in case, so as not to burn the DTR line when experimenting with the firmware. On the reverse side, there is also an optional resistor R7 (pictured above), do not solder anything there at all, this is for experiments with deep sleep only.

Some pins also act as interlayer jumpers. So you need to solder them on both sides. First, solder from below, then lift the plastic skirt and carefully, using not too much solder, solder from above. Ideally, the skirt sits almost in place, it has a slight indentation. I solder myself, do not pay attention. I'm generally a master of all crooked hands.

original firmware.

If you already have the Arduino IDE installed, then the easiest way is to flash from it. If you have not yet installed a package to support ESP8266, then you need to add it (Tools - Board - Boards manager, esp8266 by ESP8266 Community - Install, version 2.4.1, at the moment. In 2.3.0 I had glitches and brakes). Next, set the parameters.

In order not to install the Arduino IDE, you can use the free utility from Espressif, the developer of this chip. Download and run. In the settings we set everything as in the screenshot, in the first line we only select our path to the downloaded bin-firmware. In the address "0x0000" it is x, not ha, if that. And, importantly, choose the right memory size. For ESP07 usually 8Mb (=1Mb). For other boards, it may be 32 Mbits (=4 Mbytes). Otherwise, there will be an error with the firmware.

In both cases, you need to select the correct COM port for your usb-ttl adapter. You can see it in Device Manager in Windows. And the Linux people will figure it out themselves. You can set the port speed to any, but it's better to start with 115200, for reliability.

We connect as follows.
Board - USB-TTL
gnd - gnd
RX - TX
TX-RX
On the board, we connect DTR and GND (the one that is later used for the limit switch, it is still free). This is necessary so that when power is supplied to the esp8266 board, it switches to firmware mode. Then, for normal operation, DTR will need to be disabled, otherwise it will hang like that, waiting for the firmware.

And lastly, we supply 5 volts to the contacts in the corner of the board, gnd (minus) and VIN (plus). And don't confuse. Everything is ready, press start or upload. If everything works out the first time, we drop everything and run to buy lottery tickets. Otherwise, we check everything again, most often the problem is with the choice of a com port or mixed up RX-TX (you can try to swap them). We check the soldering, we pray to Cthulhu, we try again.

After a successful firmware, turn off the DTR and the adapter, only power remains. Turn off, turn on again. Consumption should be about 80 mA, this is so, for control (in flash mode or incorrect recording, consumption is usually less). We give the board 5 seconds to start and look at the available Wi-Fi networks. A new, password-free network should appear.

We connect and go to the address. You should see something that looks like an interface. We climb in and set up.

In the settings, you can select the Russian language if English does not suit you. I prefer English in technical things. But, I suspect, not everyone shares my tastes and, so that there would be no accusations of hatred of my native language (although at school I really didn’t like it very much and received triples), I decided to give the owner a choice.

I'm still finishing the firmware, at the moment version 0.02 beta still doesn't support a lot of things. For example, you cannot set a static IP, only a DHCP machine. First you need to come up with a network name and specify your Wi-Fi network. It is advisable to specify an NTP server to get the exact time. After the reboot, find out from the router what IP it gave to our drive. If desired, fix it so that it does not change. From a mobile phone, in theory, you can enter the browser by the name that was specified in the settings. It may not work with a computer, for example, in Win7 there is no mDNS client by default. You can put Bonjoure from Apple, or maybe it's already worth it if you are an apple fan. But this is a separate issue.

Further firmware updates are supported over the air. Both from the Arduino IDE directly (mDNS support is needed in the system), and by directly uploading the bin-file at http://IP/update (login-password admin:admin, so far it changes only in the firmware, then I can take it to the settings) .

In general, I want to say right away that the firmware is written in accordance with all security standards adopted in IoT (Internet of Things). Those. anyhow. However, if someone connected to this device, then he already knows the password for your wireless network, and he can do harm only by moving the curtains back and forth. Nevertheless, at least you should not give access to the curtains from the global network directly on the router. In the future, maybe I will add password access, although so far I don’t see the point in this.

Regarding writing the firmware, it would be unfair not to express gratitude to the comrade and his cat for their pro esp8266, which helped to deal with this chip. And for him for SonoffLED, from the source of which I learned a lot. So Alexey, thank you!

So, we launched, set up the network, you can put it together. We solder the wires to the mikrik, crimp the connector. Or take two wires with a connector and solder them. It is necessary to solder to the extreme conclusions, normally closed. If suddenly the limit switch falls off the board, it will be equivalent to a constantly pressed state, there is less chance of killing the engine.

We fasten the motor to the body. Insert a mic. For reliability, it is better to fix it with a drop of hot glue from the side of the contacts. We connect to the board and tamp it inside. I did not shorten the wires from the motor, of course, I was too lazy. Just rolled it up and stuffed it inside. He justified this by the fact that it would be easier to change it if it was suddenly needed. The board comes in snugly if sawn off correctly. Sharpen if necessary. No fastening required, sits securely. Power wires can be pushed into the slot above the mount, then they will not be visible. We snap the lid. Does not work. Seal the wires, try again. I managed. Time from the third. Serving option:

The power supply from Ali, used from some kind of technology, is pretty decent, as far as I can tell with my education (I graduated from refresher courses in reviews from kirich "a). 10 watts per 5 volts are declared, we don't have so much power I only slightly increased the output voltage, by half a volt somewhere, by changing the resistor. If necessary, we change the output capacitors to a higher voltage. The power supply unit will be installed on a glazed balcony, almost under the ceiling, but still stuffed it in an IP55 junction box, with a Schneider brand. I like them. Connecting wires on fakes for wago, but the currents are small, I generally have a C6 machine on the balcony line, if anything (I don’t want to provoke wago-srach in the comments).

We lay the power wires along the inside of the sash. We make a loop in the place where it turns so that it does not bend too much. And connect to the power supply.

Time to tune the motor. For a stepper motor, it is important in what sequence to turn on the windings. If connected incorrectly, it will spin in the opposite direction or even twitch like an exhausted epileptic. It seems like when I made a board and wrote software, I laid down a direct order. But, apparently, he messed up somewhere, as always. As a result, in the settings I made a choice of any connection option, so as not to bathe in the future. Suddenly, the Chinese on the engine connector will change the pinout. The A-B-D-C option suits me. We try different ones, press the Test buttons. We choose the direction forward or reverse, so that the "test up" winds up the curtain. You can experiment with speed. The default is 1500, which is microseconds per step. The lower the number, the higher the speed. It works for me somewhere up to 900, at 800 it already stops spinning. It's better to leave a spare. You can slow down even more, perhaps slightly reduce the noise from vibration, if somewhere the resonance appears at a certain speed.

After setting the motor, you need to adjust the length of the curtain. Raise it all the way up until the sensor is triggered, then lower it down to the desired length. You can use the test button, or you can set the curtain length value, gradually increasing it. Having learned the desired length, save.

Ready! You can open and close windows through the browser from any device. It works quietly, smoothly, slowly (the eye does not even immediately catch such a movement, that is, you do not jump from an unexpected sharp movement). I have full-length glass in my balcony door, the curtain does not reach the bottom about a foot, but there is not much light there, the balcony shields. You can build a curtain, I don't need it. So the total length of 1.70m passes in 2.5 minutes at a speed in the settings of 1500.

I didn’t do web layout for a long time, since then a lot has changed, for example, it turned out that tables are no longer typeset. And we still need to do something to make it look decent on mobile devices. It turned out so-so, but you can live.

Integration with something smart.

And here it will be short.
It is already possible to manage over the network with a simple HTTP request.
http://ip-address/open
http://ip-address/close
There is also a service link, it is convenient to use it with ajax
http://ip-address/test?up=1&reversed=0&pinout=2&delay=1500&steps=300
All parameters are optional, returns, after the operation is completed, the current position of the curtain.

Where to put these http links depends on which smart home system you use. I have my own, based on what I did at work for more serious things. But I am sure that you can screw it to anything without much effort. You can find examples on the Internet.

The MQTT protocol can be screwed. I will probably add it in the next firmware versions.

That's what I don't know yet how best to solve it - synchronization with an alarm clock. I did not find how to do this in AndroidAPI. So that I set the alarm for 14:00 in the morning, and the curtains received a command to open at 13:50. You can use an alternative alarm clock as an option.

If this particular part was of most interest to someone, I apologize. But the topic is too broad. Here and Tasker for Android with voice control, and Siri, and Domotics with Broadlinks and Mi devices. All this can be applied, but described in one review - no. I already spent more bytes of text than in the last three years.

Another variant.

Well, does anyone have a desire to repeat the same to themselves? If you want to repeat, but there is nothing to print the case on, there is no desire to poison the board, the soldering iron was borrowed by a familiar cryptanalyst, that is, I have a recipe for you from cubes.

We are looking in China for any debug board on esp8266, so that with soldered pins and a usb connector. There are all sorts of WeMos, NodeMCU and the like, to your taste and cheaper. It is not much more expensive than a bare esp07, in fact. Next, we connect this to the driver board that comes with the motor (sometimes it doesn’t, look for the right lots). We flash via a USB cable, as well as written earlier. Only the flash button is on the board or even works by itself. All is ready. 5 minutes, really. Here's how to then attach the motor specifically to your curtain - these are no longer my problems :)

The connection is simple. We connect 4 inputs on the driver board (IN1-IN4) to pins D1, D2, D6, D7 (they can be signed like esp, GPIO4, GPIO5, GPIO12, GPIO13). We connect strictly any way. Then in the settings we set it as it should. The plus and minus of the driver are connected to VIN (maybe marked as 5V) and gnd, respectively. Here already, if you mix it up, you can’t fix it in the software. All.

Plans.
To start, finish the firmware. This process is eternal, so I didn’t delay the review further. Plans to add MQTT, static IP, offline scheduling. Something else, I don't remember. Then there are thoughts for giving an autonomous power supply, where you can stupidly work according to the schedule of sunrise and sunset. Or by photo sensor. There is also an idea to adapt the development for the projector screen. A more powerful motor will be needed.

But I'm happy with the result. Hope it's useful to someone else. I probably forgot to write about many things. So I'll try to answer in the comments.

Boring video. I shot it on a mobile phone, the sharpness constantly floated away, but I can’t do better :(

UPDATE. Since the publication, the firmware has been significantly improved. Sources and binaries are still available on GitHube. Gradually finished off a separate one. Who really wants can buy ready-made blocks from me. Add to favorites Liked +240 +439

In this article I will talk about the design of the automatic curtain drive installed on my balcony. There we grow flowers that are harmful to direct sunlight. In addition, in summer, if the balcony windows are closed, in direct sunlight, the air on the balcony quickly overheats. However, when there is no direct light, it is advisable to open the curtains - the shadow also does not contribute to the growth of flowers. Therefore, in order to maintain acceptable illumination on the balcony, I automated the operation of the curtains.

Mechanics

Curtains were originally already on the balcony. There are two of them, both suspended on a metal cable stretched under the ceiling from one wall of the balcony to the other. It is clear that you need to move both curtains at once, while due to the friction of the curtains on the cable (it is quite rough), the required force must be large enough. In addition, sometimes there may be obstacles in the way of the curtain, for example, an ajar balcony window, which further increases the strength requirements.
Thus, the drive must be powerful enough and reliable - there is often high humidity on the balcony, a rather large temperature difference is possible in winter and summer. Therefore, I made the car window lifter drive the basis of the drive. It has sufficient power, is capable of delivering high torque (a worm gear is built into it) and is very reliable.

The diagram of the mechanical part of the drive is shown below:


More about the design. A plastic roller with a groove is fixed on the power window drive shaft (on the left in the diagram), on which a coil of rope is wound. The drive is fixed on one of the walls of the balcony. The same roller is attached to the opposite wall, through which the rope is also passed.
After that, the rope is stretched, so that the friction of the rope on the drive roller is enough to move the curtains. The opposite ends of each curtain are attached to a rope so that when the motor rotates, the curtain moves apart or moves.

To test the operation of the drive, I made a reduced model of it. I fixed the power window drive and the independent roller on the board, pulled a rope between them, after which it was possible to check the operation of the electronics and measure the force developed by the drive.

Photo of the drive itself on the layout:

As you can see from the photo, a fairly large thin plate is attached to the power window drive (I used textolite). A metal corner with two holes is attached to it, through which a rope is passed. It is needed so that the coil of rope on the roller does not get confused; for this, the holes in the corner are made at different heights relative to the plate.
To the right of the corner - limit switches needed to stop the curtains to the extreme positions. In order to indicate these positions, two plastic tubes are put on the rope (only one of them is visible in the photo next to the lower switch). The tubes are arranged so that when the curtain reaches the extreme position, one of them presses the switch, while for reliable pressing, a metal plate is attached next to each of the switches, which presses the tube to the switch.
Three metal posts attached to the plate are needed to secure the drive cover.
Both rope rollers are made from furniture wheels. Using a drill and a file, you need to make a groove in each of them, two turns of rope should fit in the groove of the drive roller. The drive roller is attached to the shaft by tension, while the hole in it had to be bored to a square, since the drive shaft is square.
The drive is attached to the balcony wall using suitable furniture corners (one of them is visible in the photo on the left). There are enough mounting holes in the power window drive, so there are no problems with fastening.

View of the drive already attached to the wall and closed with a lid:

In order to tension the rope, a special screw with a nut is used, to which the ends of the rope are attached:


Also attached to it is the end of one of the curtains.

Electronics

All my electronics is divided into two parts - power and control. The main task of the power section is to provide power to the drive motor. The power window drive can draw a very large current. To reduce this current, I reduced the drive supply voltage to 5 volts, but even with this, the maximum current consumed by the motor can reach 3A. To provide such a current, I used a power supply from a printer capable of delivering a voltage of about 30V and a current of up to 0.7A, as well as a DC-DC converter up to 5V. By lowering the voltage, DC-DC is quite capable of delivering the desired current.
The motor power supply is controlled by a powerful relay designed to reverse the signal polarity, and a MOSFET that controls the voltage supply to the motor. Through the use of MOSFET it is possible to control the speed of the motor, but at the moment this possibility is not used.
Also, stabilizers are installed on the power section, designed to power the control electronics and the motor power control circuit. Stabilizers are powered by a lower voltage power supply circuit, the voltage there does not exceed 12V.

The control electronics is represented by the STM8S microcontroller. The controller performs quite a lot of functions - measuring illumination, making a decision to start the drive, controlling the position of the curtains by the limit switch, controlling the power supply of the drive, controlling the drive in manual mode - by remote control commands. In addition, a radio module on the NRF24L01 and a 1-Wire bus, through which three temperature sensors are connected, are connected to the controller. Using the radio module, you can control the drive and read the temperature values ​​\u200b\u200bin different points of the balcony and on the street, however, at the moment the second radio module is connected only to the breadboard, so I will not consider this functionality further.

The used power supply from the printer has an input for transferring it to the Stand-by state. I also use it, which reduces the energy consumption of the structure. The program takes into account that the power supply switches to operating mode with a certain delay, and after 30 seconds of drive inactivity, the power supply switches back to Stand-by mode.

Indication of drive operation - with the help of a three-color LED (only blue and red diodes are used). Blue lights up when voltage is applied to the motor, red flashes periodically when there are errors in the drive. The number of flashes allows you to determine the error number.
For sound signaling of some events (for example, when a command is given to close already closed curtains), the drive motor itself is used. A PWM signal with a small duty cycle is applied to it, as a result of which the engine squeaks quite loudly.

A photoresistor attached to the window with a suction cup is used as a light sensor. Since the suction cup can fall off the window, there is a small button next to the photoresistor. While the suction cup is held on the window, the button is pressed against the window. If the suction cup falls off, the automatic operation of the drive stops and the red diode starts flashing. If the sensor is not connected to the connector, this is also detected by the controller.
Type of light sensor:

Since the illumination of the sensor can change dramatically - due to various flashes on the street, variable clouds, the data from the sensor has to be filtered. I have implemented the following processing algorithm: the data from the sensor is digitized at a frequency of 10 Hz and written to the array. Once a second, the value of this array is averaged (first of all, this is necessary to filter out noise and flashes). Further, the obtained values ​​are added to another array with a dimension of 600 elements, after reaching the end of the array, recording starts from its beginning. Also, this array is analyzed every second - the controller calculates what percentage of the array elements is less than a certain threshold (with increasing illumination, the voltage at the output of the photosensor drops). If the values ​​of more than 66% of the elements are less than the specified threshold, then it is considered that the illumination is high enough, and the curtains can be closed. Thus, periodic changes in illumination are filtered out. At the same time, a limitation is also imposed on the frequency of the drive - in automatic mode, the motor turns on no more than once every ten minutes.

As I mentioned above, it is possible to control the curtains from the remote control. Using the remote control, you can fully open and close the curtains, partially open them, start the drive according to the instantaneous value of illumination. When controlled from the remote control, there are no restrictions on the frequency of the drive.
It is also possible to programmatically restart the controller.
When moving the curtains, the controller monitors the state of the limit switches. If, after the start of the movement, the corresponding switch does not work within 20 seconds, the operation of the motor stops. In order to continue the operation of the drive after the fault has been eliminated, the controller must be reset.

All electronics are installed in a standard plastic case:


One of the switches is needed to transfer the electronics to automatic mode of operation, the second allows you to completely turn off the power to the motor.
With the help of Jack 3.5mm jacks, a light sensor, TSOP for receiving data from the remote control, and external thermal sensors are connected to the device.
The LED is covered with a white cap - so it can be seen from any angle.

View of the electronics unit assembled and installed in its place:

Drive operation video (remote control):

With the modern pace of life, you always want to return to a pleasant and comfortable home, which soothes with its warmth and comfort, giving new strength and energy. And, just from the interior decoration of the house depends on the appropriate mood and disposition for relaxation.

Windows in the room always occupy a special place in interior design. That is why it is necessary to pay maximum attention to the choice of textiles. In our article we will talk about the use of automatic curtains, their installation and photos.

Advantages of curtains

The decor of windows depends on the tastes and preferences of the owners of the houses, the general interior of the room. And, since our life is closely intertwined with new technologies, it has recently become very popular to use electronic curtains. They are designed for convenience and saving time and effort, which is very important in today's world.

Such curtains are well fenced off from the light and in a matter of seconds create the necessary atmosphere of privacy in the room. Moreover, such a device automatically controls the level of lighting in the room, which is important when the owners are away for a long time.


Automatic roller blinds

Among the variety of models of curtains, Roman and roll ones have become the most popular. Although vertical, pleated or horizontal bamboo curtains are well suited for room decor.

Electric roller blinds are becoming more and more popular. Their price depends on the material, size, installation complexity, drive and control.

The advantages of such curtains include the rapid darkening of the room or the creation of a comfortable twilight while sitting on the couch. Any windows are suitable for these models, as they are installed on all types of frames. But it would be more expedient to make out large openings or panoramic and bay windows to the floor.

For houses with high windows or a large number of them, for example, in offices, car dealerships, shops, clubs and private high-rise dwellings, the proposed option is simply irreplaceable.

There are two groups of curtains with automation:

  • for outdoor use (rafshtora and roller blinds on the facade of the building). They are installed on windows and doors in order to protect against unauthorized entry.
  • interior models that decorate windows inside the premises.


Electric curtain rods

Such cornices are regulated using remote controls or special switches. Their feature is the ability to repeat any form of walls. Automatic curtain rods are becoming more and more popular and may soon become a worthy replacement for conventional curtain rods. They have a wide range of benefits. For example, the presence of a timer makes it possible to control curtains at a set time.

Some cornices have a built-in light sensor to react to the bright sun, which allows, if necessary, to close the curtains automatically.

Another positive qualities of curtain control systems include the possibility of attaching textiles with any weight, size and structure; silent smooth operation, which is important during the night and rest; long service life with regular proper maintenance.

DIY automatic curtains

If you have the desire and the appropriate materials, you can easily and quickly make all the automation yourself.


First, install the electric drive for the eaves. It must be selected in such a way that it can withstand the weight and amount of fabric. The drive can be covered or left in plain sight - we choose any suitable place.

We organize control through a remote control or a button, for this you need wires. It is also appropriate to set a timer for ease of regulation.

When choosing a drive, you need to take into account its power and reliability due to temperature differences in cold and hot weather. An automotive power window drive is best suited.

We mount on a strong and thin textolite plate. For ease of use of the rope, we fix a corner with openings on the plate.

To the right of the corner we install limit switches. It is necessary to install a pair of plastic tubes on the rope at the point where they will press the switch when they reach the end position.

After that, we do the installation of the drive, putting on it a roller with a drilled groove for the turns of the rope. Then we install metal racks (3 pieces) on the board in order to mount the cover. The drive is fixed with furniture corners.

On the other side of the drive, you need to fix an independent roller, put a rope on it. The opposite ends of the curtains are connected so that they open and close with the help of a motor.


After this, you need to connect the power supply using the power supply to the drive motor. The regulation is done with a relay. It is necessary to install stabilizers to check the power supply of the regulated part of the electronics.

The display of the drive operation is set using red and green LEDs. In the event of an error, the red light starts blinking, and if voltage is applied to the engine, the green light will turn on.

The entire electronic structure is placed in a plastic container with openings for switches and LEDs. The function of the first switch is to convert to automatic mode, the second switch is to turn off the power. For the LED, you need to pick up a white cap, this will increase its visibility from anywhere in the room.

Photo of automatic curtains

Similar posts