Programming Blog

Jeremy Morgan

Mostly Coherent Ramblings of a Silicon Forest Software Developer

Does Dry Ice Really Cool Five Times Better Than Regular Ice?

I saw an advertisement for dry ice claiming it cools 5 times better than wet ice. Out of curiosity I had to know if this were true, or at the very least see how much better dry ice performs. I thought I’d gather up a Raspberry Pi and some sensors and find out, using some techniques from my Hands on Internet of Things course released recently.

I’m sharing what I found here and showing how you can replicate the experiment.

Dry Ice ws Wet Ice

What Does 5 Times the Cooling Power Mean?

This is the first thing I wondered. Does it keep it 5 times colder? Does it keep it cool 5 times longer? The claim is still a bit unclear, but based on my results it appears it keeps it close to 5 times colder, for about the same amount of time.

What I did was take a couple coolers, filled one with Dry Ice and one with wet ice, sealed them up and measured them for a few days.

Take a look at our graph:

Dry Ice ws Wet Ice Click here for a detailed view

I did a minute by minute sampling, and perhaps unsurprisingly the first minute was the coldest. at that point:

Dry Ice ws Wet Ice

Our dry ice was at -111.775 degrees Fahrenheit, and the wet ice was at 26.2634. This is closer to around 4 times colder. But does it keep it cold longer? Not really. Actually if you look at the drop off wet ice actually kept it colder than the room temperature for a while longer, but the difference is small:

Dry Ice ws Wet Ice

This was over the course of a few days, and as you can see they converge toward the end but the wet ice still keeps cool a bit longer. I’m assuming this is because the dry ice disappears. Here are some basic conclusions I derive from this data:

  • Dry Ice Keeps Items Significantly Colder For a couple days, the temperature was around 4 times colder in the Dry Ice cooler.
  • Dry Ice Has a Pretty Significant Drop Off. From -80 to 0 degrees in about 8 hours. Wet ice only got 1.5 degrees warmer in this same amount of time.
  • Both Methods Cool for Roughly the Same Amount of Time - I expected the wet ice to stay cool for hours, not days. Although it is much warmer by comparison it lasted just as long.
  • Dry Ice Is Probably Overkill - Most of the things people put in a cooler dont need to be -90 degrees. Soda, beer or sandwiches are probably just fine at 32 degrees.

When I started this project I assumed that dry ice would be much colder, for much longer. I can’t draw a ton of conclusions from this experiment just yet. I’m definitely going to run a few more just like it.

I measured the air temperature as well, but since one of the sensors was faulty the data is bad.

If you want access to the data here is the dataset. I’ll surely do more with it in the future. Now, here are the details for how I set it up.

Setting up the Project

Dry Ice ws Wet Ice

To set this up you’ll need:

I wired these sensors together in a somewhat crude fashion, but you may want to do something nicer like a junction block or something.

What I did for each sensor was grab the serial number and label it so I knew which sensors I was reading:

Dry Ice ws Wet Ice

And placed each of them in the cooler. I had one at the top of each cooler, and one at the bottom, and one sensor out in the open air to measure room temperature.

Setup the Pi with the DSB1820 Sensors

First we need to get the pi ready for the DSB1820 sensors. To do that we will set up our one wire support.

Open up your boot config (by typing sudo nano /boot/config.txt) and add the following line:

1
dtoverlay=w1-gpio

Then reboot the pi (sudo reboot). After rebooting, type the following:

1
2
3
4
sudo modprobe w1-gpio
sudo modprobe w1-therm
cd /sys/bus/w1/devices
ls

It should look like this:

Dry Ice ws Wet Ice

Now what you’re seeing here is a set of directories, one for each sensor. To make sure they all work, cd into each directory and check them with the following command:

1
2
cd 28-XXXXXXX (your serial number)
cat w1_slave

It should look like this:

Dry Ice ws Wet Ice

the YES means it works. If you’re following along and just want to check all 5 really quick use this script :

https://github.com/IoT-Projects/SuperCool/blob/master/checksensors.sh

It will go through all your sensors and check them.

Now, let’s write a script to grab the values.

Script to Read Temperature Values

For this we will use Python, and this script will read the values from the sensors that come out of that folder we were in earlier.

For a lot of this first part we will lift some code from Adafruit and make it our own. Put this at the top of your script:

1
2
3
4
5
6
7
8
9
import os
import glob
import time
import subprocess

os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')

base_dir = '/sys/bus/w1/devices/'

This is what you’ll need to get started reading the sensors.

Next, you’ll need to create a list of serial numbers from your devices. Yours will be different from mine.

1
sensor = ('28-0115649279ff','28-011564966aff','28-011564d991ff','28-01156492b9ff','28-011564c7a9ff')

Next, we’ll create a function to read the temp in raw mode:

1
2
3
4
5
6
7
8
9
10
def read_temp_raw(sensor):

    device_folder = glob.glob(base_dir + sensor)[0]
    device_file = device_folder + '/w1_slave'
    catdata = subprocess.Popen(['cat',device_file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    out,err = catdata.communicate()
    out_decode = out.decode('utf-8')
    lines = out_decode.split('\n')
    return lines

This function will be called by our read_temp function, that reads that raw data into a string array and parses it:

1
2
3
4
5
6
7
8
9
10
11
def read_temp(sensorid):
    lines = read_temp_raw(sensor[sensorid])
    while lines[0].strip()[-3:] != 'YES':
        time.sleep(0.2)
        lines = read_temp_raw()
    equals_pos = lines[1].find('t=')
    if equals_pos != -1:
        temp_string = lines[1][equals_pos+2:]
        temp_c = float(temp_string) / 1000.0
        temp_f = temp_c * 9.0 / 5.0 + 32.0
        return temp_f

This next part is tricky. I plugged in each sensor individually to get the serial number of each. Now, we must match the serial number with the position of the sensor.

For this experiment I attach one sensor to the lid (top) and one to the bottom of the container. This way the top one will measure the air temperature and the other will be submerged in water for the wet ice, and covered with dry ice. This is just my initial thoughts on this experiment, feel free to try some other configurations. Here’s how we gather the readings:

1
2
3
4
5
6
7
8
9
10
11
# Get readings
outside = read_temp(0)
weticetop = read_temp(1)
weticebot = read_temp(2)
dryicetop = read_temp(3)
dryicebot = read_temp(2)

## get averages

weticeavg = (weticebot + weticetop) / 2
dryiceavg = (dryicebot + dryicetop) / 2

So basically we arrange the serials in a string array and address them. The read_temp function takes in this argument and then passes it to read_temp_raw which then extracts the information from the sensor and sends it back to read_temp which parses the information and sends back a number.

I added an average to the mix, which as you can see is just an average between the top and bottom sensor. I don’t know if it will provide value or not, but decided to throw it in.

Storing the Data on Adafruit.IO

Dry Ice ws Wet Ice

I love using Adafruit.IO for their cool visualizations. I’m not going to go into setting up a dashboard in this article, but If you want to know how to set up your own Adafruit.IO dashboard check out this article for instructions or you can follow lecture 15 of my IoT course.

To connect to my dashboard, I added the following code:

1
2
3
4
5
6
7
8
9
10
11
def send_to_adafruit(url,values):

    ourvalue = {'value' : values }
    data = urllib.urlencode(ourvalue)
    req = urllib2.Request(url, data)
    req.add_header('Content-Type','application/x-www-form-urlencoded; charset=UTF-8')
    req.add_header('x-aio-key',aiokey)

    response = urllib2.urlopen(req)

    return response

This is a function to connect to Adafruit, you will need to include urllib and urllib2, as well as use your own aiokey.

Then to send the data (each field is sent one at a time with Adafruit)

1
2
3
4
5
6
7
8
## Sending data to Adafruit.IO 
send_to_adafruit(outsideUrl,outside)
send_to_adafruit(weticetopUrl,weticetop)
send_to_adafruit(weticebottomUrl,weticebot)
send_to_adafruit(dryicetopUrl,dryicetop)
send_to_adafruit(dryicebottomUrl,dryicebot)
send_to_adafruit(dryiceavgUrl,dryiceavg)
send_to_adafruit(weticeavgUrl,weticebot)

This sends our data out to a nice dashboard.

Sending Data to Sparkfun

Dry Ice ws Wet Ice

I decided to send some data to Sparkfun for the heck of it. You can get instructions for doing that here or check out lecture 13 of my IoT course.

Since Sparkfun uses values passed in the URL, we build a long URL string like so:

1
oururl = sparkfunprojecturl + '?private_key=' + sparkfunprivatekey +  '&dryiceavg=' + dryiceavg + '&dryicebottom=' + dryicebot + '&dryicetop=' + dryicetop + '&outside=' + outside + '&weticeavg=' + weticeavg + '&weticebottom=' + weticebot + '&weticetop=' + weticetop

The variables sparkfunprojecturl and sparkfunprivatekey are defined at the top of the script and you’ll need to get your own.

Then we call it:

1
content = urllib2.urlopen(oururl).read()

We don’t do anything with the content returned, but you can if you choose to. This will put send our data to the sparkfun feed found here.

Update every minute

Next, I want to call this script once a minute, so I’ll use crontab to do that:

1
crontab -e

I want to call my script once a minute, so I add the following line to my crontab:

1
* * * * * /usr/bin/python /home/pi/projects/supercool/readtemps.py

Your filename will be different. This simply calls the script once a minute and sends the data to our endpoints. For more information on cron, click here.

After this, the script started running and gathering data!

Summary

Dry Ice ws Wet Ice

So I was curious about this claim and decided to tackle it. I didn’t learn much from this, other than the fact that wet ice in a sealed cooler lasts longer than I would have thought. There were a lot of variables here outside my control, but I think it’s a fun project and I will build on it some more. I hope one of you decides to take this on and improve on it. If so please share it with me!

Important Links:

Here are some links relevant to this project, without these folks this wouldn’t have been possible (or at least this easy!)

And as I plugged several times in this article I created a course teaching you how to do experiments like this with a Raspberry Pi and you can get 50% off by using this link.


Raspberry Pi Newsletter


Intro to Application Pools in IIS

Application Pools in IIS can be somewhat of a mystery. Since they’re created for you automatically many times Administrators don’t give them a second thought. But understanding application pools is crucial to having a good running IIS server.

I cover this and other IIS Administration topics in my IIS Administration Fundamentals course at Pluralsight. Check it out!

Hands on IoT With the Raspberry Pi

Great news! I finally got my IoT course done! It took a long time to develop, and a lot of learning but totally worth it. This is not really a post advertising it but just a quick talk about the process.

Review: Netgear WAC730 Wireless Access Point

In this article I’ll be reviewing the Netgear Prosafe WAC730 Wireless Access Point. This is a WAP geared towards small to medium sized businesses, and is designed to compliment your existing network. I received this product for free in exchange for my honest opinion as part of the Netgear Ambassador Program. They sent me this unit to try out, and after extensive evaluation here’s what I think.

How to Set Up Free SSL for Your Website

If you’re reading this then welcome to the new server! Due to my web host taking a huge nose dive, I had to scramble to find new hosting. In doing so I explored SSL solutions and a friend suggested Let’s Encrypt. I liked the experience so much I thought I’d share it.

Easy CRUD for Your Web API With Dapper

Full disclosure here: I don’t like ORMs. If you’re building an enormous enterprise project, you should absolutely use an ORM. If you have data you really care about and a complex, monstrous system using something like Entity Framework can save you a lot of frustration. If you’re building a simple application, or some home project it’s really unnecessary.

Setting Up the Adafruit Huzzah ESP8266 Breakout

Recently I showed a friend of mine some of the projects I’ve working on with Arduino and Wifi, and he introduced me to the ESP8266 chip. I found them all over the internet ranging from $1.50 US to $20, with a variety of configurations and manufacturers. I decided to go with a company I trust, Adafruit Industries, and see what their offering is like.

Failed Request Tracing With IIS

A great tool I’ve discovered recently is the Failed Request Tracing Tool is IIS. If you’re building an ASP.Net application and having issues with requests it’s a fantastic tool. I’ll show you how to use it.

Getting Started With Adafruit IO


Raspberry Pi Newsletter


Earlier this year Adafruit Industries put their IoT dashboard Adafruit.IO into Beta, and it looks pretty cool. I’ll show you how to set up a dashboard using one of my mini weather station designs for data input. You may remember this project from a few months ago. I’ll be adding yet another endpoint to the project on Adafruit.IO.