Skip to content

Internet of things

I like to cook. When I make food I often prepare enough for several meals. At home I have a chest freezer to store the excess. It has everything from frozen vegetables and fruit to chicken bones for stock, quarts of the resulting homemade chicken stock, gumbo, empanadas, and bacon.

It's great to be able to dive into the freezer during a busy week to pull out meals that are ready to go.

chest freezer chest freezer

One challenge we have with the chest freezer is keeping track of what's inside. My current approach is to maintain a Google spreadsheet of the freezer contents, but I often forget to update the sheet.

freezer spreadsheet

chest freezer sign

Despite obvious sign, I still forget to update the spreadsheet.

Enter the smart freezer.

Smart freezer

For this week's project related to the "Internet-of-Things," I wanted to give my freezer an upgrade and make it a "smart" freezer to help ensure I keep the spreadsheet up to date. I'm not talking about a computer vision system to recognize what I'm adding or removing (it's often difficult to tell through frost and vacuum bags), but simply a system to send me a text message reminder to update the spreadsheet, with a link. I also want to track when I open the freezer, and how long it is open.

Capacitive open detection

To detect when the freezer is opened, I chose to use capacitive sensing. It requires very little power, and no additional electronic parts beyond some copper tape. I soldered wires to strips of 5mm copper tape approximately 5 inches long, and affixed the tape strips to the seal of the freezer, on the hinge side, as well as where the seal makes contact when the door is closed.

chest freezer

chest freezer chest freezer

Since I'm relying on capacitance and not direct conductivity, I covered the copper tape with black gaffer tape to provide insulation and mechanical protection. I next connected the wires from the probes to pins A1 and A3 of the ESP32-based Adafruit Huzzah32.

chest freezer

Using code based on Rob's TX-RX capacitive sensing code, I tested that door opening can be detected. It can!

I adapted this to detect when the freezer is opened or closed, and to record for long long.

state change serial output

This is based on the following code:

Logging open times

To log opening times I installed the Firebase library from mobizt, and integrated it into the code above to append records to an array in /chest-freezer-openings with duration_sec and timestamp values (the latter is a Unix timestamp in milliseconds.)

state change serial output

Code:

Sending an SMS message

To send SMS alerts about the freezer opening with a link to the tracking spreadsheet, I took advantage of the e-mail-to-SMS gateways offered by US Mobile phone carriers.

My carrier is currently T-Mobile, and I can send SMS messages to any T-Mobile phone by sending an email to NNNNNNNNNN@tmomail.net where NNNNNNNNNN is the ten-digit phone number of the intended recipient.

I installed the ESP32-Mail-Client library from the Arduino library manager, and configured Amazon SES to send email using a domain name I control, tia.io. This required adding a few CNAME and TXT records from Amazon SES to the DNS records for the domain in order to verify that it is my domain. After that I created SMTP credentials to use with the ESPMail library.

I also had to have AWS move my account into "production mode" to be able to send to third-party email addresses.

Once configured, the ESP32 sends an email at the same time it logs to Firebase.

SMS received

Code: