WII NUNCHUCK projects with Arduino Leonardo AVR-T32U4

Image

https://www.olimex.com/Products/Modules/Sensors/MOD-WII/MOD-Wii-UEXT-NUNCHUCK/ 

WII NUNCHUCK is low cost joystick and 3 axes accelerometer combo which could be read by I2C.

We created UEXT plug-in board which allow WII-NUNCHUCK to be used with any of our development boards with UEXT connector.

Here on this video: http://www.youtube.com/watch?v=fXa6AA9Aq_o

you can see four projects made with WII-NUNCHUCK

1. Mouse – you can move the mouse pointer with Joystick and to use the two buttons as mouse buttons

2. Sound – with the 3 axes accelerometer you can change the pitch of the generated tone

3. Driving two servos with the 3-axes accelerometer

4. Drivinig RGB stripe with MOD-RGB and MOD-WII-NUNCHUCK – as AVR-T32U4 have just one UEXT port we use the UEXTx5 extender.

The demo code is at GitHub: https://github.com/OLIMEX/DUINO/tree/master/AVR/WII-NUNCHUCK

AVR-T32U4 ARDUINO demo code for MOD-WII-NUNCHUCK interfacing

Image

Wii-Nunchuck is low cost combo of 3 axes accelerometer, 2 axes Joystick and 2 buttons. It communicated via I2C and we made UEXT connector for it so it plugs directly to AVR-T32U4 Arduino compatible breadboard.

The Arduino library is available at: https://github.com/OLIMEX/DUINO/tree/master/AVR/WII-NUNCHUCK with demo code which prints accelerometer, joystick and button status: http://www.youtube.com/watch?v=fodnHXkwpHg

Raspberry Pi project – interfacing Wii-Nunchuk with RPi

Image

Wii Nunchuck  is Wii remote controller with 3-axis accelerometer, joystick and two button combo. Those who have watched old Bruce Lee movies know how dangerous such Nunchaku could be in some hands 😀 http://www.youtube.com/watch?v=bRyDcB7qQFo

Olimex offers Wii-Nunchuck with UEXT adapter board for EUR 6.95 https://www.olimex.com/Products/Modules/Sensors/MOD-WII/MOD-Wii-UEXT-NUNCHUCK/

and now with RPI-UEXT https://www.olimex.com/Products/Modules/Adapters/RPi-UEXT/ you can connect Wii remote to your Raspberry pi

The Python code is on GitHub https://github.com/OLIMEX/raspberrypi when you start it you will see on the console:

Image

the joystick coordinates, accelerometer XYZ values and two button status

iMX233-OLinuXino I2C tutorial – using WII NUNCHUK

Image

In this post I will show you how you can access I2C devices with iMX233-OLinuXino and how to read WII-NUNCHUCK info.

WII is popular game console, the NUNCHUCK accessory contain two buttons, accelerometer and joystick combo, as it’s mass produced the price is incredible low. You can read more about it at Wikipedia http://en.wikipedia.org/wiki/Wii_Remote

Olimex offers MOD-WII-UEXT-NUNCHUCK which contains WII-NUNCHUCK coupled to UEXT connector, so you can directly connect it to any of our boards with UEXT connector like our Arduino, Pinguino, Maple, Energia etc boards and of course iMX233/A13-OLinuXino.

Before you start working with I2C you have to check if your iMX233-OLinuXino board is with UEXT connected to the hardware I2C ports.

Why? When we designed the iMX233 we wanted to keep the LCD port complete and the hardware I2C was multiplexed with the LCD ports.
So we put triple jumper on UEXT I2C signals which cold be soldered to software and hardware I2C ports. By default we made them to the software I2C.

Later we found that software defined I2C is bad idea on RTOS as on heavy load I2C may not timing correctly and that it’s recommended to use just the hardware I2C so from the beginning of September we soart producing iMX233-OLinuXino with jumpers wired to the hardware I2C.

As there are still many iMX233 on stock at our distributors we described in the user manual how one could do this himself.

So to work with the code below you should make sure your iMX233-OLinuXino have wired hardware I2C to UEXT.

Download the code from GitHub https://github.com/OLIMEX/OLINUXINO/blob/master/SOFTWARE/iMX233/I2C/MOD-Wii-UEXT-NUNCHUCK.c

and write it to the SD card by SSH or flash dongle.

then you need to compile it

$ cc MOD-Wii-UEXT-NUNCHUCK.c -o wii

$ chmod +x wii

$ ./wii

now on the console connected to terminal you should see picture like this:

Image

when you move the joystick, push the buttons or shake the Nunchuck you can see these numbers change.

Here is video of iMX233-OLinuXino running above code: http://www.youtube.com/watch?v=pSVG3LF7uqA

REMEMBER OLD TIMER GAMES PACMAN AND SPACE INVADERS?

PACMAN and SPACE INVADERS retro games are rewritten in BASIC and available for Duinomite. You can even use the MOD-WII-UEXT-NUNCHUCK to play with them.

Here is the start page of MAXMAN (Pacman) for Duinomite:

Image

and video of the game in action: http://www.youtube.com/watch?v=BaXAY_kdyvA

This is the SPACE INVADERS picture:

Image

and video of the game in action: http://youtu.be/lInXVR_v1pU

WII NUNCHUCK LOW COST GAME CONTROLLER NOW CONNECTS ON UEXT

Image

WII NUNCKUCK is game controller for Nintendo Wii, as it’s produced in large quantities it may be obtained on very attractive price.

Inside the WII NUNCKUCK you have: 3 axes accelerometer, XY Joystick, 2 buttons. All this available through I2C communication so this makes it perfect candidate for UEXT connection.

We offer WII-NUNCKUK with MOD-WII-UEXT connector board set which allow the NUNCHUCK to be accesable by any of our boards with UEXT connector for only EURO 6.95!

As you guess the first boards we used to test the NUNCHUCKs is DuinoMite 🙂

There are now two games which use MOD-WII-UEXT-NUNCHUCK: Space invaders and Maxman (Pacman).

They both are uploaded on GitHub: https://github.com/OLIMEX/DuinoMite/tree/master/SOFTWARE/GAMES

DuinoMite new boards: T-shaped breadboard adapter, Wii-nunchuk to UEXT and ICSP adapters

Image

DUINOMITE-TBA

Ken Segler again had nice idea for T-shaped breadboard adapter which brings all DuinoMite GPIOs in easy to access form to breadboard + adds +5V/GND bus on top and +3.3V/GND bus on bottom of the breadboard – small and elegant solution for all who want to experiment with DuinoMite / MaxiMite.

This is our first prototype, we will have stock of this board around end of February.

Image

For all retro computer Game lovers there is good news, now there is easy way to connect Wii-nunchuk to DuinoMite! For this purposes two adapters were built:

Image

one is with UEXT connector so connects directly to the DuinoMite UEXT connector, the other is with PIC-ICSP connector layout and could be wired with 6 pin ICSP cable to DuinoMite PIC programming ICSP connector – as DuinoMite uses bootloader for new firmware upgrades the ICSP connector is used just once when the bootloader is programmed then stays with no use, so interfacing the Wii-nunchuk is good use for the ICSP.

Wii-nunchuk offers: X-Y Joystick and 3-Axes accelerometer + 2 Buttons and works with I2C.

In this thread on TBS forum you can download ready to use Wii-nunchuk BASIC code which is tested to work just fine with the UEXT connector, to work with ICSP connector new soft-emulated I2C communication should be implemented in the firmware.