Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Arend-Jan van HiltenVincent Kling
Published © GPL3+

Smart Fridge

A smart fridge that keeps track of the stuff in it and prints your shopping list!

IntermediateFull instructions provided10 hours8,329
Smart Fridge

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
Other version may work, but we used this one.
×1
Thermal Printer USB
×1
Fridge
Any fridge works, preferrably one that isn't in use, because it is better to not use the cooling feature.
×1
(Omnidirectional) Barcode scanner USB
I couldn't find the one we use.
×1
3x relais
something like those, but one big also works. Not neccesary when not using the leds in the buttons.
×1
Adafruit arcade button with led
3x different colors.
×1
Adafruit perfboard
×1
Android device
Android device
×1

Software apps and online services

Android Studio
Android Studio
Only if you want to change/develop things.
Putty
Or things like this.

Hand tools and fabrication machines

Just your default tools like soldering iron, drill, knippers, stripping pliers and a multimeter. Nothing fancy

Story

Read more

Schematics

Schematic for the Buttons and The LEDS

Fritzing file

You maybe need https://github.com/rwaldron/fritzing-components/blob/master/components/keyes-relay.fzpz for the relay part

Code

Installation script for the Raspberry Pi

SH
Also in the github repo
use with -I "userid"
if [[ $EUID -ne 0 ]]; then
    echo "I need sudo right. plz (insert cute cat image)"
    exit 1
fi

UPDATE=""
USERID=""

while getopts ":u:I:" opt; do
  case "$opt" in
    u) UPDATE="$OPTARG"
            ;;
    I) USERID="$OPTARG"
            ;;
    esac
done


if [ "N" != "$UPDATE" ]; then
  echo "updating..."
  sudo apt-get -qq update
  sudo apt-get -qq install curl python-setuptools python-dev build-essential python-pip
  sudo -H pip install --upgrade pip > /dev/null
  sudo -H pip install --upgrade virtualenv > /dev/null
  sudo -H pip install pyBarcode > /dev/null
  echo "done updating"
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
mkdir "$DIR/smartfridge"
echo "downloading the code..."
curl -Ls "https://api.github.com/repos/arendjan/pws/tarball" > "$DIR/smartfridge/GIT.tar.gz"
echo "done downloading"
echo "unzipping and putting the files in the correct place..."
mkdir -m 777 $DIR/smartfridge/temp
tar -xzf "$DIR/smartfridge/GIT.tar.gz" -C "$DIR/smartfridge/temp"
cp -rf "$DIR"/smartfridge/temp/*/raspberry/*  "$DIR/smartfridge"
cp -rf "$DIR/smartfridge/start.py" "$DIR/start.py"
rm -rf "$DIR/smartfridge/temp"
rm -rf "$DIR/smartfridge/GIT.tar.gz"
sudo chmod -R 777 "$DIR/smartfridge/"
sudo chmod -R 777 "$DIR/smartfridge/printjobs" 
echo "done"
echo "setting up a cronjob"
#write out current crontab
crontab -l > mycron
#echo new cron into cron file
echo "@reboot sudo python $DIR/start.py" >> mycron
#install new cron file
crontab mycron
rm mycron
echo "done setting up the cronjob"

if [ ! -z  "$USERID"  ]; then
  echo "setting up your settings file"
  echo $'userId="'$USERID$'"\ninterval=5\nurl="http://pws.svshizzle.com/api/"' > "$DIR/smartfridge/settings.py"
  echo "Done writing"
fi
echo "Doei"

Github code

For the Raspberry only download the install.py file, the rest will be downloaded by this file. For the Server(if you don't want to use ours), copy everything from the server folder to your server(Filezilla). For the App(if you don't want our app), open the App folder in Android Studio.

Credits

Arend-Jan van Hilten

Arend-Jan van Hilten

5 projects • 12 followers
Labview, Arduino, Raspberry PI and other stuff for me!
Vincent Kling

Vincent Kling

2 projects • 1 follower
Dj, Radio Dj, like programming,
Thanks to Roland Hollaar & Bart Hornman, Mark Zimmerman, Kalsbeek College(Teachers & Other people), and Marieke & Erik van Hilten.

Comments