-
Notifications
You must be signed in to change notification settings - Fork 29
Part 2. Reading the Scale
It is time to connect our Wii Balance Board to our Raspberry Pi. We will do this by modifying a version of Stavros Korokithakis' Gr8W8Upd8M8.py script. The python script we will be using for this step is located here. You can copy the contents of this file to a file you create on your Raspberry Pi or you can clone all of the python files we will be using for this entire project. Let's do the latter. Type the following commands into a terminal on your Raspberry Pi:
$ cd ~
$ git clone https://github.com/InitialState/smart-scale.git
cloning into 'smart-scale'...
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 14 (delta 1), reused 8 (delta 0), pack-reused 0
Unpacking objects: 100% (14/14), done.
Checking connectivity... done.
You should see two python files in the new smart-scale directory - smartscale.py and wiiboard_test.py.
$ cd smart-scale
$ ls
README.md smartscale.py wiiboard_test.py
Run the wiiboard_test.py script to test communication and take weight readings from the Wii Balance Board:
$ sudo python wiiboard_test.py
You will see the following response:
Discovering board...
Press the red sync button on the board now
Remove the battery cover underneath the Board to locate the red sync button. Make sure you press the button within a few seconds of running the script or a timeout will occur. Once successful, you will see something similar to the following:
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
84.9185297 lbs
84.8826412 lbs
84.9275927 lbs
The wiiboard_test.py script is taking the number of weight measurements specified on line 10 and outputting the average:
# --------- User Settings ---------
WEIGHT_SAMPLES = 500
# ---------------------------------
You can play with this number by changing the value and re-running the script to see the variation in weight measured and time required for each measurement. Weigh yourself, weigh your dog, weigh whatever and see if the measurements make sense. To stop the script, press CTRL+C.
You have now successfully converted your Wii Balance Board into a Raspberry Pi connected scale. Now, let's make it a cool scale.
Initial State (https://www.initialstate.com)
(c) 2018 Initial State Technologies, Inc.