# DIY Smart Fridge



## mkriegs (Mar 4, 2020)

So, I've been working on a solution to the inventory management problem in my kitchen. Basically a barcode-enabled DIY smart-fridge.

So far I have a Raspberry Pi mounted to my fridge door that views a webpage hosted locally on a Debian server. I have a cheap barcode scanner off amazon, they connect into the USB port and output the barcode value just like a keyboard. So, I'm able to pass the barcode up to the server through a form that looks like this,









[hr]

The backend is written in PHP and connects to the free API at upcitemdb.com. There is usually a photo available along with an accurate description and a lot lot of other stuff. The UPC barcode is a unique identifier for a specific product, but it doesn't say anything about whether it is a 0.5 oz bottle or a 1 lb case of them. So, the script skims the descriptions (I learned regex for this!) to find possible unit sizes and lets the user pick the correct one. I went through my kitchen and scanned a dozen or so items in just a few minutes. Scan, use the touchscreen to confirm the size, select the amount left (in increments of 25%), and submit.

*What the fridge interface looks like IRL:*











*Screenshot of the front-end in a browser:*











*Screenshot of the inventory list after scanning for 2 minutes:*










[hr]

The big picture here started with me wanting to be able to grocery shop by picking recipes and then use the pickup service offered by my local grocery store (Mariano's). Think of like a DIY Blue Apron / Hello Fresh sort of deal. Inventory management fit into this because I want to be able to prioritize recipes that use ingredients I already own.

So, the other arm of this was automating the grocery selection process. I built an excel spreadsheet with ten recipes all itemized out and linked every item up to specific items on Mariano's website. That spreadsheet can take the number of servings of each recipe you want to make and spit out an aggregated list of ingredients. An Excel macro spits out a csv, which I upload to the server where a python script converts it into a javascript array (shoppingList.js). Then, Tampermonkey (Chrome addon) detects when I'm on Mariano's landing page and injects two links to scripts hosted on my server. One is the list of items, and the other is the "shopper" that opens a new tab and starts picking out items. It's not perfect yet, the script still misbehaves sometimes, but you can see it in action here,











I also have another cog in this wheel that is technically complete but I'll just describe instead of clogging this up with more screenshots. Mariano's has a cool feature where if you use your rewards# then your receipts become visible when you log in to your account. So, I have a script that scrapes these as well. The front-end UPC search will pull up items in that list too if it matches whatever was scanned.


Anyway, I'd love to hear some opinions. What do you all think?
[/size=3][/font=Georgia]


ps - the default font was clashing with the screenshots, hope it looks okay for you


----------



## huesmann (Aug 18, 2011)

Formatting is a little wonky, but it looks like an interesting project.


----------



## F250 (Feb 13, 2018)

I wouldn't have shared this, but you asked for opinions....

Interesting, perhaps. Truly useful, though? Aside from bragging rights, I just don't see where the real value lies. To each his own, though.


----------



## SeniorSitizen (Sep 10, 2012)

While designing smart, consider including a smart filter that changes itself when it's full of those dust / lint bunnies that swirl around on the floor and get into the cooling fins.:biggrin2:We were once able to clean those with a vacuum/compressed/air and or a brush but nearly impossible with some of today's smarter units.


----------



## 3onthetree (Dec 7, 2018)

It's more of a "kitchen inventory" than just the ref contents, maybe you can expand to toiletries and personal care from another store too (I'm guessing you shop at bullseye). The % left might mislead you, because you don't have a default "count" listed so you know % of what (1 gallon milk is self-explanatory, but do you always keep 2 dozen eggs or do you always buy the same six-pack of soda or once in a while a 2 liter). 

I'd like to make a joke about having too much time instead of a girlfriend, but instead I'll say this is the essence of the DIY spirit, so good start!

P.S. Mariano's is overpriced


----------



## mkriegs (Mar 4, 2020)

Cool!



huesmann said:


> Formatting is a little wonky, but it looks like an interesting project.


Posted to another forum first and apparently these boards don't support the same markup, and it won't let me edit since it's my first post, this is awkward :|




F250 said:


> Interesting, perhaps. Truly useful, though? Aside from bragging rights, I just don't see where the real value lies. To each his own, though.


I honestly agree. I've done all this in a vacuum, so I'm hoping at this point that there might be some established tools for me to make use of. 




SeniorSitizen said:


> While designing smart, consider including a smart filter that changes itself when it's full of those dust / lint bunnies that swirl around on the floor and get into the cooling fins.:biggrin2:We were once able to clean those with a vacuum/compressed/air and or a brush but nearly impossible with some of today's smarter units.


Hmmm, I'm thinking about water cooled condenser. Eliminate the exposed surface area, but where to sink the heat...


----------



## Old Thomas (Nov 28, 2019)

If I had a smart fridge I would expect it to do my taxes. No thanks.


----------



## SeniorSitizen (Sep 10, 2012)

mkriegs said:


> Hmmm, I'm thinking about water cooled condenser. Eliminate the exposed surface area, but where to sink the heat...





If it's smart it'll store it to be released in the winter months.:vs_laugh:


----------



## BayouRunner (Feb 5, 2016)

First off great choice of hot sauce. I like that one better then all of them. I would really like to have our groceries delivered. But creating and maintaining the list in order to get the correct brands, sizes etc to me would be cumbersome without some type of help. I wouldn’t want to sit in front of a computer for 30 minutes to create one. I would just go pick them up instead. Your start of the program is definitely a step in the right direction. The local Walmart will have everything boxed and bagged and meet you at your car but doesn’t deliver. But I’m one of those hard headed guys that spends all my money at the local grocer and drive right by Walmart to get there. The local grocers here don’t deliver or offer any type of service so I guess I’m going to keep up the old ways. Hats off to your project. Hope it works out for you!


Sent from my iPhone using Tapatalk


----------



## lenaitch (Feb 10, 2014)

Cool DIY project exercise but it seems like a solution looking for a problem in a typical household.
We have a magentic-mounted paper pad on the fridge door.


----------



## adamz (May 13, 2018)

*That spreadsheet can take the number of servings of each recipe you want to make and spit out an aggregated list of ingredients. An Excel macro spits out a csv, which I upload to the server where a python script converts it into a javascript array (shoppingList.js). Then, Tampermonkey (Chrome addon) detects when I'm on Mariano's landing page and injects two links to scripts hosted on my server. One is the list of items, and the other is the "shopper" that opens a new tab and starts picking out items. It's not perfect yet, the script still misbehaves sometimes, but you can see it in action here*

You can do all the above with PHP on the server without excel. You would need your PHP code to accept the "recipe" into a textbox on the web page, then click Submit, then a web page appears with your grocery list.


This is an example of a PHP form: https://www.w3schools.com/php/php_forms.asp
The basic idea is the same, except your PHP code would output more stuff



Pretty cool stuff on your part


----------



## Missouri Bound (Apr 9, 2011)

Alexa makes up my lists. I tell her what I want and when I am ready to shop I print it.
And a smart fridge would open and close the door on command.


----------



## ajaye (May 19, 2019)

The only thing I want in a smart fridge, is for bringing me an ice cold one, my current product WiFEE 2.0 is broken and wont do this anymore


----------



## Missouri Bound (Apr 9, 2011)

ajaye said:


> The only thing I want in a smart fridge, is for bringing me an ice cold one, my current product WiFEE 2.0 is broken and wont do this anymore


.....and from experience, telling her you are going to trade her in isn't the best course of action.


----------



## ajaye (May 19, 2019)

yeah, I was kinda working on "getting" the newer model first then telling her she gone ! :vs_laugh::vs_laugh::vs_laugh::vs_laugh:



Missouri Bound said:


> .....and from experience, telling her you are going to trade her in isn't the best course of action.


----------



## Missouri Bound (Apr 9, 2011)

:vs_laugh:


----------



## ajaye (May 19, 2019)

........


----------



## surferdude2 (Nov 21, 2019)

My grandpa was right, "You're gettin' a little too smart for your own good." He told me that a lot! :vs_laugh:


----------



## Euser101 (Jun 14, 2021)

This is going to sound odd. But the one thing smart fridges may be good for, if they ever develop this tech, is for things like cold plasma. Assuming it doesn't have downsides. I'm hoping one day they will have automated cold plasma cleaning of vegetables and other things to keep veggies alive in the veggie drawer longer.

I'm also hoping it can lead to better canning where you can safely put meats and whole recipes and can/jar them without worry of bacterial growth without the need to add extra salts and preservatives. Maybe similar smart cleaning in a new type of jar to reaply cold plasma cleaning if and when needed. This could allow full normal recipes to be canned as is without modification. And allow the best cooks in the world to can their actual restuarant recipes without modifications. Especially good french and italian multigenerational cooks. Canned food would become amazing.

I'd love if it smart fridges went from spyware to pure advanced localized functionality in the kitchen.

If it's high electrical use it would/could go wonderfully with people getting solar panels and the like.

In fact it could be used in place of or with other chilling technology for ice machines and other things also. I wonder if it would help make icecream or italian icees behind a metal plate.


----------

