Adding the Sensors

It’s time to combine the working stepper motor with the photosensor we used in the Chapter 5, Tweeting Bird Feeder project. Photosensor readings will be taken every second, and depending on the outdoor light levels, they will trigger the stepper motor to open or close the curtains. We will also add a temperature sensor so that we don’t open the curtains if it’s already too warm in the room or so that we close the curtains if the room temperature exceeds a predetermined level.

Fortunately for this type of project, which relies on the analog pins to measure light and temperature, the motor shield does not use any of the Arduino’s analog pins. Therefore, we will attach one lead of the photocell to the 5V power pin and the ...

Get Programming Your Home now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.