During our 2022 lighting season, from Thanksgiving to New Years, the outside temperature ranged from -6℉ to 70℉.

When I built a new projector enclosure, I had to build it with four (!) cooling fans/vents, three on the sides and one on the top, so I could keep the temperature inside the enclosure under 100℉ at ~70℉ outside the box. At the time- I was only concerned with the projector overheating, and hadn’t considered what would happen if it got too cold. The projector’s operating temperature range is 40-100℉. Below the lower limit- I was concerned about the danger of thermal shock shattering the lamp and/or the optics when the projector was powered up. This became especially true when the temps dipped down to, and below, 0℉.

OHL 2022 Projector Enclosure

I ended up adding a portable automotive defroster into the enclosure as a heater. More information is at the bottom of this article. This is sort of a flat hair dryer like device that plugs into a 12v car outlet. It was just the right size to fit in above the projector. I rigged it up to a 12v PSU and set that up to be controlled via FPP. I also added switches to the fans so I could manually turn them on and off as-needed. Finally- I added a remote-read thermometer to the enclosure so I could monitor its temperature from inside the house.

Defrost heater used to heat the enclosure.

This manual temperature control system worked well, but I had to be sure to keep an eye on the temperatures inside and outside of the enclosure, and manually toggle the fans or heater on as-needed. As y’all know by now- I like to automate everything! So, for 2023 we will be running two projectors with automatic heating and cooling for their enclosures.

Some more details of how the projector enclosures are built can be found here. I’m re-designing the original, and then duplicating it for the 2nd one later this year, and will post some kind of a build update when that’s done. For now- I wanted to cover the control system I built for them. This can be use for projector enclosures, controller boxes, or anything else that needs to be kept at a reasonable temperature while operating outside. Of course you can adapt it to your own needs. 😊

First, hardware-wise I will be using the same fans and heater. I’m establishing a single heating stage, and two cooling stages. Cooling stage 1 “Fan 1” will be the side vent fans, and cooling stage 2 “Fan 2” will be the top vent fan. My hope is that by thermostatically controlling these three stages, we can keep the projector as close as possible to its operating temperature range.

We use a Raspberry Pi running FPP for each projector. This provides projector control via a USB to Serial cable, and a virtual matrix/video feed via HDMI. I want to use the same Raspberry Pi to control the heater and fans. So…

First, we need a way to measure the temperature. The Raspberry Pi has a CPU thermal sensor, but obviously that doesn’t give us a very good picture of the external temperature. Any on-board sensor will not be very accurate because many of the components on the board produce their own heat. I looked at various analog and digital temperature sensor options, and decided the best thing to use would be a DS18B20 “1-Wire” digital temperature sensor. These are cheap, readily available, and very well-documented. It is very easy to use them with a Raspberry Pi.

They are packaged like transistors. You can also buy them as complete “temperature probes”, but that just adds unnecessarily to the cost. I found the following article helpful for wiring the DS18B20 to the Raspberry Pi and configuring it. Just skip over the LCD display portion of it.


Basically you just need to wire 3v3 to leg 1. Leg 2 is the 1-Wire IO, which by default needs to go to GPIO4 on the RPi. Leg 3 is ground. You also have to add a 4.7㏀ pulldown resistor between Leg 2 and Leg 3. Internal pulldowns on the RPi won’t work. I just soldered jumper wires and the resistor to the legs per the diagram, wrapped the bare wires with Kaptan tape, and covered with shrink tub to make a durable little temperature sensor that I could tape or mount inside the enclosure. The wiring diagram and a picture of the prototype is later in this post. Once you have it hooked up, you need to…

Edit /boot/config.txt and add the following to the bottom:


Edit /etc/modules and add the following to the bottom:


Then reboot.

To read the temperature, you need to look in /sys/bus/w1/devices/ for a folder named for the DS18B20’s 1-Wire serial number. You will find a file called “temperature” there, that contains the ℃ temperature 1/1000ths. So, for example: /sys/bus/w1/devices/28-3c43e38183cb/temperature. This is a virtual file- reading it will query the DS18B20 for the current temperature and return it. Multiplying the returned value by 1000 yields the temperature in ℃, so 25426 => 25.426℃

So, now we have a temperature sensor and we can read the temperature. Now- we need to control the heater and fans…

You can use almost any logic-level input relay board for this. I had a bunch of these in-stock and decided to use them:

A MOSFET is a solid-state DC relay, and for our needs these will work great. They are opto-isolated and designed specifically for 3v logic triggering from a Raspberry Pi, Arduino, Node-MCU, etc. So, there is no need for a logic level converter or any other hardware.

I decided to wire these as follows:

Pin 36 (GPIO16) = Heater
Pin 38 (GPIO20) = Fan1
Pin 40 (GPIO21) = Fan2

The IO is completely isolated from the power circuits. The MOSFETs can switch anything from 5-36vdc at up to 15A continuous. They can spike up to 30A, or run at 30A with supplemental cooling. In our case, we are just using 12vdc, as our fans and heater are all 12v. Since the heater is 13A, I am going to keep an eye on that relay as I might still want to add heat sinks to the chips. I do have some higher-current MOSFETs salvaged from a 3D printer too, if I need to bump it up, or can swap it out for a conventional relay.

I then set these up in FPP as Channel Outputs so I can control them with FPP, and using a script later:

To control the outputs via a script, I also needed to add them as Pixel Overlay Models too:

At this point- I can turn the fans and heater on and off using simple FPP scripts that toggle the Pixel Overlay Models. The goal, of course, is to completely automate it though, so…

I wrote a “thermostat.php” script that does just that. You can download it from GitHub here: https://github.com/neowolfwitch/fpp_scripts/tree/master/2023

The script is well-documented. You just need to edit it according to your own configuration and needs, and set it to automatically start on-boot in FPP, using the UserCallbackHook.sh script that you can install through the FPP Scrip Repository. This is documented in my script.

By default (as written), it polls the temperature probe every 30 seconds, then…
Fan 1 (side vent fans) is turned on at 30℃ (86℉) and above.
Fan 2 (top vent fan) is turned on at 35℃ (95℉) and above.
The heater is turned on at 4℃ (39℉)and lower.

Here is a diagram of how everything is hooked up for this:

OHL Thermostat System Diagram

And here is the prototype:

OHL FPP/Thermostat Prototype

I built it upside-down from the diagram. Also- the wire colors are not the same. The temperature probe is right next to the RPi, with the sensor itself hanging off the edge. I tested this using ice, freeze spray, and various heat sources and it works as-expected. This will get installed in the new 2nd projector enclosure, and the Raspberry Pi for the 1st one will get loaded up with the same components and scripts.