-
Notifications
You must be signed in to change notification settings - Fork 19
Part 2. Final Destination
Place the empty refrigerator on top of the Wii Balance Board and plug the AC adapter from the battery pack into a wall outlet. Run the wiiboard_test.py script from a terminal on your Raspberry Pi to get the base weight of the refrigerator.
$ sudo python wiiboard_test.py
Discovering board...
Press the red sync button on the board now
Found Wiiboard at address 00:23:CC:2E:E1:44
Trying to connect...
Connected to Wiiboard at address 00:23:CC:2E:E1:44
Wiiboard connected
ACK to data write received
83.011212 lbs
82.962819 lbs
83.165323 lbs
83.068293 lbs
83.182738 lbs
82.981102 lbs
The measurements are a bit noisy varying +/- .25 lbs. To get the base weight of your refrigerator, allow the script to run and take several measurements. Each measurement output is really 500 measurements (or whatever you changed the WEIGHT_SAMPLES variable to in the script). After 10,000 measurements, my refrigerator averaged 83.04 lbs according to my Wii Balance Board. Write down your refrigerator's base weight (we will use it in Part 4).
Fill your refrigerator up with as many bottles as you have (do not mix wine and beer bottles b/c they have very different weights; we are making the assumption that each bottle has approximately the same weight). Observe the average weight of the refrigerator plus the additional bottles. Subtract the base weight of the refrigerator from the full weight and divide this weight by the number of bottles in the refrigerator. This is the average weight of a bottle. I measured an average weight of 1.266 lbs for each bottle using 30 beer bottles. Write down your measured average bottle weight.
We have everything we need to detect the number of bottles of beer in our refrigerator. Next, let's add a couple of important sensors to our refrigerator and then put it all together.