# Smarter IOT connected window By Erik Gustavsson, eg223gv. ### Short Overview. **A window is a source of heat with sunlight. A blinder In a window could act to reduce the temperature in a room when closed in the right time ( blocking sunligth). Due to the need to change the heigth of the blinder (potentially) and rotating the blinder to block the sunlight It could also automate closing the blinder.** #### Aproximate Time With all parts ready (and printed) and the correct tools this project will likely take less than a day (12H) since some models may need to be adapted and printer for the window in question. More time could be used for a better finalisation step but is not required. The time need would increase with level of finalisation. If it is moved to a prototype board (not needed) the time needed might double (dipending on soldering skill and crimping skill). ### Objective #### Why Not having to do a menial task and potentially slightl less hot room during summer when sunlight heats a room sounds like a time saving and potentially energy saving idea. This is also a great oppertunity to learn and use previusly bougth components. And more data from living conditions does not sound like a bad deal. #### Purpose The act of opening a window (if in a bad place could) could take a couple of secounds to lower / raise, lets estimate that time loss as 10 secounds. Since that occurs twice a day the time spend during a year becomes 10 s * 2 * 365 = 7300 s/year Therebye considerable time could be saved from automating this daily aciton, hopefully more time then maintaining the project, therbye if it funciton flawlessly time would actually be saved from 2.5 years (+ time from capital investment compared to income for the material investment). This could also Show activity from inside a house and therebye potentially act a timed light and reduce the risk of burglary. Since I personally also use blackoutcurtains any potentiall problem will mostly be noise if something where to fail. And this could also save energy by reducin cooling needs during months with allot of incoming sunlight ( and unneccessary heat). #### Insights This is a project plenty of diffrent challanges and things to learn. Hosting webserver, using NTP-server, sending data to cloud and interacting with sensors. Since this include many challanges it have many ways for further future improvements and future learning opportunitys. This is also intended to se how the room temperature is on average durign seasons compared to the amount of light to the room. ## Materials ### Components (price may vary due to exchange rates) | What | Price (kr) | Why | | -------- | -------- | -------- | | [Electronics kit with some sensors ](https://www.amazon.se/ELEGOO-kompatibel-fullständiga-elektronikprojekt-mikrokontrollbräda/dp/B01IHCCKKK/) | 580 | DHT11, photoresistor, resistors, | | [Node MCU ](https://www.amazon.se/AZDelivery-NodeMCU-Lolin-Wifi-utvecklingskort-kompatibel/dp/B06Y1ZPNMS/) | 92|Microcontroller with wifi| | [Switches x 25, (not currently used...) ](https://www.amazon.se/gp/product/B07YD8BM28 ) |86 |Potition swithces from 3d printer (almost like a button)| | [Compression springs kitt ](https://www.amazon.se/gp/product/B079N7BMS3/) |128 | part of mechanism to prevent motor use when still (springs)| |**[M2 to M4 1080 pcs , ](https://www.amazon.de/VIGRUE-Zylinderschrauben-Gewindeschrauben-Unterlegscheiben-Innensechskantschlüsseln/dp/B081SGZ2C4) | 220 | To assemble stuff (nut and screws)|  |** [Brass 3d printing screw insert kitt ](https://www.amazon.de/HSeaMall-Innengewinde-Rändelmuttern-Spritzguss-Gewindeeinsatz/dp/B07CPRHP2X) |130 |Melt into 3d print to screw into  |  |* [Doupont crimping tool + connectors ](https://www.amazon.de/Crimpzange-Dupont-Stecker-Steckverbinder-Crimpkontakten/dp/B07QX51F3B) | 400 | Create wire connections ( soldering could otherwise work)|  | [Breadboard ](https://www.kjell.com/se/produkter/el-verktyg/elektronik/elektroniklabb/luxorparts-set-med-3-kopplingsdack-mix-pack-p36085) | 140 |Recomended but not strictly needed (Node MCU fits well over 2 breadboard side by side) |  | [Servos ](https://www.amazon.se/gp/product/B088NQTBPB/) | 111|  almost small geared motors that can be angle controlled|  |[USB charger ](https://www.webhallen.com/se/product/306327-Deltaco-USB-laddare-5V-2-4A-12W-Svart-Ingen-kartong) | 99| 5 Volt source for the circuit (use a old phone usb charger could work in most cases|  | [USBA to micro USB cable ](https://www.webhallen.com/se/product/314039-iiglo-USB-A-till-USB-Micro-B-2-0-kabel-0-5m-Svart) | 59 |Uppload data to the microcontroller Be aware some chargin cables does not have data lines in them and will not work|  |* [Protype board ](https://www.amazon.se/Yizhet-prototypsats-prototypkort-gör-det-själv-elektroniskt/dp/B08BR2CQRX/) |150|For soldering the finished parts to| |* [IC pins for to solder in ](https://www.amazon.se/Yizhet-prototypsats-prototypkort-gör-det-själv-elektroniskt/dp/B08BR2CQRX/)|80| To easily connect and not solder in IC| |[Diodes](https://www.amazon.se/gp/product/B07Q8RPBVY/)|110|To esentially limit current in one direction| |[74HC08N](https://www.digikey.com/en/products/detail/texas-instruments/SN74HC08N/277216)|10| 4 way 2 in And cmos gate (Integrated circuit)***| |[74HC08N](https://www.digikey.com/en/products/detail/texas-instruments/SN74HC11N/376871)|10| 3 way 3 in And cmos gate (Integrated circuit) ***| |[Diodes, bought a kit for some IN14004 ](https://www.amazon.se/gp/product/B07Q8RPBVY/)|119| Almost singel directional for voltage| |[CD74HC04MT](https://www.digikey.com/en/products/detail/texas-instruments/CD74HC04MT/1692180)|10|Hex inverting logic IC| |[Hook up wire ](https://www.m.nu/breadboarding/hook-up-wire-kit-30awg)|199 |For finalisation (cable, others should also work)| (* could do without finalisation) (** could do without but not recomended) (*** To separate motors from microcontroller) ### Tools | What | price (kr) | Why | | -------- | -------- | -------- | | * [ PLA 199kr / 1kg ](https://www.clasohlson.com/se/Filament-PLA-Universal-till-3D-skrivare-Clas-Ohlson/p/38-7986-1 ) | 199 | Material for 3d printer | |* [ Creality Cr-10 S4 ](https://www.creality.com/goods-detail/cr-10-s4-3d-printer )|5500| 3d printer| |* [Multimeter 600 kr ](https://www.clasohlson.com/se/Multimeter-med-USB-UNI-T-UT61D/p/36-4717 ) |600|Multimeter ( cheaper works fine)| |* [Soldering iron ](https://www.amazon.se/gp/product/B0183RJIUE/) |999| Soldering iron, most will do| |* [Desoldering kitt ](https://www.amazon.se/gp/product/B07TDLCC5T/) |110| anti soldering (removing solder)| |* [Solder 100g ](https://www.kjell.com/se/produkter/el-verktyg/verktyg/lodning/lodtenn-lod/blyfritt-lodtenn-035-mm-100-g-p40584) |280|Solder, will last quiet some time| |** [Cabelshoetweeser](https://www.k-rauta.se/produkt/kabelskotangset-ironside-60st-kabelskor/3394661282002) |175|Removes insulaiton of a cable ( a knife could work but is not recommed| |[Plyers kit (including a cutter)](https://www.clasohlson.com/se/Elektronikt&aring;ngsats/p/40-8298)|119|Plyers to bend a metal part such as a spring, cutt wires | |[Art knife](https://www.3dprima.com/se/tillbehoer/verktyg/art-knife/a-25787)|39|To clean the edges of 3d print (care for sharp edge...)| (* could do without finalisation) (** could do without but not recomended) #### Having a hard time justifying tools for a single project? Consider searching for a local maker space. Many of them have 3d printers and soldering irons and many other tools. ###### (yea, so about my shopping habits... many parts of this is in larger kits and will outlast this project) ## Computer setup #### Steps for the installation Download the [Arduino IDE](https://www.arduino.cc/en/software) for your plattform Mac download and open the zipp file and move the Arduino.app to applications. Then you should be able to open it. Linux download the apropriate version (Arm/not arm, 32 or 64 bits). Open terminal and navigate to the file then run (filename is for the downladed file) tar xvf filename To extract the tarball and then cd into the newly created folder and run ./install.sh Then it should be ready to open it for the first time. #### Install board manager The EPSN8266 board manager needs to be installed, go to file, preferences, and in the area after "Additional board manager URLs:" http://arduino.esp8266.com/stable/package_esp8266com_index.json Go to Tools > board > board manager Search for ESPN8266 and press install. Restart the IDE Selecting the board Go to Tools > board > ESPN8266 Boards(3.01) and press NodeMCU 0.9 (ESP-12 Module) It may require you to select the correct port for your unit. On linux this may be /dev/ttyyUSB0. The IDE uses libraries that neeeds to be installed. #### Install libraries In the IDE go to Sketch > library > manage library. In the Library manager Search for the libraries named and hover over and press install for each of the following ( searching may be required in the top right of the library manager) Stepper, Servo, ESPN8266Wifi, WifiUdo, DHT. #### How to uppdated code (Upploading) Connect the microcontroller with the usb calbe to you computer and select the apropiate port (Tools > port and select it). Press uppload and oress the FLASH button on the NodeMCU. The lower black part fo the arduino IDE provides current status of the compiling (including errors), flashing and potentiall flasing errors. To view serial data press the magnifying glass in the top right of the arduino IDE and select the specified baud rate, for this project use 115200. This is almost a console where you can comunicate (if programmed to) and se Serial.Print messanges. ## Thingspeak ### Sign up / configuration Go to [Thingspeak](https://thingspeak.com) and klick " Get started for free" to create a new account. Since it is linked to a Mathworks account any prexisting such account may otherwise be used. ##### Creating a new channel Press "Channels" and select "My Channels". Press the "New Channel" button and create a new channel. Fill in a fitting name and potentially soem description. Fill in relevant names for the channels. For this project I use the following order: 1. Temperature 2. Humidity 3. Rotation 4. Position Once the device is running press channels, chosen name for it and then the seppareate fields should appear as preconfigured graphs. A recomendation is to press add widget press numerical display name it for the varialble and select the apropiate field and there is some direct numeriacal valeus from the sensors. Got to the tab API keys and if there is get the key ( will be used in the code). ## Assembly Print the 3d printed files by using a slicet to import the STL-s and converting them to a file system that your printer could print (such as GCODE for the Cr10-S4). This may vary and the program used may vary. Recommeded orientation for the print is as flas as possible. the closer smal part may require support dipending on the bed adhesion. 1k/3.3 = 0.0033A A general rule of thumb is if doupting check the datasheet. Warning resistors and other components have long uninsulted legs that could short on each other, use space and do not mov them when the unit is on. Ground yourself before starting working on the unit ( apropriate method may differ by region). If using a FDM printer rememmber that the print orientation matters for the strenght (in one direction). The layers connections are often weaker than in the other direction. Any potentiall gears and other components in this project are recommended to print flat (unless otherwise specified). Github repositary for the code, image of the circuit diagram below can be found [here](https://github.com/erigusta/Motorised-blinder). ![](https://i.imgur.com/0DNEd1h.png) Connection of sensors to the Node MCU Please note that the GPIO pins are sligthly oddly ordered and a pinguide can be found [here](https://github.com/thehookup/Wireless_MQTT_Doorbell/blob/master/GPIO_Limitations_ESP8266_NodeMCU.jpg) ###### Isolating 5v system from 3.3v. Either a octocupplec can be used While it might work to directly connect the motor to the node mcu any rapir movement could make the motors act as a generator and potentially fry the microcontroller. While it is fast and non inverting it requires an additional IC(integrated circuit) and potentially a decoupeling capacitor. Other ICs may be used such as 4st 2in OR gats and 3st 3in Or gats, then the same wireing could likely work. A level transistor should be able to be used but most of the material was spares form larger kits and was not on hand for this. This may also require decoupeling capacitors. Some type of offset resistor and a diode could also work but htat could use more power than necessary. Resistor offset is recommended to be avoided since current may stil flow into to the microcontroller. Transistors could be used but then it would likely be slower. A diode may stop the flow in one direction but may will not increase the voltage. Pin D5 to D8 is connected via a diode to prevent a current flowing in the wrong direction to the input of the 74HC08N and its two inputs combined. The resulting output is also connected to a diode and then the individual inputs for the stepper motor driver board. The servos can be controlled by the node mcu and a LN14004 diode is placed between the data pin. This should therebye hinder a current from the motor to the microcontroller. The connection is a bit more complex as seen in the picture below since the two servos need to share a PWN pin but this can be done by utilising simple logic gates. The and gate forces all in signals to be on for a signal to reach the the servo. Since a pin is used to swap between on and off inverting it is used for the other side of the and gate. A recommendation from this is to have a small delay whenever the swappin is used. Otherwise movememts may start on the wrong pin. ![](https://i.imgur.com/4aIswK4.png) Pin D1 selecting pin for D2 (PWN). Finaly a similar setup is used to add the steper motor. IN4 goes to Gpio 13, IN3 goes to Gpio 15, IN2 goes to Gpio 12 and In1 goes to GPIO 14 (as seen in the code). The jumper over +12v is on the stepper motor driver and the other pins of it are connected to gnd and 5v. ![](https://i.imgur.com/Jnh4BLP.png) #### Electrical calculations ###### General A voltage is the difference in potentiall between two surfaces and the current is the flow of electrons. the resitance is a oposition to the flow thus reducing the voltage for a current passing over the resistance. This can be calculated with [ohms law](https://sco.wikipedia.org/wiki/Ohm%27s_law). U = RI -> I = U/R ###### Recomendations Conform assemble ##### Photoresistor Let start simple wit hthe photoresistor. Since it is it act as a voltage divider the calculations are simple. When the ilumination increase the resistance of it drops. The output voltage to the microcontroller is calculated by : V = (R / Rp + R ) * Vin Where Vin is 3.3v, R is 10 k ohms and Rp is varying depending on the input light. Since the resistance vary and after a crude meshuremnt the it ranged from 50k ochm to 1k ohm. The resistance form A0 to gnd on the microcontroller was found to be 320k Ohms. Since the current dipends on the resistance the current from the microcontroller can be neglected for a aproximate calculation. Lets check the max and minimal for the total resistance: 3.3/60k = 55uA 55uA * 3.3V = 181.5uW 3.3/11k = 300uA 300uA * 3.3 = 990uW. ##### Button When the contact is not triggered the 3.3v goes over the resistor R1 (10k) that leads to a current of 3.3/ 10K = 330uA. For a power consumption of 330u * 3.3 = 1.089mW. When triggerd the secondary resistor (R2), 1k ohm the voltage drop over that resistor is therbye also negligable. ##### DHT11 This sensor is placed on the breadboard/prototype board and then does not need any external 3d printec component. Resistor between sensor and microcontroller R1 = 330 ohms. Resistor 3.3v to D pin 4.7K ohms. R2 Resistor on DHT11 (R3) (yours may vary) 5K ohms. The voltage over R1 drops by less then 1mV when plugged in and therebye the current can be considered negligable. The voltage over R2 drops by 0.2mV The current over this unit can then be calculated since the resistance is known. 0.2m/4.7K = 42.5 nA (close to 0). The voltage over R2 drops by 0.2mV The current over this unit can then be calculated since the resistance is known. 0.2m/4.7K = 42.5 nA (Same as R2). The energy consumption of this sensor is negligable. This may vary a bit when the sensor is temporarly reading temperature. From the sensor [datasheet](https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet-Translated-Version-1143054.pdf) lets asume the maximun power consumption 2.5mA and 3.3v that would use a total of : 3.3*2.5m = 8.25mW ##### Stepper motor ( 28BYJ-48) From a [datasheet from antohter site](http://descargas.cetronic.es/28BYJ-48.pdf) notes a current of 40mA given 12Vdc lets asume that the driver board since the driver have a 5v mode that is used in this project a assumption is made that they will have the same max power. That becommes then: 40m *12 = 480mW That is way more than you want to power something from the EPSN8266, a good thing that the driver board have sepparate power pins. ##### Servo (9g SG90) [Datasheet on another site](https://www.kjell.com/globalassets/mediaassets/701916_87897_datasheet_en.pdf?ref=4287817A7A) Provides a maximum current of <600mA lets asume this as a maximum to se potentiall maximum power use. 600m * 5 = 3W This is a maximum power when in HIGH load. A good thing that it is solely to be used in locking the blinder height string and rotating the blinder. The IC uses low quantities of power, datasheets show maximum use of 20uA, that would become 100uW per component. ##### Total power The sensors are almost negligable compared to the stepper motor and the servos. Due to the power use a recommendation is to just use a servo at a time. **This is also why the motors should not be powerd from the node mcu, they draw to much current** The code needs some changes to work with small sleep perioids, while and thus no light or deep sleep is currently used. With a similar [use case](https://www.scirp.org/journal/paperinformation.aspx?paperid=90552) used 70.89 mA to power it the power used solely by the microcontroller would then become 70.89 mA * 5V = 354.45 mW. The power required would then become for the microcontroller less than many ligthbulb. The total energy consumption would then peak when raising the blinder, with a aproximate consumption of 0.35 + 3 + 0.48 = 3.83W. #### Sepparating 5v dangers from 3.3v system Since (some) motors often can act as generators they can produce power and damadge the system if not cared for. This lead that the input from the microcontroller should be sepperated from the 5v system. ### Initial configuration **Be aware that small electornic can be sensative to electro static discharges, consider ground yourself before working with the bare components** Since the chosen microcontroller (a spare from another project) have wifi antenna and no Lora cabaability by itself the choise is simple. Wifi has sufficient range for this project (low range) and it is intended to be powerd by the mains (via the usb charger) and therebye the potentiall lower power usage is not worth the hasstle andwasted pins to get Lora or other connection cababilities. This also simplifyes the connecton insede the network and less security problems if a localy hosted webserver is intended to be used. ## Plattform This project is partly locally self hosted on its own webserver and partly connected to the cloud with [Thingspeak](https://thingspeak.com). This plattform was selected due to the free use if it is with 8,200/day free mesenges / day, minimal update (max) of 15 secounds, upp to four channels (temperature, humidity and potentially angle and height). It is also avalible to connect to MATLAB for future potentiall thermal simulations. The data apears to be stored in a CSV that is graphed on their site with a one year retantion plan. For 4 channels and once a minute update their [site](https://thingspeak.com/prices/thingspeak_home) estimates 2,102,400 messanges / year and recomends their free tier. (More to spend on tools...) Thingspeak uses the can support diffrent protocol such as [MQTT](https://se.mathworks.com/help/thingspeak/mqtt-api.html?searchHighlight=mqtt&s_tid=srchtitle) transportation protocol or they support http /tcp as this project uses. Since this already uses http for the webserver and it is powerd with wifi this is not limeting as much. THe majority of the data is handeled in the websererver and therebye the packet limit is no big hurdle. For a single room this platform should suffice since the data to thingspeak could be the same (no further need for another DHT11). Some binary manipulation to merge data to one could be used but that is bit hastle. If intended for more than a couple of units a plan could be bouth and the updating frequency could be decreased to lower data usage. Since they still could work as webservers each module for local fine adjusments and increased data security. The free plan works for currently planned purpuses since another unit is planned to be build and controll another window with the same level settings as the first, thus the DHT11 sensor is unneccessary on that unit and the internal sensors should manage the level of the blinder and the angle of the blinder. ## Code Can be found on this projects github page since this is a already long guide [here](https://github.com/erigusta/Motorised-blinder/blob/main/Code/code.ino). Current triggers include timer based open and close, temperature triggered solely rotation. In the start allot of configuration stuff exist, global variables (might in the future rework and reduce it abit more). The code is commented but since it is over 400 lines and this is getting long a sellection is brought to this page #### Selected parts char webpage[] PROGMEM = "R=====( ) This is to store the webpage in the future in promgem to have more potentiall size and not limit the webpage size. Other inttialisations are including librarys for servo, stepper, NTP (server get time), wifiserver, setting values that (some could be changed to pointers that passes to funciton later). Also some pins are configured in the start. Some of these valuses are targeted in a future for variable setup in the basic webpage run on this server. First funciton is to move the system this includes configuring stepper / motor stuff, and then "stupid" rotation. Then comes advanced_rotate that serares for either high or low light level, usefull to allow more or less heat to pass trough the window thus reducing heating/cooling needs. A few sensor update functions and some debug funcitons commes then prior to the setup funciton. It runs once (similar to other boot funcitons). This gives info via serial (if avalible) and connect to wifi, settup timezone and initialise pins (input/output). Then finally the long loop funciton. This runs continiusly and checks for users that atempts to connect to the webserver and the included webserver. This is target for future movement to progem to reduce ram usage for something that is more rarely used. Whenever the clock is ab:cd:31 data is sent to the chosen thingspeak service. The code is slighly alterd ( se comments in code) with extension of a sendStr but hte code is in public domain (se comment). Then commes the local automation, rasing and lowering the window when time targets are enabled by automovements. This is the "lazy" solution to lowering and raising the system by hand. Finally is the smart rotate triggers that are used within a margin of the time targets and it is enabled. This is the smarter solution to help reduce or increse passed heat into the room to lower cooling / heating need. Due to the current time usage in functions and webserver funcitonality sleep is not running for the system. a ghost function is included in the end of the funciton. The need to change for memory management is currently not high but a future plan includes ssh and login on the webserver and that would might add a couple of librarys. This would then likely increase memory. ### Data transmitting #### Update frequency Due to the chosen platform a update frequency of 60 secounds was selected. This may be lowerd if desired. The data is sent in two messenges. With a maximum of 3 million/year this becomes 1*60*24*365 = 525600 messenges /year Well under the maximum for a free plan. #### Why wifi? As mentioned prior WiFi was chosen since it is close to a wifi and **not** powerd by a battery. The main disadvantages of wifi is low range and high energy use is thereby negated. Another reson is the simple integration of wifi and need for additional components to connect as LoRa, since the webser is also running for a local network other networks such as [Helium](https://www.helium.com/use#startusing) would made this project more complex and introduced a yearly cost of (for helium) $5.26 or potentially as low as $0.35 for a messenge every 15 minutes / year. The webserver is also hosten localy on a network and should not be displayd on a public network due to current http use and no loggin (may change at a future date). Due to this and due to the hardware integration WiFi while may use more power (not running on battery) and #### Transport protocol The protocol was primarly selected for being open source, lightweight and easy to implement. The need for TCP/IP already existed prior that is built on and the future ability to add SSL/TLS for improved security in the future. This works for thingspeak since it is only to displaying data not send data to the device, that is a intended for the webserver. ## Presenting the data ### Take a look at the section under computer setup named Thingspeak. The data current data is visualised on the webserver and historic and current data is stored in thingspeak. ![](https://i.imgur.com/l88O4pi.png) This was from WIP time, therebye some 0s was introduced and tested without powering the project during some time and position stuck to get some non affected temperature values from the light input. The data is preserd [forever or untill manual removal](https://community.thingspeak.com/forum/general/data-retention-time-for-thingspeak-cloud-storage-1/) even for a free account. This data is sent every minute (but could still be close to every 15 secounds even on the free account or slower if desired). This is well integrated for Matlab, even sharing a account and can therebye potentially be used in future numerical analysis courses. Export options include CSV and therebye a simple hommeade program could use this and this could also be used in other progams such as excel or libre office spreads. This would could then be easily utilised for future purpuses. Data is stored in a CSV even if it does not apper propperly on the graph. Automation of the data is done locally on the microcontroller or acted on from the webserver. This is optional using the rotation of the blinder due to temperature and timed raising and closing the system. ## Finalizing the design ![](https://i.imgur.com/mAkYF2y.jpg) Connection placement for the photoresistor, limit switch inside their 3d-printed sensor mount. The contact switch needs to be triggerd by the blinder and placement may vary due to the window. The photoresistor can be placed high upp close to the top of the window to ensure that the rotating will funciton even with a blinder thet is not fully down. ![](https://i.imgur.com/0ycVFVy.jpg) The rotation connector is attached to the blinder rotater in the edge of the picture with a zipptie and to the servo with wire. The wall mount in the right has screw hole for wall mounting on the side and on the botton to screw with a bolt on the botton. The servo calbe goes inside of a small hole. ![](https://i.imgur.com/erQL4JF.jpg) The rotater motor mount is attached as the other mount and has a spring keeping constant tension to the pusher plate to the mouting plate. The blinder cable goes to the stepper motor mounter by a hole in the botton. The servo included conenctors are used to insert a small metal sting (form a spring or other source) by the hole to ist destination in a 3d printed part. ![](https://i.imgur.com/FAOjfCH.jpg) System prior to mounitn in the above 3d printed parts. Prior to use of wire crimping and movment of the system to a prototype board. The move to the prototyope board is to reduce the risk of movement of components. Due to the use of wire headers and IC sockets this does simplify potentiall future repairs and still have diodes, connectors easily accessable and pluggable. This project originally used a lopy 4 and expansion board but swapped to the hardware on hand, a NodeMCU to use C++ (personal preference currently) and while the Lopy4 might use the ESP32 microntroller this seemed to be a hasstle and did not include substancial benefits other than more pwn pins and then less ICs on the breadboad. The planetary gearbox is finicy to make especially with skewness to make a constant contact between the gears. This gearbox is not finilised yet but is work in progress and included as the .blend file on github. This is likely one of the parts that incresease energy usage the most with a simple fix. Either grease (not planned and when seraced for the litium grease was not found in stock) could increase part life and reduce wasted energy. A metalic gearbox on the stepper would also (likely) reduce energy use and reduce comparable wear. how the final results of your project. Give your final thoughts on how you think the project went. What could have been done in an other way, or even better? Some of the planned improvements are listed below in the improvement section and likely more would been done if time was utilised better. ### Improvments The webserver could easily be improved form better visualisation of recent data, handeling of more units, initalisation of the system with configurable IP, SSID, password user changable without flasing the microcontroller. Login would also be a great addition with potentiall user group accouts but then a fog computing setup would be preferiable. That could then decrease network usage, enable sleep funcitons simpler when the system is not constantly enabled for webserver. A varying update frequency might be usefull. Change open/close times would be fitting there with changable times for certain weekdays. Adding a switch to the system that the user can program likely preset would be toggle full upp & rotate to full down & rotate. Moutning sensors and motors on a single piece would simplify this Acordning to the [DHT11 datahseet](https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet-Translated-Version-1143054.pdf) a 100nF capacitor can be added between gnd and vdd. Similar parts such as the ICs may benefit for simular treatemend but the system works as is. When finalising plan accordingly and have a spot between GND and VCC for these compoents to add some capacitor (Be carefull with the direction if using a electrolitic capacitor) Other units may be added (as long as they recive other fixed IP-s) and then the main webserver can send a command for movement to other units. If it is in the same room it will be unlikely with other sensor data and a unit without DHT-11 may be needed. If used in other rooms a non free plan of thingspeak could suffice. If it is intended to scale beyond a single family home it is likely possible to run a raspberry pi as a webserver comunicating to motorised sensor nodes. This could be improved to system utilising a raspberry pi or similar as a fog computing node and therebye centralising the webserver (thus enabeling simpler sleep for the microcontroller(s)) and sending data. Since this project currently has one node the energy use would increase but this would increase future scalability, reduce trafic and simplify changeing several nodes at once. A singel power source could be used somewhat simple since the NodeMCU via the Vin that otherwise connect to the usb connector. Since it already has 5v for the motor system that would be simple. Potnetially a fuse and some diode might work. Error management would be great in this project and may (hopefully) one day be added. This project could then have a rely controlling the 5v system and whenever it is not used have a standard as off. This could then increase safety in is material that is already included in a kit. The system could then shutdown most of itself if a error occurs. Sleep of the unit and interupts for starting the webserver might be possible but the greater saving in energy is not running motors constantly. Without the secound servo and spring to hold the blinder level the stepper might need to opperate constantly to keep it open, thus using allot of power. Gear box optimisations for the stepper could also reduce power usage for future improvements. This project was a hard to start, ie took a while to get going and as such it was allot that is planned to do in the future. This data collected from this project might be used to learn abouth numerical analysis in MATLAB in the future and as such advanced analysis and modelling from the data may come in the future. A more detailed information regarding current development is found [Here](https://github.com/erigusta/Motorised-blinder/projects/1?add_cards_query=is%3Aopen) on the github workspace for the project. This late stage was created after publication of this project and is used to keep track of further upprades of this project. ### Finalisation assembly (WIP) This is intended as a finalisation step of the desing and may be skipped if desired, this utilise quiet a bit of soldering, creating some wire connectors. seting up the micro controller on the prototype board and other components. The Vin pin might be used for powering the microcontroller and sensor part of the system in the future form the 5 volt system if a fuse or similar is used to prevent damadge from a manual movement of a stepper or servo. To crimp a connector to a cable: Remove a couple of milimeters of the cable insulation. Prepare one metal connector insert and put it in the crimping tool. Put the newly exposed cable a couple of milimeters down into the metal connector and press the tool. Put the newly crimped metal part into the connector. Soldering to a prototype board: **Avoid breathing in the fumes, use eye protection, solder could in some cases cause metal sparks flying** Layot everything and ensure knowlidge of the connections to solder. Have a fire extingusher close by. Check that the solder tip is screwed in. Turn your soldering iron on. Have some solder tip cleaner avalibly (speicallity sponge (wet) or coper sponge). A heliping hand may be useful in some cases. Let it heat up and clean the tip using the sselected tool. Prepare what needs to be soldered. In one hand hold the iron and in the other hold the solder. Carefuly tin the tip (before and after use). Heat the place for soldering and then apply solder. Let it cool slightly and then if needed snipp of spare metalic remains of the component sticking down under. Use a multimeter when it has cooled down to verify that is connected and not connected to any wrong place. Not allot of solder is needed to connect but it should become not connected to the base the base might not have been sufficiently heated, if it becommes spehrical more then needed amouth of solder was used, if the base is blackend it was to hot in the base and if it was just lose there might have bene to little solder. Test connenctions with a multimeter to avoid unnplanned shorts etc. Did an error occur or unnplanend short ? Use a desoldering tool such as a desoldering braid. Heat it upp with the soldering iron and then putt part it over the joint to be desoldered. If it is allot of solder a plunger could be used. Temporary mount for the part of the system. ![](https://i.imgur.com/zeVKM2T.jpg) ![](https://i.imgur.com/G5gul4m.jpg)