Geomagnetic Observatory - Part 2
Is 60 Watts of heat enough to keep a Raspberry Pi warm in winter?
The objective of this project is to set up a mini observatory (a small, affordable system of collecting data about the local magnetic field), but I am going to go off on a bit of a tangent with this post. The thing about measuring the earth’s magnetic field is that there are many sources of interference around the house: appliances, electric motors, vehicles, electronics, and computers. Consequently, I wanted to start the project by ensuring that it would be located as far away from any interfering magnetic fields as possible. I will talk about how I tried and possibly failed to put together an outdoor enclosure for running a Raspberry Pi out in the cold.
How to keep it warm?
Nearly all an incandescent bulb’s energy is converted into heat, so why not use one to freeze proof the project box?
Calculate Stuff¶
It has been a long time since I have taken a Heat Transfer course, but thanks to google I found a formula that seems vaguely familiar. This is for one dimensional heat conduction through a material of some thickness, s. This formula can be found here.
${q} = {A}*\frac{k}{s}*\Delta{T}$
- k: A quick google search reveals that the thermal conductivity for ABS plastic is about 0.14 W/m-K.
- s: I’m estimating the thickness to be about 1/8” or roughly 3mm.
- A: Surface area can be calculated with the following formula for a rectangular prism.
${A} = 2*({l}*{w}+{w}*{h}+{l}*{h}) $
- l: 8 inches ---> 0.2032 meters
- w: 6 inches ---> 0.1524 meters
- h: 4.25 inches ---> 0.10795 meters
${A} = 0.1387094 m^2$
- $\Delta{T}$: I want to maintain a temperature of 30 degrees Fahrenheit, as that is the low end on the specifications for the Raspberry Pi. I will plan for a lowest ambient temperature of 0 degrees F so the temperature difference is going to be 30 degrees F, but in order to find the temperature difference in Celsius or Kelvin, we have to convert the nominal 30F and 0F before doing the subtraction. This will yield a ∆T of 16.67 C or K.
Quick Calculation¶
I need to figure out how many watts of heat are required in order to keep the box warm. Using the one dimensional formula above, I'll try to estimate the heat requirement.
import matplotlib.pyplot as plt
def q1d_calc(A, s, k, Tin_F, Tout_F):
Tin_C = (Tin_F - 32) * (5/9)
Tout_C = (Tout_F - 32) * (5/9)
dT = abs(Tin_C - Tout_C)
q = A * (k/s) * dT
return q
A = 0.1387094 # area in square meters
s = 0.003175 # thickness in meters
k = 0.14 # thermal conductivity in W/m-K
Tin_F = 30 # internal temperature in deg F
Tout_F = 0 # external temperature in deg F
q = round(q1d_calc(A, s, k, Tin_F, Tout_F), 3)
print("q = " + str(q) + " Watts")
q = 101.939 Watts
How many Watts required?¶
For my required temperature difference of 30 degrees Fahrenheit, I have an estimate of 101.939W for the enclosure.
Temperature Test - Light Off. Can the Pi keep itself warm?¶
I performed this first test to see if the Raspberry Pi could keep itself warm, without any help from an external heat source. The Raspberry Pi’s documentation states that its operating range is between 0 degrees Celsius and 70 degrees Celsius. The coldest average temperature for Anchorage in January is about 14 degrees Fahrenheit, slightly below the operating range.
I let it run for about an hour in the enclosure outside and it got cold fast. The final ∆T was around 5 degrees Fahrenheit. This is likely not enough to keep the operating temp of the Pi above freezing on the coldest days.
#Get the temperature data, copy pasted from excel sheet. Plot here in jupyter notebook.
import pandas as pd
df0 = pd.read_clipboard(parse_dates=[0], header=0)
fig, ax = plt.subplots()
ax.plot(df0['Time'], df0['External T'], marker='o', label='Tout_F')
ax.plot(df0['Time'], df0['Internal T'], marker='o', label='Tin_F')
ax.set_ylabel('Temperature (deg F)')
ax.set_xlabel('Time')
ax.legend()
<matplotlib.legend.Legend at 0x23f543b2248>
Tin_F = 32 # internal temperature in deg F
Tout_F = 26.7 # external temperature in deg F
q = round(q1d_calc(A, s, k, Tin_F, Tout_F), 3)
print("q = " + str(q) + " Watts.") #Generated by raspberry pi with the light bulb off.
q = 18.009 Watts.
The actual Wattage would have been lower because the temperature was still dropping at the end. I stopped it early because the Pi had reached the low end of its operating temperature and I didn't want to push it further.
Temperature Test - Light On (60W Bulb)¶
I did not want to drill more holes in the enclosure yet, so I decided to use some electrical tape to secure the bulb in what seemed like a safe place. I did have some concerns about the bulb touching the wires as I felt there could be enough heat to melt their insulation. I plugged in the Raspberry Pi and light bulb and set it down in the corner of the deck in some snow. I could tell right away that the bulb was giving more than enough heat. It was a bit warmer outside than usual, around 31 degrees Fahrenheit, and I had hoped to do this on a colder night but decided to proceed as I am only looking for a temperature difference.
#Get the data from the light-on test. Copy from Excel sheet.
df1 = pd.read_clipboard(parse_dates=[0], header=0)
fig, ax = plt.subplots()
ax.plot(df1['Time'], df1['External T'], marker='o', label='Tout_F')
ax.plot(df1['Time'], df1['Internal T'], marker='o', label='Tin_F')
ax.set_ylabel('Temperature (deg F)')
ax.set_xlabel('Time')
ax.legend()
plt.annotate(xycoords='figure pixels', xy=(180,150), text='steady state reached', rotation=30)
plt.annotate(xycoords='figure pixels', xy=(350,180), text='is it on fire?', rotation=80)
Text(350, 180, 'is it on fire?')
Right away I saw the temperature difference is more than I had calculated; about 1.5 times more. While monitoring the temperature, it had reached a point where I estimated that the enclosure had reached a steady state. I decided to give it a few more minutes and then suddenly the temperature jumped by more than ten degrees. I got worried and ran outside to unplug everything.
What happened?
I brought it inside and immediately filled the house with the smell of melted plastic. I could feel a headache coming on, so I opened the doors and windows while I opened the box to see what had happened.
It appears that the electrical tape used to secure the bulb lost some of its adhesiveness and the bulb dropped down onto the mounting plate, melting the plastic. I think that if the bulb would have been more securely mounted in the enclosure then it probably would have not failed.
How I mis-applied the heat transfer equation
But why was my estimate for the required wattage (101.98) so high? I think the answer to that is in the definition of the temperature difference used in the calculation. This should come from the difference between the inner and outer surfaces of the plastic box, not the difference between the inner and outer ambient temperature. The temperatures in the equation are referring to the surface temperatures! I do not currently have a way to measure the surface temperatures, but when I picked up the enclosure during the experiment, I could feel it was much warmer than the ambient temperature outside. Therefore, the delta T would be much lower than the delta T that I used for my estimate which would give a much lower wattage requirement. Basically, I did not take into account the heat transfer that has to happen from the surface of the enclosure to the cold, ambient air.
Safety
Taking a step back however, I can see that having a heat source, along with 110V exposed contact points in such a small enclosure is not something that I would want to leave unattended for any amount of time, even outdoors. Safety should be the biggest concern, so I will plan to continue this project in the garage (without a lightbulb) where the temperature is controlled, despite the possibility of interference. (Spoiler for future post: the garage is full of magnetic interference, and I am currently trying to find a better place for it to live.)
Conclusion
To answer the question posed in the title of this post: Yes, 60W is more than enough to keep a raspberry Pi warm outside in freezing temperatures but it is not a good idea to put the lightbulb so close to the electronics, especially inside a plastic enclosure. I think my next step would be to build a medium sized bird-house like box. In my next post however, I will get to the fun part and show how I learned to communicate with the RM3100 sensor (the core of this project).
In the mean time, I would love to hear from the professionals out there - do you have experience designing control boxes or enclosures to withstand cold temperatures? Leave a comment on my LinkedIn post or feel free to reach out directly.