Giter VIP home page Giter VIP logo

blindr's Introduction

blindr

An embedded systems project that automates the articulation of window blinds such that they automatically open at sunrise and close at sunset each day.

About the Project

The goal for this project is to have window blinds that automatically open and close around sunrise and sunset in an effort to instill healthy a sleep pattern. The code is written in C using the C/C++ SDK for the Raspberry Pi Pico microcontroller board.

The name blindr was a joke on the joke from this hilarious video by Joma Tech on if Apple made window blinds....

Features

  1. Fully motorized articulation of blind slats
  2. A generic code architecture that can be used by anyone, anywhere on Earth, without modification (granted you use the same components found below)
  3. No bluetooth or WiFi needed -- a fully isolated and contained system
  4. The ability to source latitude and longitude (needed for the solar calculations) and precise datetime data from a GNSS module
  5. The ability to enable and disable automation while still being able to "manually" control the blinds via a 3 position toggle switch

High Level Code Overview

Being an embedded system that will run 24/7, reliability and low power consumption were identified as mission-critical parameters from the project's inception. Some examples of this in action:

  1. The stepper and stepper driver board are put to sleep (no current flows to the motor or driver charge pump) whenever it's not actively running
  2. The main processing cores sleep indefinitely only to be woken up by toggle switch interrupts and RTC-based alarms for solar events
  3. The GNSS module is put in low power mode when it isn't needed

User Interface

The only direct input the user has with the system is through the 3 position toggle switch. Once powered on, the Pico will wait for toggle pin input that will be used to detect the boundaries of the blinds (fully closed up and fully closed down). It's critical that the first input in either direction (the order doesn't matter) goes all the way to the desired boundary. Once low and high boundaries are set, the toggle pin can be used to control the position of the blinds "manually". The code keeps track of the position of the blinds at all times and will not let the blinds turn past the given boundaries. To disable automation and keep the blinds shut indefinitely, leave the toggle switch flipped up or down which will move to the specified boundary, sleep the stepper, and wait for the toggle to be reset to the neutral position to enable automation again. There is currently no way to leave the blinds open and disable automation without unplugging the unit. This functionality could be encoded in a switch pattern such as [up] [down] [up] within a specified time frame, but leaving the blinds indefinitely open wasn't nearly as useful as being able to leave them indefinitely closed.

Hardware

There are CAD and STL files for the stepper motor housing and a driveshaft (shown below) that I drafted up for this project. They will work if you happen to have the exact model of stepper (Shinano Kenshi STP-42D201-37 with 14 tooth gear) and blinds (Home Depot Home Decorators Collection) as me. I 3D printed the mount and driveshaft in PLA, though you will likely have to design your own or find another method of getting your stepper to actually turn your blinds. There is also a housing for the Pico uC and Big Easy Driver (also shown below). This repo focuses on the code, however, which is compatable with any bipolar stepper and any mounting system you might use.

Stepper housing and drive shaft: Stepper housing and drive shaft

Case for the electronics: Case for the electronics

BOM (2022 prices)

  1. [$4] 1x Raspberry Pi Pico
  2. [$11] 1x gnss module (I used a quadcopter module - TBS M8.2 which uses a Ublox M8030-KT, though any UBX protocol module should work)
  3. [$21.50] 1x Big Easy Driver (A4988/A4983) capable of supplying 2A, though your particular stepper might require more or less current
  4. [$15] A NEMA 17 stepper motor or similar. Smaller may work, but it needs to be bipolar. For example, a 28BYJ-48 would not work without modification
  5. [FREE] old laptop charger (+8 to +30V filtered DC) which directly and indirectly powers all of the components. If you plan on building these blinds, I bet you or someone you know has an unused charger that could be repurposed to the task (this also reduces E-waste in the process!). As a last resort, check your local bartering site and do some haggling ;)
  6. [$2] 3 position toggle switch on-off-on. Note, a momentary switch (on)-off-(on) will prevent disabling of automation with the current code since it will always trigger a rising edge when the switch resets to the center position, re-enabling automation
  7. [$3] ~10 feet of thin gauge (28-30 AWG for signal wires, see your stepper's datasheet for recommended stepper wire gauge) stranded core wire
  8. [$5] (optional) connectors to allow components to be easily reused for other tasks (I use Molex Picoblade, though there are certainly easier options to crimp out there) Total: <$60 I reckon that's not bad considering COTS automated blinds typically run 3-4x that and this is far more extensible and the components can be reused for other tasks!

Contributions

  1. Contributions are welcome!
  2. New feature ideas, issues, PRs, etc.

blindr's People

Contributors

m12t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jason-ngn

blindr's Issues

Functionality to keep the blinds open indefinitely

Currently, automation can only be turned off by fully closing the blinds (either up or down) and leaving the toggle switch thrown in the direction the blinds are closed. There is no way to prevent the blinds from being shut at sunset. A solution would be to set a soft stop at the midpoint of the blinds range such that if you are actuating the blinds with the toggle switch, the blinds will stop in the middle until you lift the toggle switch back to neutral, and then flip the switch again to "step over" the stop in the middle. If you simply flipped the switch down and left it there, the blinds would stop in the middle position and the toggle switch would be still activated (pulling the logic to ground) thus automation could be disabled at this stage with the blinds remaining open.

Alternate closing the blinds up and down instead of always down

The current process for closing the blinds automatically at sunset will close the slats in the down position every sunset. If no manual inputs are given and automation is kept enabled, the blinds will cycle through: down ... open ... jmp indefinitely. This can lead to subtle drift in the blinds position tracking due to mechanical "bounce back" of the blinds when the stepper motor is deactivated and no longer holding the blinds fully shut where they will spring back to slightly less firmly shut (which can't be tracked by the stepper's position counter). Cycling from lower to upper bounds should help to reduce this side effect. A simple implementation is as follows:

// in blindr.c

// global var definition
uint boundary_dir = 0;  // boundary direction: 0 is down, 1 is up

// ...

// in read_actuate_alarm_sequence()
if (*solar_event == 0) {
    // ... other existing code
    boundary_dir = !boundary_dir;
}

// ...

// in actuate()
if (solar_event == 0) {
    // ... other existing code
    step_to_position(&current_position, boundary_dir*boundary_high, boundary_high);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.