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.

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.