An electric fan is perhaps the most popular appliance that cools people down during hot summer days and nights.
In fact, an electric fan does not physically make the air in the room cooler. It's "wind chill" that creates the cooling effect. On a hot day, people’s bodies sweat to lose heat through the evaporation of the sweat. If the air inside the room is still, that evaporation causes the air layer that is surrounding your skin to research body temperature and 100% humidity, therefore the process becomes inefficient and you suddenly feel hot and sweaty. An electric fan helps to replace this hot, humid air layer with cooler, drier air that allows for more evaporation — thus essentially cooling your body down.
In this instructable, we will see how can we turn a good old electric fan into a smarter one! We already know that cooling effect can only be felt when it directly blows away hot air from one’s skin. Therefore, we only need our fan to blow air when people are present in the room. To achieve this, we can use the PIR sensor to detect motion or set a time schedule when the fan should operate (for example, during working hours). Also, for higher convenience we will make our fan remotely controllable via a mobile app.
Why do you need a relay?
We will use a relay to control a high power device (in this case, our fan) with a much smaller power input from the Raspberry Pi GPIO pins.
How to wire the scheme?
Refer to the scheme shown above. You should connect 5 pins on the Relay module as following:
To test if you wired everything correctly, open Prota GPIO app and click on the pin 18. Select operation mode as "OUTPUT", then write 1 in the input field and click "write". If everything has been wired correctly, the fan should start spinning.
PIR sensor can be used to turn the fan on when there's motion at your desk. Use it, if you want to turn the fan automatically whenever you sit at your desk.
To start the fan automatically whenever you appear at your desk, write the following Story:
"When GPIO pin detects falling interrupt on 21, write 1 to the GPIO pin 18."
To set up time schedules, use time as your Story sensor:
"When time is at 18:00 on weekday, GPIO writes 0 to the pin 18".
Let's say you are working from a co-working space and you want to be updated if someone else is using your fan / sitting at your desk, then write the following Story to receive an email notification:
"When GPIO Pin 1 writes at 18, firstname.lastname@example.org sends a message to email@example.com".