Skip to content

Control the room technic like window closer/opener, blind raiser/lower by a web application

Notifications You must be signed in to change notification settings

lion1109/room_control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RoomTech

This software is controlling 16 motors. 8 are used to open/close windows and 8 are used to raise and lower the window blinds. The neutral position is a closed not blinded window.

Hardware

Window opener/closer and blind raise/lower motors

Each window has two AC motors whith three cables, the neutral conductor (N) and two phase conductors (P0,P1), one for each direction to drive.

The P0 phase conductor is used to close the window or raise the blind. The P1 phase conductor is used to open the window or lower the blind. P0 and P1 may not be given simultaniously!

Relays

Two relays are used to control a motor. The first relay switches the current on and off. The second relay switches the current to P0 or P1. The neutral position of the relays are: Relay 0 no voltage to the motor, relay 1 voltage switched to P0. The following table shows the combinations of the relays to control the motor:

relay 0relay 1 P0 P1 action
off off 0V 0V stop
off on 0V 0V stop
on off 230V 0V close/raise
on on 0V 230Vopen/lower

The relay boards are powerd by 12V and controlled by 5 volt IO pins. The IO connector offers GND, 5V VCC and IO input pins.

The GND pins of all relay boards, shift register logic may be connected and Raspberry pi can be connected. The 5V VCC of one relay board can be used to power the shift register logic and the Raspberry pi.

It has to be checked if the 5V VCC pins of all relay boards may be connected. (CHECK !!!)

Source: https://www.az-delivery.de/products/16-relais-modul?_pos=2&_sid=c065e0f4f&_ss=r

[Jakob]

Shift Register as relay controler

8 relays are controlled by a 8 bit shift register (74HC595). So each shift register can control 2 windows, each with 2 on/off relays and 2 direction relays:

bitfunction
0 window 1, opener/closer on/off
1 window 1, opener/closer open/close
2 window 1, blind on/off
3 window 1, blind lower/raise
4 window 2, opener/closer on/off
5 window 2, opener/closer open/close
6 window 2, blind on/off
7 window 2, blind lower/raise

The shift register is controled by 3 output data pins (DS,ST_CP,SH_CP) of a Rasperry Pi GPIO. The DS pin is the new data to shift into the register. When the SH_CP (Serial shift clock) pin level is rising, serial data input register will do a shift. The ST_CP pin is the parallel update output. The rising edge updates the data output by the shift register state.

The shift registers can be powered by 2~6 volt. For this project we use the 5V VCC pin of a relay board IO connector.

[Jakob]

Microcomputer as controler and UserInterface

A Raspberry Pi microcomputer is used to control the motor controller relay shift registers by the GPIO

[Jakob]

Light dimmer hardware

First idea: Arduino PWM controlled dimmer1 or dimmer2.

Alternate Hardware: sonoff.

Hardware Explained: video1 and here.

But the lights may have a fallback dimmer.

[Jakob]

Arduino Software and serial interface to the UI [Eduard]

Touchscreen as UserInterface device

A Touchscreen device and a Chromium browser in kiosk mode can be used as user interface Infos about kiosk or here.

Software

The software is a motor position controler running the full time. Offering a https interface. And a web application.

Position controler

The position controler offers a set of commands to request and set the motor positions by https requests

  • Motor parameter are stored in a configuration file.
  • There is no motor position encoder, so the controler has to determine the position by the motor speed, runtime and direction.
  • To determine the current position on initialization the controler can read it from a file or it does a initialization run by driving the motor to an end position.
  • Threaded Python Application
    • Webserver => The Webserver thread reads and writes into the Motor controler by mutex protected methods
      • Session handling and login
      • File requests
      • Controler requests
      • Pushed Events
    • Motor controler => The Motor controler
    • Timer events => The Timer events callbacks the motor controler if a position is reached.

Web Application

The UI-Web interface is realized by an interactive sgv.

Web API

The Web API consists of a collection of URIs to handle the communication between the browser svg application and the room_control server. The Returned document can be a file (svg,favicon,font,htmlpage,image,...) or a json data object

URIResult
/alternate for: /index.html
/index.htmltype: html
path: web/index.html
/ui-0.svgtype: svg
path: web/ui-0.svg
/request/config.jsontype: json
parameters: none
result: all configuration parameters of the room
/request/window.jsontype: json
parameters:
* id: string, window id e.g. 'R1'
* action: int 0 = none, 1 = button press on 'close', ...
/request/sr-state.jsontype: json
parameters: none
result: the shift register state

Installation

  • Install a Raspberry Pi
  • Create a user eg. 'feg'
  • Instal packages: git python3 python3-yaml
  • Grant git access to user
  • Get Code: git clone [email protected]:lion1109/room_control.git
  • Insert '127.0.0.1 room.local' into /etc/hosts
  • Install ssl_cert.pem in /usr/local/share/ca-certificates and call: update-ca-certificates
  • Call: /home/$user/room_control start
  • For permanent installation insert '/home/feg/room_control start' into /etc/rc.local or into users crontab for reboot

Time line and responsibilities

  • 2020-02-?? Project meeting
  • 2020-02-20 Git Hub project configuration [Eduard]
  • 2020-03-31 Rough Web design [Holger]
  • 2020-03-31 Tablet kiosk mode website access [Holger]
  • 2020-03-31 Shift register board and connections to relay boards and Raspberry Pi [Jakob]
  • 2020-03-31 Raspberry pi motor controler [Eduard]

About

Control the room technic like window closer/opener, blind raiser/lower by a web application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published