Smart Window Fan
By Lucy Hattersley. Posted
When you need to keep your home cool during the summer months, a smart window fan could be just the thing. Phil King enjoys a breath of fresh air
Advertisement
Get started with Raspberry Pi – everything you need to know to start your journey!
Summer days, and nights, can be uncomfortably hot and humid in the Chicago area. As the sun goes down, the outside temperature drops, but homes may remain hot. This is where a Raspberry Pi smart window fan comes in useful, blowing cooler air into the house.
Last summer, Ishmael Vargas was using a small window fan upstairs and, after turning it on in the afternoon, he found he had to get up in the middle of the night to turn it off. “That is when I thought there must be a better way to control this fan,” he recalls, “and I started putting this project together.
See also:
Raspberry Pi Smart Window Fan
As he was already using a DHT22 temperature and humidity sensor for another project, he opted to use that, connected to a Raspberry Pi Zero running a Python program, to monitor the room temperature. This is then compared with the external temperature; if the latter is cooler, the window fan is turned on via a smart WiFi power plug (TP-Link HS100) – a much simpler method than wiring the fan up to a relay.
Watching the weather report
To keep things simple, Ishmael opted to source the outdoor temperature from Weather.com (The Weather Channel) using the pywapi Python library, rather than wiring up an external sensor. “The temperature provided by Weather.com as compared to the temperature in my car could differentiate by one or two degrees.
This is close enough for this project,” he explains. “In other parts of the world or rural areas where they do not have as many weather stations, an outdoor sensor might be required.”
One issue he discovered was that in the early morning, the fan could end up blowing warm air into the house. “Depending on the size of the fan, the size of the room, and house materials, the inside temperature might never be as cool as outside,” he says. “For example, if the temperature outside is 65 °F (18°C), the temperature inside might only drop to 67 °F (19.5°C) through the night. As the temperature outside starts to climb, you want to keep the fan off.” This resulted in him adding an ‘inhibit’ mode to turn the fan off at 6am.
Remote control smart fan
Rather than having the fan program run automatically on bootup, Ishmael opted to start and control it manually via an Android smartphone. The latter runs the VNC Viewer app, enabling remote access to Raspberry Pi’s desktop, on which there is a shortcut to start the fan application; this then displays a Pygame window with temperature information and control buttons.
“The fan application has two buttons to change the [desired temperature] set-point up or down,” reveals Ishmael. “Also, the button on the upper right is to close the application and return to the desktop.” His aim is to have more than one project running on his Raspberry Pi, and have a desktop shortcut for each application.
While the original project used a single fan, he has since modified it to add another. “I have been reading that two fans are required for best performance,” he says. “One to blow in and another to blow out.”
This certainly is a cool project, in more than one way. If you’d like to have a go at building a similar system, you can read Ishmael’s Hackster guide and check out his GitHub repo for the code.
Lucy is Editor of Raspberry Pi Official Magazine.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Get started with Raspberry Pi in Raspberry Pi Official Magazine 161
There’s loads going on in this issue: first of all, how about using a capacitive touch board and Raspberry Pi 5 to turn a quilt into an input device? Nicola King shows you how. If you’re more into sawing and drilling than needlework, Jo Hinchliffe has built an underwater rover out of plastic piping and […]
Read more →
Win one of three DreamHAT+ radars!
That’s right, an actual working radar for your Raspberry Pi. We reviewed it a few months ago and have since been amazed at some of the projects that have used it, like last month’s motion sensor from the movie Aliens. Sound good? Well we have a few to give away, and you can enter below. […]
Read more →
RP2350 Pico W5 review
It’s Raspberry Pi Pico 2, but with a lot more memory
Read more →

