{"id":28506159,"url":"https://github.com/sieluna/smartblinds","last_synced_at":"2025-07-04T22:30:54.027Z","repository":{"id":297070591,"uuid":"992255315","full_name":"Sieluna/SmartBlinds","owner":"Sieluna","description":"Semi-intelligent window blind controller solution","archived":false,"fork":false,"pushed_at":"2025-06-03T17:36:03.000Z","size":1583,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T03:09:34.228Z","etag":null,"topics":["arduino","edge","esp32","rust","stm32","tauri"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sieluna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-28T21:33:53.000Z","updated_at":"2025-06-03T17:36:04.000Z","dependencies_parsed_at":"2025-06-04T03:09:54.788Z","dependency_job_id":"c909a625-0949-4157-ba97-7c44f32e5399","html_url":"https://github.com/Sieluna/SmartBlinds","commit_stats":null,"previous_names":["sieluna/smartblinds"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Sieluna/SmartBlinds","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sieluna%2FSmartBlinds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sieluna%2FSmartBlinds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sieluna%2FSmartBlinds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sieluna%2FSmartBlinds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sieluna","download_url":"https://codeload.github.com/Sieluna/SmartBlinds/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sieluna%2FSmartBlinds/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263627858,"owners_count":23490857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","edge","esp32","rust","stm32","tauri"],"created_at":"2025-06-08T20:00:39.778Z","updated_at":"2025-07-04T22:30:54.021Z","avatar_url":"https://github.com/Sieluna.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Smart Blinds\n\nSimple auto blinds framework demo\n\n\u003c/div\u003e\n\n## Design\n\nThe Smart Blinds system is designed to manage and automate the operation of\nwindow blinds based on environmental data collected by sensors. The system\narchitecture includes multiple user groups, each containing several regions,\nwith each region capable of controlling multiple windows and sensors. This\nmodular design allows for scalable and customizable control over various\nenvironments. At the same time, we have a user layer management, users can\nschedule the desired brightness at different times through the gantt graph.\n\n![room.png](documents/room.png)\n\n- Group: Represents a collection of users and sensors in a defined area.\n- Admin: The user with administrative privileges who can oversee and manage the\n  entire group.\n- User A and User B: Regular users who control specific regions within the group.\n- Sensors(A, B, C): Devices placed in various locations to collect data on light\n  and temperature.\n- Blinds: Mechanisms controlled by the system to adjust based on sensor data.\n\nThe following diagram illustrates the relationships between the different\nentities within the system:\n\n```mermaid\nerDiagram\n\ngroups { int id \"PK\" string name \"UK\" }\nusers { int id \"PK\" int group_id \"FK\" string email \"UK\" string password string role }\nregions { int id \"PK\" int group_id \"FK\" string name \"UK\" int light float temperature }\nsettings { int id \"PK\" int user_id \"FK\" int light float temperature datetime start datetime end int interval }\nwindows { int id \"PK\" int region_id \"FK\" string name \"UK\" float state }\nsensors { int id \"PK\" int region_id \"FK\" string name \"UK\" }\nsensor_data { int id \"PK\" int sensor_id \"FK\" int light float temperature datetime time }\nusers_regions_link { int id \"PK\" int user_id \"FK\" int region_id \"FK\" }\nregions_settings_link { int id \"PK\" int region_id \"FK\" int setting_id \"FK\" }\n\ngroups ||--|{ users : \"group_id\"\ngroups ||--|{ regions : \"group_id\"\nusers ||--|{ settings : \"user_id\"\nregions ||--o{ windows: \"region_id\"\nregions ||--|{ sensors : \"region_id\"\nusers ||--|{ users_regions_link : \"user_id\"\nregions ||--|{ users_regions_link : \"region_id\"\nsensors ||--o{ sensor_data : \"sensor_id\"\nregions ||--|{ regions_settings_link : \"region_id\"\nsettings ||--|{ regions_settings_link : \"setting_id\"\n```\n\n## Assembly\n\nFollow these steps to assemble the sensor and blinds correctly.\n\n### Materials\n\n- 2x Arduino * (nano)\n- 28BYJ-48 stepper motor\n- Light dependent resistor(LDR) + Resistor for LDR\n- NTC resistor + Resistor for NTC\n\n### Procedural\n\n1. Assemble the Stepper Motor:\n\n   - Attach the 28BYJ-48 stepper motor to the Arduino Nano using appropriate\n     driver circuitry.\n\n   - Ensure the motor is firmly mounted to control the blinds mechanism.\n\n   - Assemble conductive devices to connect blinds or curtains.\n\n```mermaid\n---\nconfig:\n  layout: elk\n  look: handDrawn\n---\nflowchart LR\n    subgraph VCC5[\"+5 V USB\"]\n        VCC5_1((\"+5 V\"))\n    end\n    subgraph GND[\"Ground\"]\n        GND_1((\"GND\"))\n    end\n    subgraph MCU[\"ESP32\"]\n        direction TB\n            POW(\"ss\")\n            GPIO25(\"GPIO25\")\n            GPIO26(\"GPIO26\")\n            GPIO32(\"GPIO32\")\n            GPIO33(\"GPIO33\")\n            MCU_GND((\"GND\"))\n    end\n    subgraph USBTTL[\"HW-597  (CH340)\"]\n        direction TB\n            CH_IN_5V[\"+5 V IN\"]\n            CH_OUT_5V(\"+5 V OUT\")\n            CH_GND(\"GND\")\n    end\n    subgraph DRIVER[\"ULN2003 + 28BYJ-48\"]\n        direction TB\n            IN1(\"IN1\")\n            IN2(\"IN2\")\n            IN3(\"IN3\")\n            IN4(\"IN4\")\n            A(\"PIN A\")\n            B(\"PIN B\")\n            C(\"PIN C\")\n            D(\"PIN D\")\n            ULN_VCC(\"+5 V\")\n            ULN_GND(\"GND\")\n    end\n    GPIO25 -- IN1 --\u003e IN1\n    GPIO26 -- IN2 --\u003e IN2\n    GPIO32 -- IN3 --\u003e IN3\n    GPIO33 -- IN4 --\u003e IN4\n    IN1 -- |OUT1| --\u003e A\n    IN2 -- |OUT2| --\u003e B\n    IN3 -- |OUT3| --\u003e C\n    IN4 -- |OUT4| --\u003e D\n    VCC5_1 --- CH_IN_5V \u0026 POW\n    GND_1 --- MCU_GND \u0026 CH_GND \u0026 ULN_GND\n    CH_OUT_5V --- ULN_VCC\n```\n\n\u003e [!NOTE]  \n\u003e If using ready-made sensor provider can skip the `step 2`\n\n2. Assemble the Sensor:\n\n   - Connect the LDR and its corresponding resistor to an analog pin on the\n   Arduino Nano.\n\n   - Connect the NTC resistor and its corresponding resistor to another analog\n   pin on the Arduino Nano.\n\n   - Ensure all connections are secure and insulated.\n\n   ![sensor.png](documents/sensor.png)\n\n\n## Development\n\n**Option 1: One click start**\n\nFor develop frontend or embedded side, could try one click start:\n\n```bash\npython bootstrap.py\n```\n\n**Option 2: Manual start**\n\nTo start the server, you will need `Rust` installed on your machine. Then, run\nthe following command:\n\n```bash\ncargo run --package lumisync-server --bin server\n```\n\nTo work on the web application, you should have `Node.js(LTS version)` and `npm`\ninstalled. Then, run the following command:\n\n```bash\nnpm install\nnpm run web\n```\n\n**Database setup**\n\n1. Create the database (require url format, for example `sqlite:debug.db`) and\n   add migration script.\n\n   ```bash\n   sqlx database create --database-url \u003curl\u003e\n   sqlx migrate add \u003cname\u003e\n   ```\n\n2. Check the new migration script under `migrations/\u003ctimestamp\u003e_\u003cname\u003e.sql`. Add\n   custom database schema changes to this file.\n\n   ```sql\n   -- Insert sample data into 'groups'\n   INSERT INTO groups (name) VALUES ('sample');\n\n   -- Insert sample data into 'users'\n   -- Password: test\n   INSERT INTO users (group_id, email, password, role) VALUES (1, 'test@test.com', '$argon2id$v=19$m=19456,t=2,p=1$zk5JmuovvG7B6vyGGmLxDQ$qoqCpKkqrgoVjeTGa5ewrqFpuPUisTCDnEiPz6Dh/oc', 'admin');\n\n   -- Insert sample data into 'regions'\n   INSERT INTO regions (group_id, name, light, temperature) VALUES (1, 'Living Room', 100, 22.5);\n\n   -- Insert sample data into 'settings'\n   INSERT INTO settings (user_id, light, temperature, start, end, interval) VALUES (1, 100, 22.5, DATETIME('now'), DATETIME('now', '+03:30'), 0);\n\n   -- Insert sample data into 'windows'\n   INSERT INTO windows (region_id, name, state) VALUES (1, 'Living Room Right Window', 0);\n\n   -- Insert sample data into 'sensors'\n   INSERT INTO sensors (region_id, name) VALUES (1, 'SENSOR-MOCK');\n\n   -- Insert sample data into 'users_regions_link'\n   INSERT INTO users_regions_link (user_id, region_id) VALUES (1, 1);\n\n   -- Insert sample data into 'regions_settings_link'\n   INSERT INTO regions_settings_link (region_id, setting_id) VALUES (1, 1);\n   ```\n\n3. Adjust config file for `configs/development.toml` with database url.\n\n   ```toml\n   [database]\n   migration_path = \"migrations\"\n   clean_start = true # or false - it dependenies on your migration\n   url = \"\u003curl\u003e\"\n   ```\n\n**Connect service provider**\n\n1. For connecting to sensor service provider, gateway related setting need be\n   adjusted:\n\n   ```toml\n   [gateway]\n   host = \"...amazonaws.com\"\n   port = 8883\n\n   [gateway.topic]\n   prefix_type = \"json\"\n   prefix_mode = \"pr\"\n   prefix_country = \"fi\"\n\n   [gateway.auth]\n   cert_path = \"configs/cloud.pem\" # Replace with your certification\n   key_path = \"configs/cloud.key\" # Replace with your private key\n   ```\n\n2. Modified the group name by new migration or edit the database directly:\n\n   ```sql\n   UPDATE groups SET name = 'MY_CUSTOMER_ID' WHERE id = 1;\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsieluna%2Fsmartblinds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsieluna%2Fsmartblinds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsieluna%2Fsmartblinds/lists"}