Design principles
- There are 2 curtains, each controlled by their own motor: the outer one is a vitrage (lace/net curtain).
- Control the curtains motors
- React immediately on the two buttons
- No need for interrupts and sleep mode (since we are mains powered and for simplicity). Hence we can also be repeater.
- There are RJ11(??) connections for two mechanical buttons combined in 3 stable positions: up, down or idle. The module can be mounted hidden on the wall behind the curtains.
- The buttons can be configured for impulse (so, the relais only give a puls of 1s), or for switch (the motor moves as long the switch is actuated, and stops when released).
- The Dooya motors do not provide a means to know what the state of the curtain is. Still, if only remotely operated, we do know.
Used components
- PowerSupply_HLK-PM01
- ArduinoNano5V
- RelayModule2Channel
- NRF24L01Plus
- AdapterBoardForNRF24L01
- Two Dooya DT82TN motor with RJ11/RJ14 style connector with 4 wires for "dry contacts".
Future extensions
- Local buttons to control the movement.
Behaviour
There are two statecharts like the one below: one for the vitrage, and one for the curtain.
States
State | Constraints | Description |
---|---|---|
idle | the motor is not running | |
opening | the motor is opening thanks to a remote command | |
closing | the motor is closing thanks to a remote command | |
open | the curtain is completely open | |
closed | the curtain is completely closed | |
unknown | the motor is not running we do not know what the position of the curtain is |
Actions
Action | Validations | Effect | Description |
---|---|---|---|
timeout | after a minute, we presume the motor reached the target | ||
remoteOpen | not state Open | a command has been received from remote for open | |
remoteClose | not state Closed | a command has been received from remote for close |
Wiring
MISO = M1 MOSI = M0
Component | Pin | Wire | Pin | Component |
---|---|---|---|---|
NRF24L01+ Adapter | VCC | red | 5V | PowerSupply HLK-PM01 |
NRF24L01+ Adapter | GND | black | GND | PowerSupply HLK-PM01 |
NRF24L01+ Adapter | CE | white | D9 | ArduinoNano5V |
NRF24L01+ Adapter | CSN | orange | D10 | ArduinoNano5V |
NRF24L01+ Adapter | SCK | grey | D13 | ArduinoNano5V |
NRF24L01+ Adapter | M0 (MOSI) | yellow | D11 | ArduinoNano5V |
NRF24L01+ Adapter | M1 (MISO) | purple | D12 | ArduinoNano5V |
ArduinoNano5V | 5V | red | 5V | PowerSupply HLK-PM01 |
ArduinoNano5V | GND | black | GND | PowerSupply HLK-PM01 |
RelayModule2Channel | 5V | red | 5V | PowerSupply HLK-PM01 |
RelayModule2Channel | GND | black | GND | PowerSupply HLK-PM01 |
RelayModule2Channel | In1 | green | D7 | ArduinoNano5V |
RelayModule2Channel | In2 | blue | D8 | ArduinoNano5V |
Button 1 | orange | D2 | ArduinoNano5V | |
Button 2 | purple | D3 | ArduinoNano5V |
Safety
Protection with inductive load
It is advised to use a Varistor over the contacts of the relay.
See https://www.ia.omron.com/support/faq/answer/36/faq02804/
Programming
- Board: Arduino Nano
- Processor: ATmega328P (Old Bootloader)
Comments: