Friday, November 16, 2012

AVR Atmega wii nunchuck library

Updated to version 02

AVR Atmega library for Wii Nunchuck

Nunchuck is a wii 2-axis joystick, two buttons and a 3 axis 2g accelerometer,
capable of I2C can communicate with it.



User can enable a avarage filter on accelerometer measurements.
An attitude (roll and pitch) estimation function can be enabled.
Calibration is suggested to get more accurate parameters.
To calibrate the device read the raw values using the get non calibrated mode
then calculate the offset.

This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 1MHz.



Changelog

  • 02: fixed attitude estimation
  • 01: first release


Code

Notes
  • read risk disclaimer
  • excuse my bad english

5 comments:

  1. Hi, about the code for the gui app, do you make it? Can you publish the code?

    ReplyDelete
    Replies
    1. hello, it's processing (processing.org), you can find the sketch code in the processing folder of the zip file.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. HI Davide! I'm trying to interface the wii wireless nunchuck with an atmega32 and i just came across your code. Firstly, thanks for posting! I've tried your settings for initialising the handshake but am having no luck - the nunchuck doesn't seem to like sending 0x00 to it! Do you have any tips for me? I'm tearing my hair out! Cheers.

    ReplyDelete
    Replies
    1. first steps: check that your i2c connection is working, wiring is setup the right way, it would be usefull if you a logic analyzer, if you do not have this, try debug with uart output. try to understaind where the code blocks.

      Delete