Difference between revisions of "Smart Blinds"

From ESE205 Wiki
Jump to navigation Jump to search
m (Protected "Smart Blinds" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(79 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Smart Blinds Weekly Log]]<br />
+
Weekly Log: [[Smart Blinds Weekly Log]]<br />
Presentation: [https://drive.google.com/file/d/1ba2Y8SOsmPrEChFAuA-RMJ84GybEoiOb/view?usp=sharing]<br />
+
Tutorial: [[Multi-Input Analog Reading with Arduino Uno]]<br />
Codes and design: [https://github.com/Liu-Xinquan/ESE205]
+
[https://drive.google.com/file/d/1ba2Y8SOsmPrEChFAuA-RMJ84GybEoiOb/view?usp=sharing Presentation]<br />
 +
Codes and Design: [https://github.com/Liu-Xinquan/ESE205 Github]<br/>
 +
[https://classes.engineering.wustl.edu/ese205/core/images/0/03/Poster_Sun.pdf Poster]
 
==<big>Proposal</big> ==
 
==<big>Proposal</big> ==
  
Line 36: Line 38:
 
*Save energy as much as possible
 
*Save energy as much as possible
  
=== Challenges ===
+
=== Expected Challenges ===
 
----
 
----
 
* Build the frame and fit in the blinds
 
* Build the frame and fit in the blinds
Line 52: Line 54:
 
===Budget===
 
===Budget===
 
----
 
----
*Achim Home Furnishings 1-Inch Wide Window Blinds, 24 by 64-Inch, White $11.99 (provided)[https://www.amazon.com/Achim-Home-Furnishings-1-Inch-64-Inch/dp/B002491X9M]<br />
+
*Achim Home Furnishings 1-Inch Wide Window Blinds, 24 by 64-Inch, White $11.99 (provided)[https://www.amazon.com/Achim-Home-Furnishings-1-Inch-64-Inch/dp/B002491X9M Amazon]<br />
*Motor and Driver $8.59 (Amazon)[https://www.amazon.com/KOOKYE-28BYJ-48-Stepper-ULN2003-Arduino/dp/B019TOJRC4/ref=sr_1_4?s=electronics&ie=UTF8&qid=1537818135&sr=1-4&keywords=28BYJ-48+DC+5V+Stepper+Motor]
+
*Motor and Driver $8.59 (Amazon)[https://www.amazon.com/KOOKYE-28BYJ-48-Stepper-ULN2003-Arduino/dp/B019TOJRC4/ref=sr_1_4?s=electronics&ie=UTF8&qid=1537818135&sr=1-4&keywords=28BYJ-48+DC+5V+Stepper+Motor Amazon]
 
**28BYJ-48 DC 5V Stepper Motor <br />
 
**28BYJ-48 DC 5V Stepper Motor <br />
 
**ULN2003 Driver Test Module Board <br />
 
**ULN2003 Driver Test Module Board <br />
 
*Arduino Uno $17.99(Provided)<br />
 
*Arduino Uno $17.99(Provided)<br />
*Digital Light Intensity Sensor Module for Arduino UNO $5.99[https://www.amazon.com/WINGONEER-Digital-Intensity-Resistor-Photoresistor/dp/B06XHGGG73/ref=sr_1_5?s=industrial&ie=UTF8&qid=1537818195&sr=1-5&keywords=Digital+Light+Intensity+Sensor+Module+for+Arduino+UNO]  <br />
+
*Digital Light Intensity Sensor Module for Arduino UNO $5.99[https://www.amazon.com/WINGONEER-Digital-Intensity-Resistor-Photoresistor/dp/B06XHGGG73/ref=sr_1_5?s=industrial&ie=UTF8&qid=1537818195&sr=1-5&keywords=Digital+Light+Intensity+Sensor+Module+for+Arduino+UNO Amazon]  <br />
*8RGB LCD Shield Kit w/ 16x2 Character Display(for user interface) $23.95 [https://www.adafruit.com/product/716]<br />
+
*8RGB LCD Shield Kit w/ 16x2 Character Display(for user interface) $23.95 [https://www.adafruit.com/product/716 Amazon]<br />
 
Total: $38.6 (Actually spent)
 
Total: $38.6 (Actually spent)
  
Line 65: Line 67:
  
 
==Design and Solutions==
 
==Design and Solutions==
 +
===Mechanics===
 +
The first step to achieving our goal of controlling the blinds with the stepper motor was to build and assemble the components properly.
 +
*Building The Sensor
 +
**The light and temperature sensor was built using a simple circuit shown below on a perfboard
 +
**Soldering the connections was straightforward
 +
 +
*Assembling The LCD Shield
 +
**The assembly of the LCD Shield was a matter of following the Adafruit guide <ref>RGB LCD Shield Assembly Tutorial  - [https://learn.adafruit.com/rgb-lcd-shield/assembly Assembly Tutorial]</ref>
 +
**Soldering the connections was a lot more involved and required a decent amount of time
 +
 +
*Moving The Blinds
 +
**The translation of the motor rotation into slate movement was achieved by creating an adapter connecting the motor directly to the blind adjuster as shown below
 +
**The motor was held in place using a case shown below. We use two long nails to fix the motor through in the case and glue the case on the board during demo<br />
 +
{|style="margin: 0 auto;"
 +
|[[File:FinalAdapter.JPG|300px|thumb|left|Adaptor]]
 +
|[[File:Motor_Housing.JPG|400px|right|thumb|Motor Case]]
 +
|}
 +
This is a short video of how our device is assembled and moves:<br/>
 +
[[File:DemoBlinds.mp4]]
 +
*Final Case Design
 +
**This case is able to hold all necessary components
 +
**The user interface is attached to the front of the case which contains a window for both the buttons and the screen
 +
**The back of the case features a hole for the power supply in the bottom right and a window for the sensor
 +
**The top of the case has the motor housing built into it for easy assembly
 +
**GENERAL USE
 +
***Modify the adapter to fit around the window's adjuster
 +
***Modify the length of the adapter so the case sits on the window sill
 +
{|style="margin: 0 auto;"
 +
| [[File:FinalCaseF.JPG|320px|thumb|left|Front]]
 +
| [[File:FinalCaseB.JPG|300px|thumb|center|Behind]]
 +
| [[File:FinalCaseT.JPG|300px|thumb|right|Top]]
 +
|}
 +
 +
===Programming===
 +
----
 +
The device is controlled by an Arduino Uno Board. The programming of the the device consists of three parts 1)The reading from sensors 2)The control of the motor 3)The control of the display. All the codes can be found in github<ref>Github  - [https://github.com/Liu-Xinquan/ESE205 Github].</ref>
 +
====Sensor Readings====
 +
The luminosity is measured by the photo-resistor, from which the function will read the analog input and convert to the correct voltage reading. Then based on the linearity of the photo-resistor measurement, the function uses a scale of 0 to 9 to describe the luminosity, with 0 representing complete darkness and 9 representing full daylight. The temperature sensor(TMP36) utilizes the same overall method but the voltage is converted to a more accurate result in Fahrenheit unit. In order to measure the real time temperature and luminosity more precise, both temperature and luminosity sensors will take in 1000 readings over a period of 3 minutes and use rolling average to filter out the extreme readings caused by noises in the system.<br/>
 +
[[File: ReadLight.PNG |400px|Read luminosity]]
 +
[[File: ReadTemp.PNG |400px|Read temperature]]
 +
 +
====Motor Control====
 +
The devise uses  KOOKYE 2 x 28BYJ-48 DC 5V Stepper Motor + ULN2003 Driver Test Module Board for Arduino <ref>Stepper Motor Turtoruial-[https://42bots.com/tutorials/28byj-48-stepper-motor-with-uln2003-driver-and-arduino-uno/ Motor Tutorial and Arduino Library]</ref>(The complete tutorial and library can be found in the reference). The driver and the library allow us to set the maximum speed of the stepper motor and its acceleration. The moveTo() function will set the stepper motor to the desired location in radians, with 4096 steps a full rotation. The distanceToGo() function allow us to monitor the current state of the motor and to decide when the motor has stopped running. With several trials, we found the correct location of the stepper motor, which corresponds to the angle of the slates of the blinds. After, the reading of temperature and luminosity is complete, the program will set the motor to a certain location to control the blinds, based on our experiments before. The moveTo() function gives a position of the motor relative to the position of the blinds when the power is on. As a result, we chose the completely open position as our calibrated position, which is 0 in the codes. To turn the blinds downwards, we move the motor to position 15000, and move it back to 0 if we want to open it completely. If the light is medium intense, the motor will movw to 9000, which is half open. For the button control, we let the blinds move to the current position + 5000 or -5000, so the blinds will turn up and down according to user's preferences.
 +
[[File:Motor Control.PNG|800px]]
 +
 +
====User Interface and Display====
 +
For the display and user interface, we use RGB LCD Shield Kit with 16x2 Character Negative Display-Uses Only 2 Pins <ref>RGB LCD Shield Kit Arduino Library  - [https://learn.adafruit.com/rgb-lcd-shield/using-the-rgb-lcd-shield Arduino Library and Coding Guide]</ref> The user-interface consists of a LCD screen and five buttons. Our program mainly uses the up and down buttons to open and close the blinds. The display is also used to show the temperature and luminosity.The function for the user interface in the program is userControl(), which is operated during the ten minutes interval between each reading of temperature and luminosity. As in our final project, the display will show the current light intensity and temperature during automated control. The display will show "Control" and the temperature when it's in the ten minutes interval for user to control.<br/>
 +
{|style="margin: 0 auto;"
 +
| [[File:Control1.PNG|400px|thumb|left|General Control]]
 +
| [[File:Control2.PNG|500px|thumb|right|Opening Control]]
 +
|}
 +
 
===Electronics===
 
===Electronics===
 +
----
 +
Our temperature sensor and photo-resistor are soldered on a perfboard so that it takes less space and can be easily placed near the window. Also, the temperature sensor and photo-resistor are on the different side of the perf-board, so that temperature will not be greatly influenced by the direct sunlight. All the electronics parts are connected through the another perf-board to the Arduino processor. We use a external power supply to provide electricity for the kit. Our power supplier is a modified cell phone charge so that our device can be plugged in to a any AC electrical socket and the voltage is 5V.
 +
{|style="margin: 0 auto;"
 +
| [[File:Soldering on display.jpg|200px|thumb|left|Soldering on display ]]
 +
| [[File:Size 2 of sensor.jpg|200px|thumb|center|Photo-resistor]]
 +
| [[File:Side 1 of sensor.jpg|200px|thumb|right|TMP 36]]
 +
| [[File:Perfboard.jpg|200px|thumb|right|Perf-Board]]
 +
|}
 +
[[File: Untitled Sketch 2 bb.jpg|300px|Complete diagram of the circuit]]
  
 +
==Challenges==
 +
Like any other engineer in history, our team faced several setbacks and challenges in our project, but we successfully conquered them and learned many new skills during the process.
 +
*In our original design, the motor was connect directly to the shaft in the blinds. However, after several trials, we found that the motor cannot provide enough torque to turn the shaft. As a result, we designed another mechanical set and connect it to the gear set on the blinds, so that the motor is strong enough to turn the blinds.
 +
*In our original coding, the arduino is reading temperature and luminosity simultaneously, which cause one reading interfere with the other because arduino uno only has one ADC channel and it is multiplexed in practice. The analog read cannot process two input      within a short time. To solve this problem, we separated the two reading functions so that the readings will be consistent.
 +
*The power supply has been a problem for us throughout the project. Normally, the arduino board and other electrical parts are powered by the USB port, which is connected to a computer. However, putting a laptop near our device all the time is impractical, so we use an external power, which is a modified phone charger. The electricity goes in the the VIN pin on the board to power our device.
 +
*Both stepper motor and the display draw a large amount of electricity, so when they are running together, they might behave inconsistently. To solve this problem, we put the stepper motor in parallel to the rest of the circuit and the display will be turned off when the stepper motor is operating.
 +
*There is a flashing issue for the display because the program is setting and clearing the screen in the loop constantly. To fix this problem, we create a Boolean parameter to track the state of the display. The Boolean is false once when the function is operated and will only be turned on when there is another function changing the content in the display.
 +
<br/>
 +
To tackle the challenges and the problems we met in the project, we learned several new skills:
 +
*Soldering and some circuit knowledge
 +
*Aruidno C language
 +
*CAD design and 3D printing
 +
*Wiki page editing
 +
*Stepper motor control and LCD display control
  
 +
==Results==
 +
Our project fulfills all the objectives in the proposal. The temperature sensor and photo-resistor will measure the temperature in the room and the luminosity of the light coming into the window. The results will be shown on the display. Then, based on the readings, the motor will move to the designated location in radian, which will turn the slates of the blinds to a desired angle through our gear set. However, our secondary goal, which is to create a set that will fit in every blinds set in the market, is not achieved because of the time limitation.<br/>
 +
[[File:Poster Sun.PNG|400px]]
  
 +
==Potential Project Extensions==
 +
*Improve the power supply and the stepper motor power, so the the motor can turn faster and thus close and open the blinds more quickly.
 +
*Improve the overall circuit connection, soldering,and layout the the device, so that the device can take less space and can be easier to debug.
 +
*Create an adjustable mechanical set which can fit most blinds in the market.
 +
*Add a timing or clock mechanism to the devise.
 +
*Add more user interface functions. For example, the user can choose the rotation number of the motor through button pressing or choose preferred light intensity to turn down the blinds.
 +
*Incorporate the solar elevation angle to the angle calculation so the blinds can turn to a more accurate place based on different seasons and latitudes.
 
==References==
 
==References==
  
 
[[Category:Projects]]
 
[[Category:Projects]]
 
[[Category:Fall 2018 Projects]]
 
[[Category:Fall 2018 Projects]]

Latest revision as of 16:44, 17 December 2018

Weekly Log: Smart Blinds Weekly Log
Tutorial: Multi-Input Analog Reading with Arduino Uno
Presentation
Codes and Design: Github
Poster

Proposal

Overview


The goal of this project is to create a set of blinds that is able to automatically adjust the tilting angles of the slates with real time luminosity. The blinds will also feature an timing function which will drive the blinds to open and close at certain time according to user's preference. The apparatus will contain a stepper motor to open the shades and an Arduino processor will be incorporated to measure the luminosity. In order to achieve the project goal, data obtained by the Arduino sensor will be processed and transmitted to the step motor. A temperature sensor will also be added to obtained real time temperature input, so that our device will more accurately adjust its functions. Besides, a user interface containing a LCD display and five bottoms will be incorporated to show the luminosity and the temperature and to let users to open or close the blinds as needed.

If time allows we will add these additional features:

  • timing functionality
  • design the control mechanism to work with a variety of blinds

Team members


  • Xinquan Liu (Toby)
  • Sam LaSota

TA: William Berndt Parkinson

Objectives


Electronics and programming

  • Find the position to place the temperature and luminous intensity sensor so that it will yield the most precise feedback
  • Program the Arduino to obtain the correct inputs of temperature and luminous intensity
    • Analyze the data obtained and filtered the noise in the signals
    • Transform the inputs of temperature and luminous intensity to proper outputs to the stepper motor
  • Make sure the stepper motor interact correctly with the Arduino

Mechanics

  • Build the frame and the blinds
  • Connect and test the stepper motor on the blinds
    • 3D print parts needed for connection
    • Find the correct tilting angles with regard to solar zenith angle
    • Adjust the stepper motor to obtain the right tilting angles
    • Make sure the right connection between step motor, power source, transistor, and the Arduino
  • Visually appealing setup
  • Save energy as much as possible

Expected Challenges


  • Build the frame and fit in the blinds
  • Learn the basis of stepper motor and its connection
    • Generate enough torque to tilt the slates
    • Adjust the output of motor to gain the right angle
  • Find the correlation between the temperature, luminous intensity and the proper tilting angle of the blinds
    • Probably will require many experiments and tests at different times of the day
  • Program the Arduino to collect and process the data
    • Collect precise and enough data to determine the output from Arduino to the motor
    • Filter the noise in the data so that the motor will only function when needed
    • Transform the input data to the right output signals and transmit them to the motor
  • Translate stepper motor torque into blind control using 3-d printed parts

Budget


  • Achim Home Furnishings 1-Inch Wide Window Blinds, 24 by 64-Inch, White $11.99 (provided)Amazon
  • Motor and Driver $8.59 (Amazon)Amazon
    • 28BYJ-48 DC 5V Stepper Motor
    • ULN2003 Driver Test Module Board
  • Arduino Uno $17.99(Provided)
  • Digital Light Intensity Sensor Module for Arduino UNO $5.99Amazon
  • 8RGB LCD Shield Kit w/ 16x2 Character Display(for user interface) $23.95 Amazon

Total: $38.6 (Actually spent)

Gantt Chart

SmartGantt2.JPG

Design and Solutions

Mechanics

The first step to achieving our goal of controlling the blinds with the stepper motor was to build and assemble the components properly.

  • Building The Sensor
    • The light and temperature sensor was built using a simple circuit shown below on a perfboard
    • Soldering the connections was straightforward
  • Assembling The LCD Shield
    • The assembly of the LCD Shield was a matter of following the Adafruit guide [1]
    • Soldering the connections was a lot more involved and required a decent amount of time
  • Moving The Blinds
    • The translation of the motor rotation into slate movement was achieved by creating an adapter connecting the motor directly to the blind adjuster as shown below
    • The motor was held in place using a case shown below. We use two long nails to fix the motor through in the case and glue the case on the board during demo
Adaptor
Motor Case

This is a short video of how our device is assembled and moves:

  • Final Case Design
    • This case is able to hold all necessary components
    • The user interface is attached to the front of the case which contains a window for both the buttons and the screen
    • The back of the case features a hole for the power supply in the bottom right and a window for the sensor
    • The top of the case has the motor housing built into it for easy assembly
    • GENERAL USE
      • Modify the adapter to fit around the window's adjuster
      • Modify the length of the adapter so the case sits on the window sill
Front
Behind
Top

Programming


The device is controlled by an Arduino Uno Board. The programming of the the device consists of three parts 1)The reading from sensors 2)The control of the motor 3)The control of the display. All the codes can be found in github[2]

Sensor Readings

The luminosity is measured by the photo-resistor, from which the function will read the analog input and convert to the correct voltage reading. Then based on the linearity of the photo-resistor measurement, the function uses a scale of 0 to 9 to describe the luminosity, with 0 representing complete darkness and 9 representing full daylight. The temperature sensor(TMP36) utilizes the same overall method but the voltage is converted to a more accurate result in Fahrenheit unit. In order to measure the real time temperature and luminosity more precise, both temperature and luminosity sensors will take in 1000 readings over a period of 3 minutes and use rolling average to filter out the extreme readings caused by noises in the system.
Read luminosity Read temperature

Motor Control

The devise uses KOOKYE 2 x 28BYJ-48 DC 5V Stepper Motor + ULN2003 Driver Test Module Board for Arduino [3](The complete tutorial and library can be found in the reference). The driver and the library allow us to set the maximum speed of the stepper motor and its acceleration. The moveTo() function will set the stepper motor to the desired location in radians, with 4096 steps a full rotation. The distanceToGo() function allow us to monitor the current state of the motor and to decide when the motor has stopped running. With several trials, we found the correct location of the stepper motor, which corresponds to the angle of the slates of the blinds. After, the reading of temperature and luminosity is complete, the program will set the motor to a certain location to control the blinds, based on our experiments before. The moveTo() function gives a position of the motor relative to the position of the blinds when the power is on. As a result, we chose the completely open position as our calibrated position, which is 0 in the codes. To turn the blinds downwards, we move the motor to position 15000, and move it back to 0 if we want to open it completely. If the light is medium intense, the motor will movw to 9000, which is half open. For the button control, we let the blinds move to the current position + 5000 or -5000, so the blinds will turn up and down according to user's preferences. Motor Control.PNG

User Interface and Display

For the display and user interface, we use RGB LCD Shield Kit with 16x2 Character Negative Display-Uses Only 2 Pins [4] The user-interface consists of a LCD screen and five buttons. Our program mainly uses the up and down buttons to open and close the blinds. The display is also used to show the temperature and luminosity.The function for the user interface in the program is userControl(), which is operated during the ten minutes interval between each reading of temperature and luminosity. As in our final project, the display will show the current light intensity and temperature during automated control. The display will show "Control" and the temperature when it's in the ten minutes interval for user to control.

General Control
Opening Control

Electronics


Our temperature sensor and photo-resistor are soldered on a perfboard so that it takes less space and can be easily placed near the window. Also, the temperature sensor and photo-resistor are on the different side of the perf-board, so that temperature will not be greatly influenced by the direct sunlight. All the electronics parts are connected through the another perf-board to the Arduino processor. We use a external power supply to provide electricity for the kit. Our power supplier is a modified cell phone charge so that our device can be plugged in to a any AC electrical socket and the voltage is 5V.

Soldering on display
Photo-resistor
TMP 36
Perf-Board

Complete diagram of the circuit

Challenges

Like any other engineer in history, our team faced several setbacks and challenges in our project, but we successfully conquered them and learned many new skills during the process.

  • In our original design, the motor was connect directly to the shaft in the blinds. However, after several trials, we found that the motor cannot provide enough torque to turn the shaft. As a result, we designed another mechanical set and connect it to the gear set on the blinds, so that the motor is strong enough to turn the blinds.
  • In our original coding, the arduino is reading temperature and luminosity simultaneously, which cause one reading interfere with the other because arduino uno only has one ADC channel and it is multiplexed in practice. The analog read cannot process two input within a short time. To solve this problem, we separated the two reading functions so that the readings will be consistent.
  • The power supply has been a problem for us throughout the project. Normally, the arduino board and other electrical parts are powered by the USB port, which is connected to a computer. However, putting a laptop near our device all the time is impractical, so we use an external power, which is a modified phone charger. The electricity goes in the the VIN pin on the board to power our device.
  • Both stepper motor and the display draw a large amount of electricity, so when they are running together, they might behave inconsistently. To solve this problem, we put the stepper motor in parallel to the rest of the circuit and the display will be turned off when the stepper motor is operating.
  • There is a flashing issue for the display because the program is setting and clearing the screen in the loop constantly. To fix this problem, we create a Boolean parameter to track the state of the display. The Boolean is false once when the function is operated and will only be turned on when there is another function changing the content in the display.


To tackle the challenges and the problems we met in the project, we learned several new skills:

  • Soldering and some circuit knowledge
  • Aruidno C language
  • CAD design and 3D printing
  • Wiki page editing
  • Stepper motor control and LCD display control

Results

Our project fulfills all the objectives in the proposal. The temperature sensor and photo-resistor will measure the temperature in the room and the luminosity of the light coming into the window. The results will be shown on the display. Then, based on the readings, the motor will move to the designated location in radian, which will turn the slates of the blinds to a desired angle through our gear set. However, our secondary goal, which is to create a set that will fit in every blinds set in the market, is not achieved because of the time limitation.
Poster Sun.PNG

Potential Project Extensions

  • Improve the power supply and the stepper motor power, so the the motor can turn faster and thus close and open the blinds more quickly.
  • Improve the overall circuit connection, soldering,and layout the the device, so that the device can take less space and can be easier to debug.
  • Create an adjustable mechanical set which can fit most blinds in the market.
  • Add a timing or clock mechanism to the devise.
  • Add more user interface functions. For example, the user can choose the rotation number of the motor through button pressing or choose preferred light intensity to turn down the blinds.
  • Incorporate the solar elevation angle to the angle calculation so the blinds can turn to a more accurate place based on different seasons and latitudes.

References

  1. RGB LCD Shield Assembly Tutorial - Assembly Tutorial
  2. Github - Github.
  3. Stepper Motor Turtoruial-Motor Tutorial and Arduino Library
  4. RGB LCD Shield Kit Arduino Library - Arduino Library and Coding Guide