Internet Enabled Fridge: a First Foray Into Internet of Things




Introduction: Internet Enabled Fridge: a First Foray Into Internet of Things

Hello Everybody!

I had an issue with the freezer in our house. Once in a while, the freezer would fail to close fully, either bouncing open or getting slightly propped open. This small gap was enough of a gap to allow hot, moist air inside of the freezer. The water would condense on the evaporator coils, and freeze them into a solid block of ice. This would prevent air circulation to the fridge, and cause the fridge to warm up, while the freezer got really cold. The defrost cycle couldn't keep up, and we would have to pull everything out and manually defrost the coils. This was long and annoying, so I found a solution: Internet Enable the Fridge.

As is prevalent in the Internet of Things (IoT) revolution going on now, I have my own personal view of what the IoT should be (who doesn't?). I think that the IoT devices should be able to think for themselves, a little bit of smarts paired with the internet, capable of making pseudo-informed decisions. So I went off on my quest to internet enable my fridge.

A few months ago, I heard of the ESP8266, a tiny, five dollar WiFi board, with the power to be programmed with custom code. It's quite the small board. Unfortunately, it can be quite annoying to use all the pins, as many pins are not broken out. Recently, I found SparkFun's ESP8266 Thing, a breakout board which includes a pinout for an FTDI for easy programming, all of the pins broken out, and even a LiPo battery charger and monitor built in. It is more expensive than the base ESP8266, 16 dollars versus 5, but it is much easier to use. I have built one of those into a simple sensor module, with the capability to monitor two sensors and provide feedback through an integrated buzzer. It also breaks out the I2C pins, for easy connection to other sensors.

This simple monitor reads the fridge and freezer doors through a strip of copper tape, alerting anyone when the door is open for a long period of time through an embedded buzzer and text messages. It can be easily repurposed to read other sensors (and I might be repurposing this platform for a door monitor for my apartment in college later.).

Parts List:

  • ESP8266 Thing (
  • Copper Tape
  • Assorted Wires
  • Terminal Block
  • Assorted Snappable headers (1 by X)
  • Piezoelectric Buzzer with integrated driver (Don't use a magnetic buzzer)
  • Push Buttons
  • Project Box
  • USB Charger
  • Micro USB cable

Step 1: Schematic and Design Concepts

When designing this module, I wanted to allow it to be flexible. With the potential that I am going to be stealing it for my apartment, I wanted to be able to quickly change out the sensors and options to suit the application. I decided to include these features:

  • Dedicated Reset Button: I wanted to get a dedicated reset button, which is not populated on the Thing.
  • Dedicated Program Button: As I didn't have the FTDI Basic, I wanted a button to enter the bootloader mode on the Thing easily.
  • Buzzer with Override: To give audio feedback, I included a buzzer, with a jumper so it can be used as an IO.
  • I2C Breakout: Having the I2C broken out is a must. So many sensors use I2C, and it is an easy protocol to interface to.
  • Quick Connects: A terminal block with lever releases was a quick and easy addition to the project.
  • Fits in a Project Box: With this being tucked away in a dusty area, I definitely wanted it in a box to keep it fairly clean.

I decided to go with copper tape as a contact sensor, as a microswitch has too much play to detect the amount of space we are dealing with. Usually, the gap is less than a quarter inch, which is risking the switch not triggering, or triggering too early. I debated around other sensors, like capacitive or even something odd, like encoders on the doors. The copper tape was an easy, boolean switch, which will engage when the door is closed. It will fail "open", which will bring attention to the problem immediately, rather than after we have an issue. The switches will corrode over time, but a little bit of buffing with some steel wool seems to polish it right up.

With those design guidelines in place, I decided to lay out the schematic shown above. I laid out the final version of the schematic similar to how I laid out the board.

Some quirks I discovered with the Thing:

  • There is no reset pin broken out, so I had to interface with a test pad to access it. I wanted to use the dedicated reset pin rather than the DTR line, because having it boot into bootloader was not useful if I wanted a fast reset.
  • The power switch is really annoying to use to program it. Using a FTDI Basic (DTR line required) is easier than using other FTDI's and trying to time the power cycle properly.
  • Along those same lines, if you aren't going to use an FTDI Basic, cut the DTR jumper and do things manually, with the reset line and GPIO0. It's easier than trying to struggle with the DTR line or the power switches.
  • Using the 921600 baud rate for programming is faster, but I found that it errors fairly frequently. Dropping down to the 512000 baud rate was more effective.
  • The pins output a beefy 13 milliamps, but it still wasn't enough for the buzzer, so I placed a dropping resistor in series to ensure the current was lower. It was still quite loud and annoying.

Step 2: Prototype

I started with the prototype shown to the left so that I could test my code. This was much easier, and allowed me to find quirks before I get something set in stone. In this case, I used snappable headers to quickly break out jumpers to my switches. I used female to female jumper cables to make most of the connections, allowing for quick and easy connections.

Step 3: Build the Sensor Module

Now is the time to drag out your soldering irons, wire strippers, drills and other assorted hand tools!

START BY CUTTING THE DTR LINE. DO IT NOW OR YOU WILL FORGET ABOUT IT. It's the indicated jumper on the image above.

I then soldered a short wire through the reset hole going out the top. You can see it in the top views, the blue wire going across the top of the board. You could use the DTR line to reset the micro, but you will put it into bootloader mode. I wanted to ensure that it couldn't be put into bootloader mode, so I used the reset line.

After that, I soldered on the headers. As seen in the first photo, I kept the serial header pointed up, so that I could directly plug the FTDI directly into the board, but you could move the connector to another location to allow programming when the box is closed.

For the wires, I used 24 gauge solid core wires. Anything should be fine, as the current carried is very small.

I ran into an issue where the bottom of the board was not fitting into my box, due to the thickness of my wiring. To fix this, I applied a strip of 3M Bumpon. It's the same stuff you find on the bottom of your electronics to give them non-slip feet. It was just the right thickness to space the box off the bottom. You could also use nylon standoffs or sometime similar. Layers of masking tape would also work.

To make room for the battery and USB connector, I drilled two large holes spaced evenly on the box wall, and then used a file to open the two holes into a rectangle. It took a while, but it worked fairly well.

Step 4: Build the Sensors

I used a strip of copper foil tape to create my sensors. I soldered the necessary 3 wires to the strip, then cut the tape into the necessary shapes.

I then cleaned the surface of the fridge using some Windex to remove oils that might prevent the tape from sticking. After it dried, I stuck the contacts in the positions shown in the first picture.

To make the connecting contact, I took the same tape and cut it into an L shape and applied it to the gasket, so that it bridged the two contacts when closed. By using the three part sensors, you don't have to run any wires down the door.

Step 5: Create a Phant Stream

Create a Phant Stream for your Thing here:

This is what stores the duration data for your fridge and freezer.

Make sure to create two fields for the fridge and freezer duration data.

Once you click save, remember to copy your public and private keys somewhere safe. You need them to post to your stream, get your data, and edit your stream later. There is the option to get them sent to your email, which is what I did.

Step 6: Install the Software

Now, time to add the Internet to the Things. I'll assume you haven't installed the Arduino plugin, so I will start from there. I used the SparkFun ESP plugin, using the following hook-up guide:

It was simple to install, and has been working fine for me.

Step 7: Program the Thing

Now's the fun part, getting to make your device work! I have attached my code above, which you can feel free to cannibalize. Just remember to attribute me properly.

If you just use my code, make sure to change basically all of the constants at the top. Here's a list of what you need to change:

  1. Your WiFi SSID
  2. Your WiFi Password (Or comment out this line if you are using a unsecured network (tsk, tsk tsk...)
  3. Your Email SMTP Server. Usually Google can tell you what server you should be communicating to if you Google your email provider.
  4. Your SMTP port. Again, refer to Google.
  5. Your full email address.
  6. Your Email Username encoded in base 64. This is usually just the first part of your email, encoded in base 64 through a site like the following:
  7. Your Email Password encoded in base 64
  8. Your Phant Public Key for your Stream
  9. Your Phant Private Key for Your Stream
  10. The recipient of your alarm message. If you want to send a text, you can use this list of SMS gateways. Just follow the formatting provided, and you can send a text to your phone:
  11. Your Phant fields.

To upload your code, push the upload button, and then hold down both the Program and reset buttons. As soon as you see the Arduino IDE switch to "Uploading..." release the reset button, BUT CONTINUE TO HOLD the program button. If all goes well, you should see the standard ESP uploading text. If not, just adjust your timing slightly, and try again.

Step 8: Mount and Test

I mounted my box to the side of the refrigerator using Command Adhesive from 3M. It is the same stuff you use for Command hooks, just without any hooks attached. I plugged it in using a cheap USB wall wart. To test it, I held the door open slightly (just enough to open the contacts), and waited for the alarms to start sounding!

Once you shut the door, your Thing should post to Phant, and you should see a duration appear in your stream!

You can now see when and for how long the doors have been opened, and get alerts when the door stays open for too long!

Step 9: Final Words

After finally having enough time to write this up, I can say that this project has been a success. I have had the device on for about a month now, and we haven't had to defrost the freezer in that time. In comparison, the two months before this, we had to defrost it 3 times. The earliest we have opened the fridge is 5:30 AM, and the latest was 10:57 PM. The longest open was 110 seconds, about 10 seconds away from having it send a text to me. My mother confirms that the constant beep alarm at that point was really annoying her...

Future work:

My father is working on expanding this with some LM73 temperature sensors which should post the temperature of the fridge and freezer up to Phant. There is also a rollover glitch which occurs sometimes, in which it says the doors have been open for more than 1000 seconds at a time. This is due to the millis() timer rolling over. I plan to fix it eventually, but for now, I'm just filtering out the bad data. We are also brainstorming methods to determine how long the defrost cycle is, and if it is long enough. Current ideas include a current probe on the defrost heater, or a local temperature sensor. Suggestions, questions, and comments are welcome, as always!

Thanks for reading, and I hope this springboards some of you into the IoT world!

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Be the First to Share


    • Big and Small Contest

      Big and Small Contest
    • For the Home Contest

      For the Home Contest
    • Make It Bridge

      Make It Bridge



    2 years ago

    Excellent project. But it is better to create the video on that project. One more thing to add, your mentioned tools are great. But also check that tool as well where you will also find other tools as well for your future projects.


    7 years ago on Introduction

    Cool project! Can you publish the video of the project?


    Reply 7 years ago on Introduction

    Thanks! Unfortunately, I'm now at college away from home, so I can't record any video. I also don't think it would be that interesting... The video summary would be this:
    1. I open the fridge door.
    2. I wait 15 seconds.
    3. The buzzer sounds two short beeps.
    4. I wait 15 seconds.
    5. The buzzer sounds two long beeps.
    6. I wait 30 seconds.
    7. The beeper starts going off continuously.
    8. I wait 60 seconds (and get really annoyed at the constant beeping going on... that buzzer is really annoying...)
    9. My phone buzzes, and displays FRIDGE ALARM from my email address.

    10. I close the fridge door, beeping stops.

    11. I pan around the fridge, showing the box mounted to the side, the wires running up and over to the center, and the contacts in the middle.


    7 years ago on Introduction

    Might have to try this out myself. We currently have a problem with our freezer opening up when we close the main fridge.


    Reply 7 years ago on Introduction

    That was one of the exact reasons why I created this. It was getting to be quite the problem. I feel like the door seal is starting to decay, and doesn't have the same shock absorbing properties it once did.


    7 years ago

    I have been tweaking a more robust version of this off and on for about a year. A Raspberry Pi as a multi-purpose base station and multiple Nanos communicating over nRF24L01+ modules gives me a very cheap and highly robust solution to monitor temps and other sensors all around my house. And running on battery is easy with long-life due to arduino power-saving approaches.