8.7 Installing the Hardware

When setting up the sensors, you can leave them seated in the small breadboard we used during the testing of the Curtain Automation sketch. I used a piece of foam double-sided tape to keep the breadboard seated in place, with the sensors pointing toward the window like a high-tech flower box. Also, the stepper motor tends to get very warm when in use, so as an added safety precaution, be sure to mount the motor away from anything flammable. For example, make sure the stepper motor is mounted away from the curtains or shade that you’re opening and closing!

Measure the distance from the breadboard sitting on the windowsill to where you want to place the Arduino+motor shield. The Arduino can be mounted on a table, in an enclosure, or even on the wall if you prefer. I recommend using an extra foot or two of wire wrapped in a loop just in case you need to relocate the Arduino later. Also take into account the placement of the 12V power supply brick and the electric cord that has to plug into the Arduino to power the Arduino, the motor shield, and the stepper motor.

/epubstore/R/M-Riley/Programming-your-home//images/curtainautomation-finalassembly-done.jpg

Figure 35. Curtain Automation, installed and calibrated

Slip the rubber-grooved pulley wheel onto the stepper motor shaft. Loop the curtain drawstring around the pulley wheel. Pull the stepper motor down until the drawstring is taut around the pulley wheel. Before permanently mounting the stepper motor, attach the four angle brackets to it using double-sided foam tape. The tape will keep the motor in place while you screw in the mounting brackets. The foam tape will also help dampen vibrations against the wall and keep the operation quiet when the stepper motor shaft is operating. You may also want to affix the stepper motor first to the wall, using tape to hold it in place, just to be sure that the curtain drawstring isn’t looped too tightly or too loosely around the pulley attached to the stepper motor shaft. Don’t make the string too taut in case you need just enough slack to allow for recalibration should the string happen to slip when the pulley spins.

Perform a few tests before screwing the angle brackets to the wall. This will verify that the drawstring around the pulley has just the right amount of tension and friction to be pulled by the rotating pulley when the stepper motor runs. When you’re satisfied with the placement of the stepper motor, screw the four angle brackets into the wall.

Calibrate the speed and number of revolutions that the stepper motor needs to make to fully open and close the curtains. Start in small increments at first, remembering to apply the same number of revolutions in both clockwise and counterclockwise directions. You can estimate the number of revolutions needed to draw the curtains open and closed by measuring the distance that the drawstring moves with each revolution of the pulley. Divide this by the total distance that the curtains need to move to completely open and close. This will give you the total number of stepper motor shaft rotations you need to program to open and close the curtains.

  ​Distance curtain moves with one stepper motor shaft rotation = 5 centimeters​
  ​Total distance curtain needs to move from start to finish = 90 centimeters​
  ​90 cm / 5 cm = 18 rotations​

When the system is perfectly calibrated, mark the drawstring with a felt marker at the points where the string meets the pulley when the curtains are opened and closed. This will help should you need to recalibrate the drawstring if it falls out of sync over time. Once configured, your setup may look like Figure 35, Curtain Automation, installed and calibrated.

Test the system a few times by covering the photocell and artificially heating the temperature sensor with your breath or a blow dryer. Observe when the photocell triggers the curtain opening and closing events. If it’s too sensitive or opens the curtains as a result of indoor light reflecting off the glass, you may need to reposition the photocell in a different location. I taped the sensor to a corner of the window using black electrical tape. This helped minimize the sensor from being exposed and reacting to indoor room lighting.

Allow the assembly to run a few days, noting when the curtains should react to light or temperature triggering the sensors. Alter the temperature and light sensitivity values accordingly. Once everything is set up correctly, you should only need to check on the curtain string’s position once every couple of weeks for any recalibration adjustments. After a while, you will simply take the autonomous curtains for granted. Visiting guests seeing the curtains in operation for the first time will be amazed by your high-tech handiwork.

Programming Your Home
cover.xhtml
f_0000.html
f_0001.html
f_0002.html
f_0003.html
f_0004.html
f_0005.html
f_0006.html
f_0007.html
f_0008.html
f_0009.html
f_0010.html
f_0011.html
f_0012.html
f_0013.html
f_0014.html
f_0015.html
f_0016.html
f_0017.html
f_0018.html
f_0019.html
f_0020.html
f_0021.html
f_0022.html
f_0023.html
f_0024.html
f_0025.html
f_0026.html
f_0027.html
f_0028.html
f_0029.html
f_0030.html
f_0031.html
f_0032.html
f_0033.html
f_0034.html
f_0035.html
f_0036.html
f_0037.html
f_0038.html
f_0039.html
f_0040.html
f_0041.html
f_0042.html
f_0043.html
f_0044.html
f_0045.html
f_0046.html
f_0047.html
f_0048.html
f_0049.html
f_0050.html
f_0051.html
f_0052.html
f_0053.html
f_0054.html
f_0055.html
f_0056.html
f_0057.html
f_0058.html
f_0059.html
f_0060.html
f_0061.html
f_0062.html
f_0063.html
f_0064.html
f_0065.html
f_0066.html
f_0067.html
f_0068.html
f_0069.html
f_0070.html
f_0071.html
f_0072.html
f_0073.html
f_0074.html
f_0075.html
f_0076.html
f_0077.html
f_0078.html
f_0079.html
f_0080.html
f_0081.html
f_0082.html
f_0083.html
f_0084.html
f_0085.html
f_0086.html
f_0087.html
f_0088.html
f_0089.html
f_0090.html
f_0091.html
f_0092.html
f_0093.html
f_0094.html
f_0095.html
f_0096.html
f_0097.html
f_0098.html
f_0099.html
f_0100.html
f_0101.html
f_0102.html
f_0103.html
f_0104.html
f_0105.html
f_0106.html
f_0107.html
f_0108.html
f_0109.html
f_0110.html
f_0111.html
f_0112.html
f_0113.html
f_0114.html
f_0115.html
f_0116.html
f_0117.html
f_0118.html
f_0119.html
f_0120.html
f_0121.html
f_0122.html
f_0123.html
f_0124.html
f_0125.html