WiiNxtBalance

It’s cool if you can control the NXTway-GS robot using a gamepad as this guy is doing:

But since we are Wii addicted I’m going to teach you how to use the wiimote!
Follow the tutorial and you willl be driving the balancer (and eventually crash it :-) ) like a cowboy!

What you need:

  • lego NXT with OSEK firmware and the NXTway-gs program loaded
  • a wiimote of course
  • ubuntu and python with bluetooth modules
  • rfcomm,pybluez and pyserial
  • a python script to parse the wiimote data and send it to the lego nxt

First step is to install the nxtOsek firmware: instructions here. In the directory samples/nxtway_gs there’s the code for the balancing functions. I did a patch of the program to be controlled by the wiimote via bluetooth. You can download the code from here (already compiled).

The second step is to connect your NXT to your laptop via bluetooth and rfcomm -many thanx to Linus to helped me out with this problem!-, this script will help you to do it very easily btconnect).

#!/bin/bash

# script to ease connecting to an NXT brick
# (c) 2007 Johannes Ballé

# call either with a Bluetooth address or device name

if echo $* | grep -q ‘^..:..:..:..:..:..$’; then
MAC=$*
else
echo -n “Scanning for ‘$*’ … ” >&2
MAC=$( hcitool scan | grep ‘^    ..:..:..:..:..:..    ‘”$* *$” | cut -f 2 )
if [ -z $MAC ]; then
echo “not found.” >&2
exit 1
fi
if echo $MAC | grep -q ” “; then
echo “found multiple devices:” >&2
echo >&2
for i in $MAC; do
echo ‘    ‘$i >&2
done
echo >&2
echo “Use ${0##*/} with one of the addresses above.” >&2
exit 2
fi
echo “found $MAC.” >&2
fi

rfcomm -r connect rfcomm0 $MAC &

trap “kill $!” 1 3 9 15
wait

If the connection is going on well you should see this:

epokh@epokh-laptop:~/Documents/lego nxt$ sh btconnect.sh “NXT”
Scanning for ‘NXT’ … found 00:16:53:0A:8B:E4.
Connected /dev/rfcomm0 to 00:16:53:0A:8B:E4 on channel 1
Press CTRL-C for hangup

And the bluetooth-applet should ask for the passkey “1234″.

The last step is to run the wiimotenxt control script to interface your wiimote. Look for your wiimtoe address using:

hcitool scan

Then modifiy the script in the main function with the address you found:

w=Wiimote(”00:1E:35:DF:C5:75″,0)

Then run the script as:

epokh@epokh-laptop:~/wiimote$ python Wiimote.py
Attaching to Wiimote #1 at 00:1E:35:DF:C5:75
setled(0)
_send_command(0×52,0×11,[16])
opening serial port…
Enabling accelerometer.
_send_command(0×52,0×12,[0, 49])
_send_command(0×52,0×17,[0, 0, 0, 22, 0, 10])
Leaving _waitforpacket() after 2 packets
Got force calibration data: zero=[127, 128, 128], 1g=[152, 153, 153]
Receiving data from Wiimote #1

You can switch the control mode pressing B (’the rear button’). You can control either by the buttons either using the acceleration. The script corrects the gravity to give a better motion control.

Enjoy!

59 Responses to “WiiNxtBalance”

  1. Que faire avec une Wiimote et un robot… - Test de Geek Says:

    [...] Pour les détails swfobject.embedSWF(”http://www.youtube.com/v/dIdVl3c7HL8&rel=1&fs=1&showsearch=0&showinfo=0″, “vvq49eeb1a12540f”, “425″, “344″, “9″, vvqexpressinstall, vvqflashvars, vvqparams, vvqattributes); swfobject.embedSWF(”http://www.youtube.com/v/gUzgYcokIF4&rel=1&fs=1&showsearch=0&showinfo=0″, “vvq49eeb1a126422″, “425″, “344″, “9″, vvqexpressinstall, vvqflashvars, vvqparams, vvqattributes); Tags: robot, wiimot [...]

  2. Wiimote hacks: WoW control & self-balancing robot - SlashGear Says:

    [...] DarwiinRemote, that allows you to play World of Warcraft using the Wiimote; then, there’s a self-balancing robot made of LEGO NXT, that can be remotely controlled with [...]

  3. Video: WiiNxtBalance tools around, doesn’t fall down | RSS For Gadgets Says:

    [...] Read | Permalink | Email this | Comments [...]

  4. Video: WiiNxtBalance tools around, doesn’t fall down | NexGen Technology Blog Says:

    [...] Read | Permalink | Email this | Comments [...]

  5. Tech Twitter » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments Share and Enjoy: [...]

  6. Video: WiiNxtBalance tools around, doesn’t fall down · RSS z Zabawkami Says:

    [...] Read | Permalink | Email this | Comments [...]

  7. Techeroid » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments Share and Enjoy: [...]

  8. Video: WiiNxtBalance tools around, doesn’t fall down | All about MICROSOFT Says:

    [...] Read | Permalink | Email this | Comments No comments for this entry yet… [...]

  9. Video: WiiNxtBalance tools around, doesn’t fall down | My Blog Channel Says:

    [...] Read | Permalink | Email this | Comments ENGADGET [...]

  10. Video: WiiNxtBalance tools around, doesn’t fall down | GadgetGene Says:

    [...] Read | Permalink | Email this | Comments Share and Enjoy: [...]

  11. Video: WiiNxtBalance tools around, doesn’t fall down @ Hot N Cool Gadgets Says:

    [...] Read | Permalink | Email this | Comments [...]

  12. Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments Share and Enjoy: [...]

  13. Video: WiiNxtBalance tools around, doesn’t fall down | TechgearX.com Says:

    [...] Read | Permalink | Email this | Comments [...]

  14. Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  15. Video: WiiNxtBalance tools around, doesn’t fall down | Iklangadget.com - Information about Gadget Says:

    [...] Read | Permalink | Email this | Comments [...]

  16. Web Mirror | Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments [...]

  17. ZEITGEIST / Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  18. Video: WiiNxtBalance tools around, doesn’t fall down - Celebrity Gossip - Gossip Thug Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  19. The TechNexus » Blog Archive » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  20. Video: WiiNxtBalance tools around, doesn’t fall down – nerens Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  21. Video: WiiNxtBalance tools around, doesn’t fall down | Scyanide's RSS Collection Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email this | Comments    Posted in [...]

  22. Video: WiiNxtBalance tools around, doesn’t fall down | Top Hot Games Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email this | Comments Filed under: DS, PC, PS2, PS3, [...]

  23. Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email this | Comments Add this to : Digg it Save [...]

  24. Total Dream Blog » Blog Archive » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  25. Video: WiiNxtBalance tools around, doesn’t fall down | Technology sites Rss archive Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  26. Video: WiiNxtBalance tools around, doesn’t fall down | Fresh Random News Says:

    [...] Read | Permalink | Email this | Comments [...]

  27. Video: WiiNxtBalance tools around, doesn’t fall down : www.techtidbits.org Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  28. Video: WiiNxtBalance tools around, doesn’t fall down | OnOnPig Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  29. Video: WiiNxtBalance tools around, doesn’t fall down | Nero | neromix.com Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  30.   Video: WiiNxtBalance tools around, doesn’t fall down by Techno News Feed Says:

    [...] Read | Permalink | Email this | Comments [...]

  31. thenutroll tech news » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  32. Video: WiiNxtBalance tools around, doesn’t fall down | Christopher Kit Carson Mobley Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  33. Video: WiiNxtBalance tools around, doesn’t fall down | Dominic Fallows Says:

    [...] Read | Permalink | Email this | Comments [...]

  34. Video: WiiNxtBalance tools around, doesn’t fall down | bitbucket.kylewelsh.com Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  35. Blahoogle Gadget - The Quickest Way to Explore the World Gadget Everyday » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments [...]

  36. Video: WiiNxtBalance tools around, doesn’t fall down | The-Informer Says:

    [...] Read | Permalink | Email this | Comments [...]

  37. Video: WiiNxtBalance tools around, doesn’t fall down | Gadget-Daily | Gadget-Daily Says:

    [...] Read | Permalink | Email this | Comments [...]

  38. Video: WiiNxtBalance tools around, doesn’t fall down | TechBeat|Gather Tech News Says:

    [...] Read | Permalink | Email this | Comments [...]

  39. Video: WiiNxtBalance tools around, doesn’t fall down | Gadgets Says:

    [...] Read | Permalink | Email this | Comments [...]

  40. wouldbecool.com » Blog Archive » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  41. coren.us » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email [...]

  42. Video: WiiNxtBalance tools around, doesn’t fall down | Gadgetorium! Says:

    [...] Read | Permalink | Email this | Comments [...]

  43. linkfeedr » Blog Archive » Video: WiiNxtBalance tools around, doesn’t fall down - RSS Indexer (beta) Says:

    [...] appeared on Engadget on Thu, 23 Apr 2009 06:07:00 EST. Please see our terms for use of feeds.Read | Permalink | Email this | Comments Report This Post: Illegal content [...]

  44. Free Gadget News » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments Post tags: Bluetooth, Bot, Custom Firmware, Engadget, Hack, Lego Nxt, Nbsp, Robot, Robots, Video Tools, Wig, Wiimote Posted in: Gadżety | | [...]

  45. » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments [...]

  46. Video: WiiNxtBalance tools around, doesn’t fall down | Lancilo USA Says:

    [...] Read | Permalink | Email this | Comments [...]

  47. Video: WiiNxtBalance tools around, doesn't fall down | Technology Blog Says:

    [...] Read [...]

  48. Video: WiiNxtBalance tools around, doesn’t fall down | Ink and Virtue Says:

    [...] Read | Permalink | Email this | Comments Linking code follows…Copy/Paste the following code into your own blog, web page, or social networking profile.<a href="http://inkandvirtue.com/2009/04/23/video-wiinxtbalance-tools-around-doesnt-fall-down/" >Video: WiiNxtBalance tools around, doesn’t fall down</a> April 23rd, 2009 | Tags: Bluetooth, Bot, Custom Firmware, engadget, Hack, Lego Nxt, Nbsp, Robot, Robots, Video Tools, Wig, Wiimote | Category: Games | [...]

  49. Video: WiiNxtBalance tools around, doesn’t fall down | Gadgets World Says:

    [...] Read | Permalink | Email this | Comments [...]

  50. Video: WiiNxtBalance tools around, doesn’t fall down | TechRoo.com| Tech News, Gadget News Says:

    [...] Read | Permalink | Email this | Comments [...]

  51. Video: WiiNxtBalance tools around, doesn’t fall down | The gadgets Says:

    [...] Read | Permalink | Email this | Comments  [...]

  52. GPS Navigation » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments [...]

  53. Video: WiiNxtBalance tools around, doesn’t fall down | NewGadget.Info Says:

    [...] Read | Permalink | Email this | Comments [...]

  54. You Get The . Info » Video: WiiNxtBalance tools around, doesn’t fall down - 700th Edition Says:

    [...] Read | Permalink | Email this | CommentsBy Laura June [...]

  55. You Get The . Info » Video: WiiNxtBalance tools around, doesn’t fall down - 699th Edition Says:

    [...] Read | Permalink | Email this | CommentsBy Laura June [...]

  56. Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments [...]

  57. Gadget» Blog Archive » Video: WiiNxtBalance tools around, doesn’t fall down Says:

    [...] Read | Permalink | Email this | Comments [...]

  58. WiiNxtBalance | men - women - spot Says:

    [...] Read the original:  WiiNxtBalance [...]

  59. Control a Lego Mindstorms NXT Robot with a Wiimote | Hack N Mod Says:

    [...] earlier. This hack is for the NXT enthusiast and the guy who likes to do things with his Wii.  The project blog takes you through the programming needed to hack the NXT firmware and teach the robot some new [...]

Leave a Reply

You must be logged in to post a comment.