-
Notifications
You must be signed in to change notification settings - Fork 2
SmartBeerFridge Script
Elizabeth Adams edited this page Oct 7, 2019
·
5 revisions
Assuming you ran the git clone command earlier in the tutorial, the final script that puts everything together is called smartbeerfridge.py in your ~/smartbeerfridge directory.
A few settings need to be set in the script before you can run it. Open up smartbeerfridge.py in the text editor.
$ cd ~
$ cd smartbeerfridge
$ nano smartbeerfridge.py
Near the top of this file, there is a User Settings section.
# --------- User Settings ---------
WEIGHT_SAMPLES = 500
BUCKET_NAME = ":beer: Beer Fridge"
BUCKET_KEY = "beer2019"
ACCESS_KEY = "ist_9l88ABg2jnZZgbaDTMoBTYfZVmh8WU43"
WIIBOARD_NAME = "w2"
# ---------------------------------
- WEIGHT_SAMPLES sets how many weight measurements the Wii Balance Board takes and averages before computing how many bottles are present. 500 seemed to provide a nice balance of accuracy while not taking too long to complete. Feel free to tweak this setting to your liking.
- BUCKET_NAME specifies the name of the data bucket that will show up in your Initial State account.
- BUCKET_KEY should be set to a unique name. The BUCKET_KEY parameter allows you to append to an existing bucket or create a new bucket. Simply pick a name for this parameter (i.e. beerfridge1234).
- ACCESS_KEY is your Initial State account key that can be found on your account page.
- WII BOARD NAME is the name for the board you are connected to. Each of the two Wii Boards should be named differently so you can differentiate their signals in your Initial State dashboard.
Once you have specified each parameter in this section and saved your changes, you are ready to run the final script. Before we run the script, let's go through what it is going to do.
- At the start of the script, you will be asked to pair your Wii Balance Board with your Raspberry Pi. Use the lever that you hacked together in to press the sync button when prompted.
- If the script notices a weight change it will wait for it to stabilize before sending the new weight data. So if you open the door, take a beer, and close the door it will wait until the weight is stabilized and not send a bunch of changing weight data.
- Weight from both your Wii Board will be send in from each Pi.
Run the script to start the magic.
$ sudo python smartbeerfridge.py
<< Initial State - Remotely Monitor the Pi Process and IP Address >>
Initial State (https://www.initialstate.com)
(c) 2018 Initial State Technologies, Inc.