Smart Blinds

From ESE205 Wiki
Jump to: navigation, search

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