Shop OBEX P1 Docs P2 Docs Learn Events
Wii Nunchuck interface object - Page 2 — Parallax Forums

Wii Nunchuck interface object

2»

Comments

  • soshimososhimo Posts: 215
    edited 2008-12-20 19:59
    Thank you for the nice comments [noparse]:)[/noparse].

    @Baggers - if you run into any issues drop me a line, I may have already went down that rabbit hole and might know a solution.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2008-12-21 23:50
    Jay, have you had any success?· Attached is a project that worked for me.· I was using a Nintendo Nunchuk with a Propeller DemoBoard.· I used 4.7 kOhm pullups.
  • Jay KickliterJay Kickliter Posts: 446
    edited 2008-12-22 03:10
    John, it never did work for me. I'm of town for a while, I'll surely try your code when I get back.

    I've been doing a lot of work integrating my Prop with Cocoa (OS X), sending data back and forth. It would be cool to get this Nunchuck to work, it would make for a fun interface.
  • JoJo Posts: 55
    edited 2008-12-22 17:07
    soshimo,

    you're most welcome. Glad that you found use for the object and that it worked for you.

    Jay et all: The nunchuck is supposed to be driven to 3.3V though it is tolerant of 5V supply. In my project I just attached it directly
    to the I2C eeprom lines (pins 28, 29) on the propboard and didn't add any extra pullups (there is already a pull up on the SDA line on the propboard);
    It is quite picky on the exact I2C timing/protocol and I had mixed results using other I2C objects other than i2cObject from OBEX (specifically, this one:
    i2cObjectv2, http://obex.parallax.com/objects/251/ ).
    I also only experimented with Nintendo Wii Nunchucks, so have no idea whether the access protocol works for clones.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    Jo
  • BaggersBaggers Posts: 3,019
    edited 2008-12-23 11:36
    Got it working, [noparse]:)[/noparse] thanks all lol
    Was the nut between keyboard and chair lol
    thinking it was initially 5v I2C connected to other pins, and put inline resistors on pins etc, must have switched clk and data, then went back to 28,29 after finding they were usable on 3v3, but forgot to change the source pins [noparse]:D[/noparse] silly me.
    sorry to all, and thanks for the help.

    Funny how you can see it, ( very clearly might I add lol ) once you've had a decent nights sleep, and not been mega busy with work [noparse]:)[/noparse]

    Baggers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • RaymanRayman Posts: 14,849
    edited 2008-12-29 17:05
    I just noticed a wireless nunchuck at BestBuy:

    http://www.bestbuy.com/site/olspage.jsp?skuId=8778931&type=product&id=1204332499640

    I'm guessing that the little adapter is a wireless-to-i2c converter...· So, this looks like an easy way to add wireless control to a project...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-03-03 02:48
    @Jo
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-03 04:38
    This would be the perfect joystick for my turret

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Jimmy W.Jimmy W. Posts: 112
    edited 2009-03-03 18:19
    Now to do this the other way around, prop to the wiimote, emulate the nintendo pad and get a perfect mario brothers game [noparse]:)[/noparse]
  • Old man EarlOld man Earl Posts: 46
    edited 2009-03-15 18:20
    Hi, I have taken a Wii knockoff apart and it has a Uprocessor and 3 axis accl in it. The ckt board cuts very nicely electronically. I hooked it up to pins 28 and 28 on my prop board and tried various spin programs, but the data it very sparse. I suspect the i2c protocol. I am powering it with the 3.3 v from the prop. Anyone else have any luck ???
    Earl
  • Old man EarlOld man Earl Posts: 46
    edited 2009-03-16 23:12
    well, The i2c appears to be communicating with the nunchuck. Only problem the data ia always the same.
    939,170,572 for the accelerometer xyz and 46,186,1,0 for the joystick and buttons.
    I understand why the joystick and buttons are the same, I cut that part of the cktbrd off and only have the u-processor and accelerometer chips. The white=gnd, red = 3.3 v, the yellow = clock Pin 28 on prop and green = data Pin 29 on prop are there. I put a 2 ch. scope on clock and data and I see activity. On data I see 9 bits returned. My n-chuck is on address 0xA0. I found that out by an i2c scan program. BTW I also see something on 0xA4. I thought the 0xA0 was the eeprom on the prop board and 0xA4 would be the n-chuck. Doesn't appear to be though. If I change the n-chuck address to 0xA4 I see 1023,1023,1023 for the accelerometer xyz and 255,255,0,0 for the joystick and buttons which seems to me that the n-chuck is not on that address. Yes I print out the read array different than I acquire it. These units would make a readily available 3 axis accelerometer from Best Buy. Here is my code. (most from the parralax obj's)
    I'll post my code in next post.

    Any help ???
  • Old man EarlOld man Earl Posts: 46
    edited 2009-03-16 23:21
    Here is my code.(most from Parrelax obj's)

    The i2c scan outputs to TV as well as my other program, it outputs to TV also.
    I hope someone can find the bug........
    Earl
  • Old man EarlOld man Earl Posts: 46
    edited 2009-03-16 23:50
    How do you change the speed of the i2c on the prop ?
  • Old man EarlOld man Earl Posts: 46
    edited 2009-03-17 04:34
    Who says ya cant beet the software into submission !!!!!
    The n-unchuck wasn't being initialized properly !
    The correct i2c address for it is 0xA4

    More on this in the sandbox forum under Cheap Accelerometers

    here is a pic ...
    Earl

    Post Edited (earl@uphi.net) : 3/17/2009 5:51:40 PM GMT
    1148 x 843 - 562K
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-03-17 04:40
    The I2C objects i have seen don't allow for speed changes. However I have been wanting to find time to write a more complete I2C object with speed control because it will be more robust when ported to the Prop II when that comes out or for those that run the Propeller at various speeds.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • youngdaveyoungdave Posts: 70
    edited 2009-09-08 23:12
    Dear All
    I have the nunchuk working and displaying the data.
    I've read the posts on this question, but I still can't get a handle on what the accel X, Y, Z numbers actually mean. They seem to represent tilt rather than acceleration.
    Can anyone point me to a comprehensive spin-specific explanation of the nunchuk outputs, and how to calculate acceleration etc.
    TIA David Young
  • RaymanRayman Posts: 14,849
    edited 2009-09-09 00:42
    Youngdave: It looks like tilt because you're seeing the effect of Earth's gravitational pull on the accelerometer... A one axis accelerometer will read +1 G when pointed up (for example), zero when pointed sideways, and -1 G when pointed down...

    PS:· Accelerometers are often used to measure tilt this way...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • DogPDogP Posts: 168
    edited 2009-09-09 17:15
    Yeah, if you check out my Nunchuck object: http://obex.parallax.com/objects/469/ , it outputs acceleration in all axes, as well as roll/tilt, which are calculated from that. When the nunchuck is not accelerating, roll/tilt can be computed... when the nunchuck is accelerating, you can't, since it can't tell which accelerations are from gravity and which are from you moving it.

    For raw measurements, 1G seems to be ~210, so if 512 is mid range, when the nunchuck is perfectly still and with one axis parallel to the ground, you should have readings of around 512, 512, and 722. If you drop the nunchuck, free fall should give you 0Gs, or 512, 512, 512. If you move the object in just one direction, you should see a spike in the readings of that axis.

    DogP
Sign In or Register to comment.