Use a Wii Balance Board with Linux

In this post you’ll learn how to make a working Bluetooth weight sensor + fast real-time graphical display with about 200 lines of Python code. You can code any Nintendo Wii-like video game for Ubuntu/Linux and the Nintendo Balance Board very easily. Here’s a video demonstration:

This post assumes that you can already communicate with a Wiimote on Linux. See my earlier post if you haven’t done that.

You’ll need Subversion and autoconf installed if you haven’t already installed it. I think the official/full list of packages to install is

sudo apt-get install autoconf autogen automake gcc bluetooth libbluetooth2-dev libgtk2.0-dev pkg-config python2.5-dev flex bison subversion

You must also install the development package for BlueZ, which is the official Linux Bluetooth protocol stack:

sudo apt-get install libbluetooth-dev

Make a directory to hold your code:

mkdir ~/wiibalance
cd ~/wiibalance

Check out the CWiid (get it? CWiid? Seaweed?) library using Subversion:

svn co http://abstrakraft.org/cwiid/svn/

When I checked CWiid out, it was up to version 183.

Compile the library, e.g.

cd ~/wiibalance/svn/trunk
autoconf
./configure --libdir=/usr/lib (according to this page, you need the libdir parameter on Ubuntu)
make
sudo make install

Now apply the patch to CWiid to add the Balance board. Go to http://abstrakraft.org/cwiid/ticket/63, click on balance.diff, then at the bottom of the resulting page, click on “Original Format” to download the diff as a raw text file. Do the same to download the “weighdemo.py” file. Now apply the balance.diff patch:

patch --dry-run -b -p0 < balance.diff (this command tests that everything would apply without errors)
patch -b -p0 < balance.diff

Finally, compile the code and install it:

make
sudo make install

Then you can play with the weighdemo.py script. You’ll want to change the line “sys.path.insert(0, ‘/home/tbble/code/cwiid/svn/cwiid/python/build/lib.linux-x86
_64-2.5/’)” to point to the right place on your system, e.g. /home/youraccountname/wiibalance/svn/trunk/python/build/lib.linux-i686-2.5/ . And you may need to disable the “if wiimote.state['ext_type'] != cwiid.EXT_BALANCE” if statement. I also added a few lines to print out the values and calibration numbers for the four sensors. Here’s what I get when I run my program:

$ ./weighdemo.py
Put Wiimote in discoverable mode now (press 1+2)…
Type q to quit, or anything else to report your weight

right_top 2249 [2293, 4004, 5725]
right_bottom 1467 [1449, 3155, 4874]
left_top 12471 [12476, 14238, 16015]
left_bottom 6822 [6848, 8581, 10325]
-0.58kg
Type q to quit, or anything else to report your weight

right_top 3618 [2293, 4004, 5725]
right_bottom 3983 [1449, 3155, 4874]
left_top 14208 [12476, 14238, 16015]
left_bottom 9621 [6848, 8581, 10325]
82.18kg

In this run, the first example is weighing with nothing on the scale. The second example is with me standing on the scale.

Here’s what you need to know. First, absorb this info from the Wikipedia entry:

Although the Japanese packaging states that it is designed to support people weighing up to 136 kilograms (300 pounds) and the “Western” Balance Board up to 150 kg (330 pounds), they are actually the same board. The packaging differs due to laws in Japan and other nations regarding weights and measures. While the board only displays weight readings up to what is printed on the packaging, the actual physical structure of the board can withstand much greater force equivalent to around 300 kg (660 pounds).

Okay, so the Wii Balance Board is certified for 300 pounds (136 kg) in Japan and 330 pounds (150 kg) in the U.S. The Wii Balance Board has four sensors, so each sensor is certified for up to 136 kg / 4 = 34 kg per sensor in Japan or 150 kg / 4 = 37.5kg per sensor in the United States. Now that you’ve been schooled on that, the following Wii Balance Board calibration information from WiiBrew will make more sense.

Each sensor returns 2 bytes of data and also has six bytes of calibration data. Think of it as a 16 bit number and three calibration numbers, that are also 16 bits apiece. The three calibration numbers correspond to the sensor reading for 0 kg, 17 kg, and 34 kg (those numbers should look familiar if you look at the previous paragraph). So if sensor #1 gives a value of 5725 and the 34 kg number is also 5725, then that sensor is reporting exactly 34 kg of weight on it.

The WiiBrew page says “Calculating the weight on each sensor simply involves interpolating between the two calibration values your reading falls between (or using the higher two values if your reading exceeds the highest calibration value), and the total weight on the board is the sum of these [four sensor] values.”

With that info, let’s go back to one of my sensor readings and convert it to actual kg. Take the reading “right_top 3618 [2293, 4004, 5725]“. The sensor value is 3618, which is between the 0 kg calibration number of 2293 and the 17 kg calibration number of 4004. So the weight on the right_top sensor is 17kg * (3618-2293)/(4004-2293) or 17kg * 0.7744 or 13.2 kg. I tend to put my weight on the back of my feet, which is why 13.2 kg is a little lower than my total weight (82 kg) divided by the four sensors, which would be 20.5 kg per sensor.

If your eyes haven’t completely glazed over, the upshot is that the Balance Board has four independent weight sensors, each calibrated to kilograms, and you can read those sensors in real-time over Bluetooth. Translating the sensor values into weight only takes four lines of Python code. From there, you can do anything you want with that data. Play a game, hook your Wii Balance Board up to Google Earth, or you can even automatically upload your weight to a Google Spreadsheet.

For example, you can run the command “sudo apt-get install python-pygame” to install pygame. Then go back to this page and download the scalesgui.py and system.ini files as you did before (click on them, then click on “Original Format” at the bottom of the resulting page). Make scalesgui.py executable with “chmod a+x scalesgui.py” and comment out the “EXT_BALANCE” if statement, then run “./scalesgui.py” and this is what you’ll see:

Scalesgui program

This is a snapshot, but the program runs just as fast as any video game. You can lean and move the circle around really fast. And in the bottom right, you can see that I weigh 81.74 kg, which is about 180 pounds.

I know this is a long post, but the upshot is that with 10-15 minutes of work, you can use a Wii Balance Board as a real-time sensor with Linux. I hope you have fun!

66 Responses to Use a Wii Balance Board with Linux (Leave a comment)

  1. Matt, you never cease to amaze me, GREAT STUFF! I love our WII FIT man.

  2. I couldn’t believe that the Wii Balance Board is essentially just a Bluetooth device. It’s not hard to hook up on Linux, and it doesn’t take a lot of code hacking..

  3. Off-topic but great for a laugh on a Friday. Inspired by a reputation management blog post I was reading I went to Google and searched (Bob Rains Sucks) your blog is number 1.

    Yeah, I LOL’d a little.

  4. You can get fit AND drive your cats nuts!

  5. Yeah, this could be a giant mouse…. imagine scrolling down on a site by leaning back on the balance board.. :)

  6. Wes

    Can Linux give your video camera some image stabilization?

  7. Are you going to demo that at Google IO next week? :)

    I know you are presenting on Thursday but I will be covering the Android sessions and Maile’s panel on Wednesday before flying back to San Diego – will you be at Google IO Wednesday floating around?

    Else I will see you at SMX Advanced the week after as you speak just after me that Tuesday.

    ,Michael Martin

  8. Great :)
    Inspiring tutorial ! Things are moving !
    It would be a day when our children couldn’t use our boaring keyboards and mouses :)
    I think Sensors applied on Google Sky Map application for Android are announcing new objectives for Google.

    Thanks Matt

  9. Michael Martin, I probably will be floating around on Wednesday. If you see me, say howdy!

  10. I wonder if you could use this as diy controller for flying or racing games and i bet ther could be some interesting uses for live music performance if you hooked it up to Middi and used it to controll playback from somthing like Live.

    of course we want to see video of your cats on teh board :-)

  11. Matt, I’m not impressed until I see your cats playing Tuxracer using this as a controller ;)

  12. Very cool,

    Had not heard or thought about trying to connect Wii & Wii-stuff to Linux. Maybe I should try this if I get to take some vacation sometime.

    Im rather positive surpriced of the balance board (got one some weeks ago). Good for the mood general and some morning practise positive affect the work I get done before lunch.

  13. Love the post. I just did a project with an iPhone and a linksys router to make a home brew RC rig. This is soo much cooler though because:

    1) You can now make wii style games for linux.

    2) Were one step closer to a bad ass flight sim for linux with working rudder pedals. Niceeee.

    Josh

  14. This is too nerd…
    I just love to use it with wii fit~

  15. Didn’t you read the manual of the Balance Board?
    You should always take your shoes off before stepping on the balance board.
    And don’t jump on it ;-)

  16. Wow.
    I never thought you could connect a Wii to a Linux. Thanks!

  17. MSG

    Has anyone successfully use cwiid to connect both a wiimote and a balance board simultaneously? Any ideas how? (I am getting socket connect error when I try to do that). I can connect to either wiimote or balance board separately though.

  18. pengy

    Excellent. Just got this working on my eeepc 901 running Ubuntu Jaunty. Any idea what I need to do next to make it control tuxracer ?

  19. Matt you have way too much time on your hands. ;)

  20. I’m presuming you have all seen http://www.youtube.com/watch?v=Jd3-eiid-Uw&feature=player_embeddedApparently

    Looks like the Wii is destined for greatness.

  21. MSG

    … never mind my previous comment. It was the bluetooth adapter’s fault. I bought the iogear bluetooth adapter and now I can connect to multiple remotes at the same time. Yeepee!

    The little scale app is a nice example. Thanks. Btw, considering the 34kg threshold per sensor the center of mass will be inaccurate whenever any sensor(s) exceeds their pressure counts. One can go around fixing this, and still get an accurate center of mass position whenever ONE sensor exceeds its threshold. You should be able to derive the “faulty” sensor’s actual weight simply by knowing the other three sensor’s weights and the total (pre-scaled) weight. Say sensor 1 exceeds its 34kg threshold => the actual weight is w1 = w – (w2+w3+w4). You may be able to solve the weight distribution even for TWO sensors exceeding their thresholds (with some more complicated math and static mechanics). I don’t think you can do it with three or (obviously) four sensors exceeding their thresholds.

  22. oniboy

    Pengy, ive been trying to get this to compile on Jaunty without any luck. Make keeps telling me that glib & gtk are missing but I know theyre not. How did you manage to get this installed ?

  23. Good old Wii Fit board! Great for weighing your baggage before you go away on you holidays so you don’t get charged for over weight baggage! Not sure about getting it hooked up to my Linux computer though, bit OTT!!!

  24. Donal

    Hi When I run autoconf I get the following error (on Ubuntu 9.04 Jaunty Jackalope):

    ~/wiibalance/svn/trunk$ ./configure –libdir=/usr/lib
    checking for gcc… gcc
    checking for C compiler default output file name… a.out
    checking whether the C compiler works… yes
    checking whether we are cross compiling… no
    checking for suffix of executables…
    checking for suffix of object files… o
    checking whether we are using the GNU C compiler… yes
    checking whether gcc accepts -g… yes
    checking for gcc option to accept ISO C89… none needed
    checking for gawk… gawk
    checking for flex… flex
    checking lex output file root… lex.yy
    checking lex library… -lfl
    checking whether yytext is a pointer… yes
    checking for bison… bison -y
    checking for python… python
    checking for pthread_create in -lpthread… yes
    checking for hci_devid in -lbluetooth… yes
    checking for dlopen in -ldl… yes
    checking how to run the C preprocessor… gcc -E
    checking for grep that handles long lines and -e… /bin/grep
    checking for egrep… /bin/grep -E
    checking for ANSI C header files… yes
    checking for sys/types.h… yes
    checking for sys/stat.h… yes
    checking for stdlib.h… yes
    checking for string.h… yes
    checking for memory.h… yes
    checking for strings.h… yes
    checking for inttypes.h… yes
    checking for stdint.h… yes
    checking for unistd.h… yes
    checking for stdint.h… (cached) yes
    checking bluetooth/bluetooth.h usability… yes
    checking bluetooth/bluetooth.h presence… yes
    checking for bluetooth/bluetooth.h… yes
    checking for bluetooth/l2cap.h… yes
    checking for bluetooth/hci.h… yes
    checking linux/input.h usability… yes
    checking linux/input.h presence… yes
    checking for linux/input.h… yes
    checking for linux/uinput.h… yes
    checking for library containing strerror… none required
    ./configure: line 4678: syntax error near unexpected token `GTK,’
    ./configure: line 4678: `PKG_CHECK_MODULES(GTK, $pkg_modules)’

    Can anyone help
    Thanks
    Donal

  25. Matt, this is such a cool hack that we’d like to incorporate it into Wired’s “beer robot” project — a homemade kegerator that we want to enhance with Wired-worthy digital interactivity. We’re thinking a Wii balance board underneath the keg might be just the thing to help drive a Twitter account that could alert us if it’s running low, for instance.

    If you — or anyone reading this blog — are interested in helping us in exchange for free beer (seriously!), please drop me a line: wired (at) tweney.com.

  26. Donal: Make sure all packages are installed, then run autoreconf. Note the re, running autoconf again won’t help. :)

  27. Matt Wallace

    Hi, This is an excellent post and I’ve spent the last few hours thinging about the fun I can have with this!

    Unfortunately when I run the scalesgui.py script, I get the following error:

    ~/wii$ ./scalesgui.py
    Please press the red 'connect' button on the balance board, inside the battery compartment.
    Do not step on the balance board.
    Traceback (most recent call last):
    File "./scalesgui.py", line 96, in
    wiimote.rpt_mode = cwiid.RPT_BALANCE | cwiid.RPT_BTN
    AttributeError: 'module' object has no attribute 'RPT_BALANCE'

    wmgui and wmimput work fine for the wiimote, I just can’t get the board working!

    Thanks in advance for any help,

    M.

  28. Oscar Rosales

    I have the same problem using kubuntu and Wii using weighdemo.py :

    Put Wiimote in discoverable mode now (press 1+2)…
    Traceback (most recent call last):
    File “/home/orosales/Escritorio/weighdemo.py”, line 59, in
    sys.exit(main())
    File “/home/orosales/Escritorio/weighdemo.py”, line 16, in main
    wiimote.rpt_mode = cwiid.RPT_BALANCE | cwiid.RPT_BTN
    AttributeError: ‘module’ object has no attribute ‘RPT_BALANCE’

    What can you solve this?

  29. praxis

    For people with this error:


    ...
    ./configure: line 4678: syntax error near unexpected token `GTK,’
    ./configure: line 4678: `PKG_CHECK_MODULES(GTK, $pkg_modules)’

    I solved it by installing libtool, and running autoreconf and ./configure

    sudo apt-get install libtool
    autoreconf
    ./configure --libdir=/usr/lib

  30. ayllu

    Great job!!! I think will be a great idea that linux gamer developers can make new games using wii hardware

  31. ayllu

    you know if it work whit dolphin, de wii emulator

  32. Matt Wallace

    This rocks, I’ve got it all working using the latest git checkout, however I’m still having issues getting my head around the math!

    Is there a quick and easy way to work out when the centre of the grid is reached and how far away from the centre you are?

    If there’s not an easy way, can someone point me in the direction of a few tutorials? Google is not my friend tonight!

  33. elden

    I had a very minimal installation ubuntu so I needed to do a couple of other things as well
    I think the summary of the things that were useful are.

    cd …/abstrakraft-cwiid-2100f14/
    sudo apt-get install libtool
    sudo apt-get install automake
    aclocal
    autoconf
    ./configure
    #I had done a previous install of the exeuctables
    #sudo apt-get install bluez-utils libbluetooth-dev libbluetooth2
    #sudo apt-get install libcwiid1 libcwiid1-dev wmgui
    #sudo apt-get install wminput
    #sudo apt-get install lswm
    #sudo apt-get install wmdemo
    # so they recomend removing the other libs….
    sudo make uninstall && make uninstall_config

  34. elden

    Oh yea, then do a make; — which failed because I don’t have Python …. but I went into the wmdemo directory and could make just that.

    Does anyone know how to avoid the need for hitting the 1&2 buttons?
    After I’ve talked to it once and have the bdaddr, I would have thought I could use that to establish contact as soon as my computer and the wiimote could see each other.
    Any thoughts?

  35. Sven Lankes

    Could you stick the files somewhere so that they can be downloaded? The abstrakraft
    site is down.

    While the actual cwiid code has moved to http://github.com/abstrakraft/cwiid this doesn’t
    include your sample-scripts.

  36. I would also like to have the weighdemo.py, scalesgui.py and system.ini files as they are not available at the new CWiid website and old one is down. Even the webmaster mail account for the old site is disabled now. The .py files can be fetched from google cache, but the .ini file is not available :-(.

    http://74.125.77.132/search?q=cache:pUno80xq8E4J:abstrakraft.org/cwiid/attachment/ticket/63/weighdemo.py+weighdemo.py&cd=1&hl=en&ct=clnk
    http://74.125.77.132/search?q=cache:GkT-z8g_rF0J:abstrakraft.org/cwiid/attachment/ticket/63/scalesgui.py+scalesgui.py&cd=1&hl=en&ct=clnk

  37. will

    So I have had considerable trouble getting this to work on my system. I don’t have the exact details right now but I want to use the balance board for data collection for a masters level research project in university. I have amateur hacking skills and would like some help.

    Ultimately I would be interested in a tracking of COG of the person on the balance board under a few differing conditions with pre and post treatment data collection. The data sets would be captures every second or so that could then be graphed and manipulated later with google spreadsheets etc. Or even captured to a text file would suffice.

    The problems seem to be multiple with each step. I am attempting it on a eeepc, with ubuntu 9.10. All apps are installed (the “libtool” tip from praxis helped) but progress stalled after compiling where the device seemed to not connect. The wii remote worked fine but the balance board itself was not recognised.

    Please help!

    Will

  38. Clara

    Matt and Will:
    Matt, thanks a lot, great post. I compared the weight given by scalesgui (now it’s available again)
    and by the original wiifit. Wiifit says consistently that the weight is about 500grm lower. We think wiifit
    assumes that light clothes weigh about half a kilo and subtracts that from the weight it mesaures.

    Will.
    we are doing something similar, also at a university. We write a plain text file. We took Matt’s wmdemo
    c file and added a case after case ‘s’:
    case ‘Z’:
    tiempo=100*100;
    fout=fopen(“salida”,”w”);
    if(fout == 0)
    {
    printf(“Can’t open file n”);
    break;
    }
    for(i=0;i < 100*20; i++)
    {
    if (cwiid_get_state(wiimote, &state)) {
    fprintf(stderr, "Error getting staten");
    printf("Error getting staten");
    }
    fprintf(fout," %d ",i);
    miprint_state(&state);
    usleep(tiempo);
    }
    fclose(fout);
    printf("finishedn");
    break;

    The output file is called 'salida'. We process it afterwards using matlab or octave.
    Write to us if you want the whole file (claraeugenia4444@gmail.com).
    Or, to use scalesgui.py, there are instructions por file i/o in python at
    http://www.penzilla.net/tutorials/python/fileio/
    Have fun.

  39. James

    Hi all,

    does anyone know how many balance boards can be attached to a PC at any one time?

    The reasons I ask is that if I could attach 4, it would be a great alternative to paying >£1000 for a weigh scales for racing cars! (If the max capacity is large enough – would need about 200kg/corner – does the board run out of sensor range before then?). The fact it has multiple sensors per board could also be used to calculate the caster and camber of the tyres as well! Perhaps even the toe settings….

  40. Wayne

    Hi, this has been excellent – except when I try to patch it tells me that the patch has been applied already. But the cwiid lib in python doesn’t have RPT_BALANCE or some of the other constants provided by the patch. Has anyone else had this error? I’m running Ubuntu 9.10

  41. clara

    Will,
    we now have scalesgui with optional writing to external text file.
    If you want it just e-mail to address in previous message.
    Clara

  42. Zac

    Has anybody tried using the balance board on Windows, instead lof Linux. I need to use it on Windows OS.

  43. bill kirksey

    Matt Cutts, Clara, and/or Will,
    I recently experienced a very debilitating loss of my balance are in physical rehab to recover. I ran across Matt’s article and are intrigued with benefits of measuring balance data during my recovery, thinking it would be a motivational tool at least. I would like to put this together but I am not knowledgeable about Linux and really don’t know where to start. I do have a Nokia N800 internet tablet which is Linux based if that would make the implementation easier, (otherwise I only have windows based machines.) Can anyone help me out or point to a direction where I might get some help. Thanks in advance for your help.
    Bill K.

  44. Justin

    Clara – I would very much like to use this scalesgui your research team has created – I would of course give your team credit for the program if our paper gets published or otherwise obtains notoriety (potentially presenting at a conference). I have sent you an email to the above address! I look forward to hearing back from you!

    -Justin

  45. Tim

    Hey Matt,

    I was wondering if you could give me the code you used to pull this off? I would really appreciate it. Also, does the code work if say the weight was placed in the exact center of the boar? If not, what would need to be modified. Thanks for the help and the awesome video!

    Thanks,
    Tim

  46. Audun MG

    Hi,
    I just wanted to say thanks a lot for your effort!
    However, it seems that it your code has gone more or less unmodified now and has some bit rot.
    After some tweaking i got it working, and it was awesome, and now my balance board functions as a mouse :D

    Tim:
    If you are running debian/ubuntu you can do apt-get install libcwiid and find Matt’s code at http://abstrakraft.org/cwiid/ticket/63
    The weighdemo.py is the easiest to build from.
    Something seems to be wrong in the way the board is detected, so just uncomment the lines under
    if wiimote.state['ext_type'] != cwiid.EXT_BALANCE:
    print ‘This program only supports the Wii Balance Board’
    to
    #wiimote.close()
    #return -1
    If it does not work, try again, it works after a while, and consider adding a sleep instead of waiting for input, it shows how inaccurate the board is.
    To get the “real” weight, i heard somewhere that it is approximated best if you gather some samples and take the median from that.
    Good luck!

  47. clara

    Matt and Justin:

    Justin, I did not receive your mail so I don’t know where to send the file. It is Matt’s scalesgui plus 10 lines to write to an external text file if desired. All the hard work is Matt’s.

    Matt, you may want to add our version of scalesgui to your repository in case other people
    are interested. If you want it please let me know where to send it.
    Also a question: any idea if it is possible for the computer to “remember” the pairing
    info so we wouldn’t have to press the little red button in the balance board every time?
    Thanks.

    Clara

  48. Michael

    Clara:

    Concerning the annoying red button; I’ve been fighting with the same thing for a little while now. The most information I’ve come across so far is: http://abstrakraft.org/cwiid/discussion/topic/129 .

    It does seem possible, but you may have to modify the bluetoothd to send a proper pin code. Haven’t gotten around to that yet, but hopefully I will soon.

    If anyone else has any idea on how to solve the red button issue, please share, having to flip the board to sync each time I intend to use it really puts me off using it at all :(.

  49. clara

    TO Oscar Rosales:
    If you are still having the problem with
    wiimote.rpt_mode = cwiid.RPT_BALANCE | cwiid.RPT_BTN
    AttributeError: ‘module’ object has no attribute ‘RPT_BALANCE’
    and you are using python 2.6:
    try switching to python 2.5

    To Michael:
    Abstrakraft seems to be down again so I can’t see the link.
    We are using a battery pack (by Nyko) and at least the little red button is OUTSIDE
    the battery pack. We are looking for some kind of piston to push that button without
    flipping the board.
    It would be great if you could fix bluetooth.
    Clara

  50. David

    Hi Matt.
    This is great!!! I want to use the Balance Board with Ubuntu and use it with some OS Games like Urban Terror in order to do this game more realistic. If you stay on the balance board and balance your body to left or right, your character will do the same. If you are behind a wall, you can balance in order to take a look on the aisle, for example.
    Well… unfortunately, I can pass the step related to the SVN: svn co http://abstrakraft.org/cwiid/svn/

    It doesn’t work. Could you fix it?

    Thanks.

  51. clara

    Hi,
    one can find out the MAC address of the balance board by writing lswm in a terminal
    and pressing the little red button. Does anyone know if that info can be incorporated
    into Matt’s code to avoid pressing the button every time?
    Thanks.
    Clara

  52. Sn3akyP3t3

    David, the cwiid code has moved away from svn and now uses git. Try “git clone http://github.com/abstrakraft/cwiid.git“. Audun MG, I don’t see libcwiid as an available repository package. However there is references to libcwiid0-dev, libcwiid1-dev, libcwiimote-0.4, libcwiimote-dbg, libcwiid1, libcwiid-dev, libcwiimote3, and libcwiimote-dev in Ubuntu 10.04. Praxis, thanks for posting to resolve the make error.

  53. Craig

    This is excellent, I have it working from the latest git checkout from cwiid. I do have one problem though, when running the weighdemo the board with nothing on the board, comes up as 8kg. When running the scalesgui.py, the red flash is in the bottom left corner. If I press hard on the opposite corner, when it gets to the middle it reads about 17kg on the weight. It seems as though the bottom left corner is registering at full weight (34kg), even though it has no weight. I am not a programmer (happy to tinker though), can someone please give some clues on where I should look. Btw the board was bought in britain, if that makes any difference.

  54. craigvv

    Hi,

    excellent project. I have the board all set up, but it appears the the lower left sensor it registering at full, when it should be enmpty. I have been able to guess this as when I move the dot back to the middle in scalesgui it registers at about 17 kg. This board was purchased in Britain. Any clues in how i go about changing this, I am not a programmer, but can get about ok. Just somewhere to start would be great.

    Cheers
    Craig

  55. Ben

    Anyone getting it to work with python 2.6 and libbluetooth3?

    When compiling I get this:
    make[1]: Betrete Verzeichnis ‘/home/benni/wiibalance/cwiid/wmdemo’
    gcc -L../libcwiid -o wmdemo wmdemo.o -lcwiid
    /usr/bin/ld: wmdemo.o: undefined reference to symbol ‘str2ba’
    /usr/bin/ld: note: ‘str2ba’ is defined in DSO /usr/lib/libbluetooth.so.3 so try adding it to the linker command line
    /usr/lib/libbluetooth.so.3: could not read symbols: Invalid operation
    collect2: ld returned 1 exit status
    make[1]: *** [wmdemo] Fehler 1
    make[1]: Verlasse Verzeichnis ‘/home/benni/wiibalance/cwiid/wmdemo’
    make: *** [wmdemo] Fehler 2

  56. Ben

    And when using cwiid package in ubuntu, which says svn210 in its name I get this:

    ./scalesgui.py
    Please press the red ‘connect’ button on the balance board, inside the battery compartment.
    Do not step on the balance board.
    Traceback (most recent call last):
    File “./scalesgui.py”, line 173, in
    readings = wiimote.state['balance']
    KeyError: ‘balance’

  57. Steve

    I’ve just discovered your article looking for Wii Fit style games for Linux. And it is pretty amazing. I assume one cannot find a Nintendo board alone in retail ?
    Well, this might lead me to buy one, I do like video game devices used for other purposes.

  58. patching file python/cwiidmodule.c
    Hunk #1 FAILED at 96.
    Hunk #2 FAILED at 153.
    2 out of 2 hunks FAILED — saving rejects to file python/cwiidmodule.c.rej
    patching file python/Wiimote.c
    Reversed (or previously applied) patch detected! Assume -R? [n] -R
    Apply anyway? [n] n
    Skipping patch.
    6 out of 6 hunks ignored — saving rejects to file python/Wiimote.c.rej
    patching file libcwiid/process.c
    Hunk #1 FAILED at 182.
    Hunk #2 succeeded at 249 with fuzz 1 (offset 25 lines).
    1 out of 2 hunks FAILED — saving rejects to file libcwiid/process.c.rej
    patching file libcwiid/cwiid_internal.h
    Reversed (or previously applied) patch detected! Assume -R? [n] -R
    Apply anyway? [n] n
    Skipping patch.
    2 out of 2 hunks ignored — saving rejects to file libcwiid/cwiid_internal.h.rej
    patching file libcwiid/interface.c
    Hunk #1 succeeded at 213 (offset 34 lines).
    patching file libcwiid/state.c
    Hunk #1 succeeded at 86 with fuzz 2 (offset 11 lines).
    Hunk #2 succeeded at 188 with fuzz 2 (offset 16 lines).
    Hunk #3 succeeded at 257 with fuzz 1 (offset 24 lines).
    patching file libcwiid/cwiid.h
    Hunk #1 FAILED at 75.
    Hunk #2 FAILED at 165.
    Hunk #3 FAILED at 173.
    Hunk #4 succeeded at 170 with fuzz 1 (offset -17 lines).
    Hunk #5 succeeded at 235 with fuzz 1 (offset -3 lines).
    Hunk #6 FAILED at 259.
    Hunk #7 FAILED at 277.
    Hunk #8 FAILED at 340.
    6 out of 8 hunks FAILED — saving rejects to file libcwiid/cwiid.h.rej
    patching file libcwiid/bluetooth.c
    Reversed (or previously applied) patch detected! Assume -R? [n] n
    Apply anyway? [n] n
    Skipping patch.
    1 out of 1 hunk ignored — saving rejects to file libcwiid/bluetooth.c.rej
    patching file libcwiid/thread.c
    Reversed (or previously applied) patch detected! Assume -R? [n] n
    Apply anyway? [n] n
    Skipping patch.
    1 out of 1 hunk ignored — saving rejects to file libcwiid/thread.c.rej
    patching file wmdemo/wmdemo.py
    Reversed (or previously applied) patch detected! Assume -R? [n] n
    Apply anyway? [n] n
    Skipping patch.
    5 out of 5 hunks ignored — saving rejects to file wmdemo/wmdemo.py.rej
    patching file wmdemo/wmdemo.c
    Reversed (or previously applied) patch detected! Assume -R? [n] n
    Apply anyway? [n] n
    Skipping patch.
    6 out of 6 hunks ignored — saving rejects to file wmdemo/wmdemo.c.rej

    this is from the dry run. is this because of the change from python2.5 to 2.6?

  59. RB

    This is great! I will be trying this out soon. I am doing a research project with the balance board and was wondering if there is a way to record the coordinates and maybe weight to a file? I’m testing the balance accuracy of the board and need to find a way to extract the data. Maybe the coordinates and weight every second or 5 seconds. Thanks!

  60. Harry

    Hi Matt, I have tried your tutorial, but when I run the weighdemo.py , it always display ” unknown message type ” on my screen. what’s wrong? something bad happened to my wii board? Thanks very much!

  61. uahmed

    hi

    When i try to install it on Ubuntu 10.04 and run he first command

    sudo apt-get install autoconf autogen automake gcc bluetooth libbluetooth2-dev libgtk2.0-dev pkg-config python2.5-dev flex bison subversion

    it throws me this error

    E: Couldn’t find package libbluetooth2-dev

    Any help ?

  62. Hi Matt,

    How I can measuring the center of pressure (axis x and y) with Wii Balance Board? Is it Linux show only weight or also show the percentage of the body weight discharge?

  63. Alex

    Hey, do you have any idea if your code could be a bridge between wii balance board and dolphin emu?

    Thhx

  64. Hi everybody,

    could someone (Matt or someone that knows how to do it) please post exactly how can I set up my system (Ubuntu 10.04 LTS) to use the Wii Balance Board? Some libraries and/or repositories are no longer available (e.g. libbluetooth2-dev, http://abstrakraft.org/cwiid/svn/) and it is actually impossible for me to install the software (I can already talk to the Wiimote). I think that a lot of people use the Ubuntu LTS distribution, so it will be a great help to all!

    Thank you in advance for your kind help, Stefano

  65. Dear all,

    I find the solution to install the software and use it the wii balance board for the Ubuntu 10.04 LTS; I report the working commands:

    1# To install all you need type this command:
    sudo apt-get install autoconf autogen automake gcc bluetooth libbluetooth3-dev libgtk2.0-dev pkg-config python2.6-dev flex bison git-core libbluetooth-dev python-pygame python-tk

    2# Make the directory to hold the wiibalance software:
    mkdir ~/wiibalance
    cd ~/wiibalance

    3# Retrieve the Cwiid library:
    git clone http://github.com/abstrakraft/cwiid.git

    4# Enter into the cwiid directory and compile it:
    cd cwiid
    aclocal
    autoconf
    ./configure
    make
    sudo make install

    5# At this point you can test if the Wii Remote works with the GUI with the command:
    wmgui

    6# If all is fine you can install the phyton bindings:
    cd python
    sudo python setup.py install

    7# And then install the Wii balance board software:
    git clone git://github.com/videntity/python-omhe.git
    cd python-omhe
    sudo python setup.py install

    8# Now you can check if the Wii Balance Board works with the system:
    cd python-omhe/omhe/hardware/wiibalance
    python ./wiibal-weighdemo.py

    9# If all works fine, you can now copy the “scales” application files “scalesgui.py and system.ini” from the page “http://abstrakraft.org/cwiid/ticket/63″, change the permission and run it:
    chmod a+x scalesgui.py
    ./scalesgui.py

    Enjoy it! ;-)

    Note: to exit the program you should press the “F12″ key.

  66. Hi again,

    more than 1 year ago (June 21, 2010) Clara asks about the possibility to incorporate into the Matt’s code the MAC address of the used wii in order to avoid pressing the red button every time you start the program.

    It should be possible because the connection with the original Wii works exactly in this manner. The first time you should “connect” the Balance Board to the Wii with the red button in the battery compartement, then you only have to press the button in the front of the Balance Board to have the connection (the Wii memorize the MAC address).

    Someone has this feature already implemented? If yes, it’s possible to have the code?

    Many thanks in advance,

    Stefano

Leave a Comment

Your email address will not be published. Required fields are marked *

*

If you have a question about your site specifically or a general question about search, your best bet is to post in our Webmaster Help Forum linked from http://google.com/webmasters

If you comment, please use your personal name, not your business name. Business names can sound salesy or spammy, and I would like to try people leaving their actual name instead.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

css.php