Move the blinds up and down

Design principles

  • Control the blind motors
  • React immediately on the two buttons
  • The relais shall be connected in a fail-proof way: in series. The first relais switches the motor on or off, the second relais chooses which motor runs.
  • No need for interrupts and sleep mode (since we are mains powered and for simplicity). Hence we can also be repeater.
  • There are two mechanical buttons combined in 3 stable positions: up, down or idle. These are mounted on the wall next to the blinds.
  • No remote controlled movements while the buttons are in up or down state, only when idle.
  • If a motor runs, then after a timeout, the relais shall fall off. Measurement revealed that timeout of 20s was not sufficient to move the blinds completely up - so the timeout is set to 30s.
  • If a motor is running thanks to a remote command, changing one of the switch positions by hand shall stop the motor immediately for safety of operation (not yet implemented).
  • If a motor has been running and then stopped, you can not start it again unless a few seconds (4) later. This to prevent damaging the relais. This happened to me with the first implementation.
  • The software should protect the relais contacts from burning in or fusing by preventing to be switched on multiple times too short after each other.

Used components

Future extensions

  • Protect the relays against surges due to the inductive load with a varistor.
  • Protect the relays against surges due to the inductive load by prohibiting manual operation during a short period (1s?) after switching the motor off.
  • Measure current to be safe (not implemented yet)
  • AC current measurement can be done in software, since no accuracy is needed (not implemented yet)
  • Current sensor: CurrentSensor5A
  • If the buttons are pressed, the relais shall switch on and the motor runs. After a while, the motor current drops to zero, and the relais shall switch off (so that it does not keep drawing power). (not implemented yet)
  • If the motor current does not drop to zero after a timeout, the relais shall still fall off after the timeout.

Behaviour

BMStatechart.svg

States

State Constraints Description
idle   the motor is not running
button up after 30s: trigger timeout the motor is going up thanks to pressing a button
button down after 30s: trigger timeout the motor is going down thanks to pressing a button
wait after 4s: trigger toggleTimeout

delay to prevent damage to the relais

the motors should not be stopped and started too fast too many times - this burns out the relais contacts

remote up   the motor is going up thanks to a remote command
remote down   the motor is going down thanks to a remote command
up   the blinds are completely up
down   the blinds are completely down
unknown  

the motor is not running

we do not know what the position of the blinds is

Actions

Action Validations Effect Description
buttonPressedUp not state up   the up button is depressed
buttonPressedDown not state down   the down button is depressed
buttonReleasedUp     the up button is released
buttonReleasedDown     the down button is released
timeout     after a minute, we give up
remoteUp

not state up

no buttons pressed

  a command has been received from remote for up
remoteDown

not state down

no buttons pressed

  a command has been received from remote for down
interrupt    

while moving automatically, someone presses a button

this serves as an emergency stop

remoteStop    

while moving automatically, a remote STOP command is given

this serves as an emergency stop

toggleTimeout     after a few seconds, it is safe to start a next action

Wiring

BlindsModule_bb.png

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

safety.png

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/

Source Code

Based on https://www.mysensors.org/build/relay

Code at: blindsmodule

Programming

  • Board: Arduino Nano
  • Processor: ATmega328P (Old Bootloader)
Tags: domotica nodes
Comments: