[Today’s temperatures are set to reach a whopping 38ºC/101ºF degrees in the UK, and none of us know what to do with ourselves. This doesn’t happen here and we have nothing prepared: we live in a society devoid of air conditioning, and we’re are unable to comprehend weather conditions more friendly than a slight chill and drizzle.

I can’t handle it. I have desk fan, but it’s in a cupboard somewhere, covered in dust and sadness. My local corner shop is already out of ice pops and ice cube trays. And anyway, I believe the tarmac on the road outside my house has melted and will suck down anything that dares step or drive on it.

I think I’m melting too. I feel sloshy, and, while I’m not 100% sure this is scientifically possible, I believe I may be partly barbequed. If someone presented me at a restaurant, I would probably be described as medium rare.

So yes, it’s hot. Very hot. It only makes sense that we share a Raspberry Pi project that fits with this theme: here’s an article from the latest issue of The MagPi magazine, out today, that shows you how Ishmael Vargas built his own smart fan for his home in hot and humid Chicago.

It’s a very clever idea, and one we wish we’d thought up ourselves before today’s sudden heatwave/opening of the Hell Mouth.

Enjoy — Alex]

When you need to keep your home cool during the summer months, a smart window fan could be just the thing.

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 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.”

Viewable via VNC on a smartphone, the program window features temperature data and control buttons.

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.

Weather report

To keep things simple, Ishmael opted to source the outdoor temperature from (The Weather Channel) using the pywapi Python library, rather than wiring up an external sensor. “The temperature provided by as compared to the temperature in my car could differ 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.”

A smart WiFi socket is used to turn the window fan on and off.

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 the 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

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 DHT22 sensor is connected to power, ground, and GPIO 4 pins on a Raspberry Pi Zero — a 10kΩ resistor is recommended.

“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.

You should read The MagPi magazine

The latest edition of The MagPi magazine is out today, packed full of Raspberry Pi goodness. If you’re new to The MagPi magazine, welcome! As with all publications produced by Raspberry Pi Press, today’s new issue is available as a free download on The MagPi website, as well as in physical form from your local newsagent, the Raspberry Pi Store in Cambridge, or the Raspberry Pi Press online store.

Subscribers to The MagPi magazine get discounts and free stuff, and anyone purchasing any of our publications with actual currency will help fund the production of the magazine as well as the charitable work of the Raspberry Pi Foundation.


Dave avatar

“we’re are” I guess brain overheated on that one. LOL

Janina Ander avatar

Your corect.

Monte MacDonald avatar

“You’re” LOL

Liz Upton avatar


W. H. Heydt avatar

While you have my sympathy (we’ve had a few 100+F days where I live this year), I’ve been out and about in temperatures up to 122F. And, no, it wasn’t Death Valley.

So….hydrate, hydrate, hydrate. If you’re not peeing regularly, you’re being dehydrated. And remember that high humidity makes it *much* worse, which is a big part of why high heat is a much bigger problem on the US East Coast, than in the West. Where I live, about 35 miles NE of San Francisco, when the temperatures go up, the humidity goes down.

Liz Upton avatar

Ah, but Hal – we are TOTALLY UNEQUIPPED for this, unlike you lucky Californians with your air-conditioning-as-standard and car culture. I had to walk a few miles for errands yesterday in 39C heat, which nearly killed me; and when I finally got home it was 29.8C in the bedroom and wouldn’t go down even with open windows and fans.

JBeale avatar

If you have a fan and some damp towels you can do a makeshift “swamp cooler” (google can tell you more) but this works best in low humidity. If the humidity is already high, nothing to do but find a cave somewhere…

Alex van der Hoek avatar

What Liz says! Us cloggies got caught in the same wave. 41.5 outsied, my sensors read 42+ in the shade but near the wall. Still 27 inside even though it’s cooled down to normals again outside. buildings dont / do not / don’t cool down! pffffff.

Great read here Alex, thanks. Have done this the other way around long time ago to get mote out of the heating… oh well now we know… bring it on 2020! :P

Paul Webster avatar

Maybe try underclocking some of those desktop RPi4 systems ;)

charles avatar

s a v a g e

Andrew avatar

Saw earlier on the news that Cambridge set a new July highest temperature record for the UK of 38.1C today! Glad I bought a portable air conditioning unit a few years ago, and it has only been up to 26C where I am.

Neil avatar

Come to Australia, ya wooses! We cook eggs on the tarmac for breakfast.

Mark Speir avatar

It’s a common question asked of Americans about our obsession with A/C. This is a normal summer’s day over here across the pond. Imagine MONTHS of that kind of heat! Now do you guys understand? ;)

Alex Bate avatar

Yes, but you’re used to it. You’re prepared. We are not. We are so very not.

Arthur Fieldstone avatar

Tough luck, Alex. I’d trade a typical summer day here in Texas with you any day, though. Granted, we have air conditioning… sometimes.

Milliways avatar

Sounds like a pleasant summer day! Enjoy it.

Harry Hardjono avatar

Does your car have AC? Try sleeping in the car. :) Or maybe try one of those evaporating cooling thingy. Wrap a wet micro towel. Or just wear a wet thermal underwear,
assuming you don’t mind leaving water prints anytime you sit down.

I tried one of those redneck cooler, which is ice box + ice + fan, but was not too successful with that.

Harry Hardjono avatar

I was reading the Magpi about Raspi4 and noticed video editing is missing. I think that Non Linear video editing would be great for Raspberry Pi 4. It’s got the CPU, memory, and bandwidth. Also consider that you have dual monitor and official video camera, I think you just need a usb microphone to complete the whole set.

I’m thinking MLT editor, OpenShot, Audacity should do the trick, as you already have VLC.

So far, all my video edits have been DVD resolution, but I think Raspi4 can handle HDTV resolution now.

Are you planning to do an article feature on it? Preferably with YouTube live streaming option. :)

JBeale avatar

Years ago I did a lot of video editing and had to use Windows because there wasn’t anything viable on Linux. I recently tried out Kdenlive from and it worked OK for a super-simple project. That was on a Intel-based MiniPC Linux box, have not tried on a Pi. Video editing with multiple HD tracks has to be one of the most demanding tasks for hardware.

Anders avatar

That Cambridge temperature is now revised to 38.7C so 101.6F.
With the high humidity and using the hot weather equivalent of windchill it was feeling like 45C.

Us unacclimatised folk really don’t like temperatures high than our core body temperatures – because fans become unaffective. I was delighted with the thunderstorms that follow and the rain this morning.

Harry Hardjono avatar

JBeale Did you do it with proxy editing? Pretty sure KDEnlive has that. I know MLT has that.

Linux Handbook avatar

I guess my RPi4 is contributing to the already increasing temperature :)

Comments are closed