|
1 |
| -!> **This feature is not included in precompiled binaries.** |
| 1 | +!!! note "This feature is not included in precompiled binaries" |
2 | 2 | To use it you must [compile your build](Compile-your-build.md). Add the following to `user_config_override.h`:
|
3 | 3 | ```
|
4 | 4 | #ifndef USE_SHUTTER
|
@@ -406,3 +406,144 @@ MQT: stat/%topic%/POWER1 = OFF
|
406 | 406 | MQT: tele/%topic%/RESULT = {"Shutter1":{"Position":50,"direction":0}}
|
407 | 407 | CFG: Saved to flash at FA, Count 728, Bytes 4096
|
408 | 408 | ```
|
| 409 | +## Shutter with Stepper Motors |
| 410 | +Stepper motors can be used to operate shutters and blinds. The configuration is very similar to the Circuit Safe (Shuttermode 1) configuration. To operate a stepper motor requires driver module such as the A4988 and uses EN (enable), DIR (direction), STP (Stepper) for controls. If everything is defined correctly the shuttermode 3 will be reported at boot time. |
| 411 | +
|
| 412 | +Tasmota supports a maximum of four shutters with one stepper motor per shutter simultanously. In very rare conditions where two or more shutters simoultanously move the last mm it can happen than one shutter moves to far. |
| 413 | +
|
| 414 | +- Stepper drivers configuration tutorials: |
| 415 | + - [A4988](https://lastminuteengineers.com/a4988-stepper-motor-driver-arduino-tutorial/) |
| 416 | + - [DRV8825](https://lastminuteengineers.com/drv8825-stepper-motor-driver-arduino-tutorial/) |
| 417 | + - [TMC2208](https://wiki.fysetc.com/TMC2208/) |
| 418 | +- Modifying a 28BYJ-48 12V stepper motor from unipolar to bipolar [tutorial](https://coeleveld.com/wp-content/uploads/2016/10/Modifying-a-28BYJ-48-step-motor-from-unipolar-to-bipolar.pdf) |
| 419 | +- [Bill of Materials](#Bill-of-materials) |
| 420 | +
|
| 421 | +### Example configuration |
| 422 | +`EN` and `DIR` are on `Relay1i` and `Relay2` respectively. Please be aware to use the **inverse** relay for the enable signal. |
| 423 | +
|
| 424 | +The `STP` signal is assigned as a `PWM<x>` component where `<x>` matches the number of the shutter (e.g., `PWM1` for `Shutter1`). The shutter feature adjusts the PWM frequency to operate the motor for proper shutter operation. The stepper motor frequency setting is a global setting all PWM components on the device. This means that all shutters on the device will operate at the same speed. Therefore no PWM devices other than shutters can be connected to the same Tasmota device. |
| 425 | +
|
| 426 | +The frequency of the PWM can be changed from 1000Hz to any value up to 10,000Hz. The command `ShutterFrequency` globally changes this. Be aware that most 12V operated motors cannot work faster than 2,000Hz. 5,000Hz.10,000Hz is possible by increasing the supplied voltage to 24V and use `ShutterMotorDelay` to allow a slow speed up/speed down. The maximum voltage of the A4988 is 36V. The TMC2208 is much more silent than the others but also significant slower and does not like high frequencies. For example, the speed at 24V is half o A4988 |
| 427 | +
|
| 428 | +Finally a GPIO **must** be assigned as `Counter1`. This counter is used to keep track of the steps and send the stepper to the correct position. The `Counter1` GPIO must be connected to the `PWM1` GPIO. Otherwise the stepper and your shutter will run continually or freeze up randomly. |
| 429 | +
|
| 430 | +Only **bipolar** stepper motors may be used (see above). |
| 431 | +
|
| 432 | +You must properly configure the stepper motor driver (see above). |
| 433 | +
|
| 434 | +`ShutterOpenDuration` and `ShutterCloseDuration` can be different. Shutter with Stepper motors always match positions exact. There is no need to vary `ShutterOpenDuration` and `ShutterCloseDuration`. Anyhow, if you decrease `ShutterCloseDuration` the Shutter will close with a higher speed on a virtual higher `ShutterFrequency` if possible. Same vice versa. |
| 435 | +
|
| 436 | +You can define a soft start/stop by defining a `ShutterMotorDelay`. This causes the driver to ramp the speed up and down during the defined duration. The change of the `ShutterMotorDelay` does NOT change the distance the shutter makes. This is very convinent to trim the accelerate and decelerate rate without changeing the distance. |
| 437 | +
|
| 438 | +Wemos Pin|GPIO|Component|Stepper Signal |
| 439 | +:-:|:-:|:-:|:-: |
| 440 | +D1|5|Relay1i|EN |
| 441 | +D2|4|Relay2|DIR |
| 442 | +D3|0|PWM1|STP |
| 443 | +D4|2|Counter1|STP |
| 444 | +
|
| 445 | +**a) Set ShutterMode 3** |
| 446 | + `Backlog PulseTime1 0; PulseTime2 0` // for relay Relay1i and Relay2 |
| 447 | + `Interlock OFF` // this is a global variable for all Relays or at least the RELAYS NOT in the Interlock group |
| 448 | + PWM1 and COUNTER1 defined |
| 449 | +
|
| 450 | +**b) Enable Shutters** |
| 451 | + `SetOption80 1` // this is a global variable for all Shutters |
| 452 | +
|
| 453 | +**c) Configure Shutter 1 and test ShutterMode 1 is working** |
| 454 | + `ShutterRelay1 1` // for relay Relay1i and Relay2 |
| 455 | +
|
| 456 | +**d) Set the stepper motor speed (optional setting)** |
| 457 | + `ShutterFrequency 1500` // this is a global variable for all steppers (1000rpm by default) |
| 458 | +
|
| 459 | +**e) Set at least a small ramp-up/ramp down period 1.0 second (optional)** |
| 460 | + `ShutterMotorDelay1 1.0` // Stepper do not like infinite momentum. Ramp up/down speed allow much higher frequencies. |
| 461 | +
|
| 462 | +**f) Restart Tasmota** |
| 463 | + `Restart 1` |
| 464 | +
|
| 465 | +**g) Test the shutter** |
| 466 | + `ShutterOpen1` |
| 467 | + `ShutterStop1` // to stop the STEPPER1 |
| 468 | + `ShutterClose1` |
| 469 | + `ShutterInvert1` // to change the direction of rotation of the STEPPER1 |
| 470 | +
|
| 471 | +**h) Perform the [shutter calibration](Blinds-and-Shutters.md#calibration)** |
| 472 | +
|
| 473 | +### Configuration for additional shutters |
| 474 | +You must first set up the first shutter and only then the next. |
| 475 | +
|
| 476 | +Wemos Pin|GPIO|Component|Stepper Signal |
| 477 | +:-:|:-:|:-:|:-: |
| 478 | +D5|14|Relay3i|EN |
| 479 | +D6|12|Relay4|DIR |
| 480 | +D7|13|PWM2|STP |
| 481 | +D8|15|Counter2|STP |
| 482 | +
|
| 483 | +**a) Set ShutterMode 3** |
| 484 | + `Backlog PulseTime3 0; PulseTime4 0` // for relay Relay3i and Relay4 |
| 485 | + PWM2 and COUNTER2 defined |
| 486 | +
|
| 487 | +**c) Configure Shutter 2 and test ShutterMode 1 is working** |
| 488 | + `ShutterRelay2 3` // for relay Relay3i and Relay4 |
| 489 | +
|
| 490 | +**b) Restart Tasmota** |
| 491 | + `Restart 1` |
| 492 | +
|
| 493 | +**d) Test the shutter** |
| 494 | + `ShutterOpen2` |
| 495 | + `ShutterStop2` // to stop the STEPPER2 |
| 496 | + `ShutterClose2` |
| 497 | + `ShutterInvert2` // to change the direction of rotation of the STEPPER2 |
| 498 | + |
| 499 | +**e) Perform the [shutter calibration](Blinds-and-Shutters.md#calibration)** |
| 500 | +
|
| 501 | +
|
| 502 | +### Stepper Motor Wiring Diagrams |
| 503 | +#### One Shutter |
| 504 | + |
| 505 | +- Diagram v412: simple universal setup. For example, the control of horizontal curtain or vertical shutters, blinds adjuster or window opener, pet feeders, opening of a water tap for watering the lawn, rotating table for subject photography, opening the ventilation flap, PTZ camera, 3D Scanner Table, linear Actuator. |
| 506 | + |
| 507 | +- Diagram v414: parallel setup is to run two parallel steppers motors from the same controller. For example, to control a large and heavy hanging screen for an LCD projector, or two curtains at once on one large window. |
| 508 | + |
| 509 | +- Diagram v416: minimum setup size. For example, for small curtains located in a limited space. |
| 510 | + |
| 511 | +
|
| 512 | +#### 2 Shutters |
| 513 | + |
| 514 | +- Diagram v422: parallel setup is to run two shutters and independent control of two stepper motors from one controller. For example, to control two independent curtains. |
| 515 | + |
| 516 | +- Diagram v424: big parallel setup is to run two shutters and independent control of two pairs of stepper motors from one controller. For example, to control four curtains on one very large window. |
| 517 | + |
| 518 | +
|
| 519 | +#### Bill of Materials |
| 520 | +- ESP8266 Boards: |
| 521 | + - [Wemos D1 mini](https://www.aliexpress.com/item/32529101036.html) |
| 522 | + - [NodeMCU](https://www.aliexpress.com/item/32266751149.html) |
| 523 | + - [ESP-01S](https://www.aliexpress.com/item/32973088687.html) |
| 524 | +- Stepper motors (NEMA 17): |
| 525 | + - [Standard](https://www.aliexpress.com/item/32572890101.html) |
| 526 | + - [5:1 Planetary Gearbox](https://www.aliexpress.com/item/32586860419.html) |
| 527 | +- Stepper motors (28BYJ-48): |
| 528 | + - [Standard](https://www.aliexpress.com/item/32849028097.html) |
| 529 | +- Stepper Drivers: |
| 530 | + - [A4988](https://www.aliexpress.com/item/1609523735.html) |
| 531 | + - [DRV8825](https://www.aliexpress.com/item/1609523735.html) |
| 532 | + - [TMC 2208](https://www.aliexpress.com/item/32851067375.html) |
| 533 | +- Stepper Motor Control Development Boards: |
| 534 | + - [x1 board](https://aliexpress.com/item/32908836265.html) |
| 535 | + - [x2 board](https://aliexpress.com/item/32870732179.html) |
| 536 | +- DC-DC Step Down Power Supply Module: |
| 537 | + - [MP1584EN](https://www.aliexpress.com/item/33038302152.html) |
| 538 | + - [LM2596](https://www.aliexpress.com/item/32719726240.html) |
| 539 | + - [XL4015](https://www.aliexpress.com/item/1859072209.html) |
| 540 | +- Power Supplies (AC-DC): |
| 541 | + - [DC 12V 2.5A](https://www.aliexpress.com/item/32588476889.html) |
| 542 | + - [DC 12V 4A](https://www.aliexpress.com/item/32854720283.html) |
| 543 | + - [DC 24v 4A](https://www.aliexpress.com/item/32854269135.html) |
| 544 | +- Aluminum Capacitors: |
| 545 | + - [35V 100UF](https://www.aliexpress.com/item/32814611460.html) |
| 546 | + - [35V 10UF](https://www.aliexpress.com/item/32887486570.html) |
| 547 | +- Motor Testing PWM Signal Generator: |
| 548 | + - [1 type](https://www.aliexpress.com/item/32856654440.html) |
| 549 | + - [2 type](https://www.aliexpress.com/item/32818889845.html) |
0 commit comments