ZX-NUNCHUK (#8000339)



Similar documents
The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

RB-See-211. Seeedstudio Grove 6-15V, 2A Dual I2C Motor Driver. Grove - I2C Motor Driver. Introduction

RS-485 Protocol Manual

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

User s Manual of Board Microcontroller ET-MEGA2560-ADK ET-MEGA2560-ADK

ET-BASE AVR ATmega64/128

Serial Communications

HDMM01 V1.0. Dual-axis Magnetic Sensor Module With I 2 C Interface FEATURES. Signal Path X

User Manual. AS-Interface Programmer

PCS0100en Persy Control Services B.V. Netherlands

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Lab 6 Introduction to Serial and Wireless Communication

STIM202 Evaluation Kit

- 35mA Standby, mA Speaking pre-defined phrases with up to 1925 total characters.

ARDUINO SEVERINO SERIAL SINGLE SIDED VERSION 3 S3v3 (REVISION 2) USER MANUAL

Android Controlled Based Interface

MAX6683 Evaluation System/Evaluation Kit

LCD I 2 C/Serial RX Backpack. Data Sheet. LCD to I2C/Serial RX Backpack I2C or Serial RX communication with Standard 16 Pin LCD modules

EvB 5.1 v5 User s Guide

Hardware Connections between Arduino and IMU Nori Wilkins Apr. 5, 2013

RS-232 COMMUNICATIONS

PART B QUESTIONS AND ANSWERS UNIT I

Arduino Wifi shield And reciever. 5V adapter. Connecting wifi module on shield: Make sure the wifi unit is connected the following way on the shield:

Microcontroller Programming Beginning with Arduino. Charlie Mooney

Embedded Systems Design Course Applying the mbed microcontroller

MSITel provides real time telemetry up to 4.8 kbps (2xIridium modem) for balloons/experiments

NB3H5150 I2C Programming Guide. I2C/SMBus Custom Configuration Application Note

Elettronica dei Sistemi Digitali Costantino Giaconia SERIAL I/O COMMON PROTOCOLS

Software Manual RS232 Laser Merge Module. Document # SU Rev A

Modification of an AOR AR-8600 receiver to tune it with a ACECO FC-3002 frequency finder

Definitions and Documents

MODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence :

Single channel data transceiver module WIZ2-434

Modbus Communications for PanelView Terminals

RS - SPM. Serial parallel translator module

RC2200DK Demonstration Kit User Manual

USB / Data-Acquisition Module NOW LEAD-FREE

BIT COMMANDER. Serial RS232 / RS485 to Ethernet Converter

The Programming Interface

KTA-223 Arduino Compatible Relay Controller

Lecture 7: Programming for the Arduino

MFRD52x. Mifare Contactless Smart Card Reader Reference Design. Document information

Modbus and ION Technology

Lab 2.0 Thermal Camera Interface

The modular concept of the MPA-3 system is designed to enable easy accommodation to a huge variety of experimental requirements.

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

Introduction: Implementation of the MVI56-MCM module for modbus communications:

Manual Serial PCI Cards

Controlling a Dot Matrix LED Display with a Microcontroller

Quick Installation. A Series of Intelligent Bar Code Reader with NeuroFuzzy Decoding. Quick Installation

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

2.0 Command and Data Handling Subsystem

TCP/IP MODULE CA-ETHR-A INSTALLATION MANUAL

EZmoto V2. Product description Rev. 6 10/01/2014. EZmoto V2 Product description Rev.6 10/01/2014

USB2.0 <=> I2C V4.4. Konverter Kabel und Box mit Galvanischetrennung

Data Sheet. Adaptive Design ltd. Arduino Dual L6470 Stepper Motor Shield V th November L6470 Stepper Motor Shield

Advanced Data Capture and Control Systems

HARDWARE MANUAL. BrightSign HD120, HD220, HD1020. BrightSign, LLC Lark Ave., Suite 200 Los Gatos, CA

Programming the Arduino

Arduino Internet Connectivity: Maintenance Manual Julian Ryan Draft No. 7 April 24, 2015

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

Using Xbee in Serial Communication

The Answer to the 14 Most Frequently Asked Modbus Questions

Programmable set for Ethernet Modbus/TCP in IP67 TI-BL67-PG-EN-2

3. Identification of water pumps through RFID technology. 4. Wireless control of remote water pump using RF technology.

MSR605. Programmer s Manual. Magnetic Stripe Card Reader/Writer (High & Low Coercivity) Revision B

PIKA Technical Bulletin #41. V-12 RAN Trunk Interface Implementation

WxGoos-1 Climate Monitor Installation Instructions Page 1. Connections. Setting an IP Address

MMC314xMR. Ultra Small 3-axis Magnetic Sensor, With I 2 C Interface. Signal Path X. Signal Path Y. Signal Path Z FEATURES

EVAL-UFDC-1/UFDC-1M-16

MXL5007T TUNER RADIO

Bluetooth to serial HC-06 wireless module

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

CB-OLP425 DEVELOPMENT KIT GETTING STARTED

S4000TH HART. HART Communication Manual

DAKTON µ BOX MANUAL µbox User Manual 1

Programming Flash Microcontrollers through the Controller Area Network (CAN) Interface

AN601 I2C 2.8 Communication Protocol. SM130 SM130 - Mini APPLICATION NOTE

STK User Guide

PCAN-MicroMod Universal I/O Module with CAN Interface. User Manual. Document version ( )

Ultrasonic Distance Measurement Module

Accessing I2C devices with Digi Embedded Linux 5.2 example on Digi Connect ME 9210

Thermostat Application Module Kit

How to read this guide

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

Bluetooth HC-06 with serial port module Easy guide

Design and Implementation of an Accidental Fall Detection System for Elderly

B Robo Claw 2 Channel 5A Motor Controller Data Sheet

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Programming and Using the Courier V.Everything Modem for Remote Operation of DDF6000

AVR Timer/Counter. Prof Prabhat Ranjan DA-IICT, Gandhinagar

Bluetooth + USB 16 Servo Controller [RKI-1005 & RKI-1205]

Pmod peripheral modules are powered by the host via the interface s power and ground pins.

Modbus and ION Technology

DCREG INTERFACE VIA DEVICENET

GSM Interfacing Board

Arduino Lesson 1. Blink

Welcome to the tutorial for the MPLAB Starter Kit for dspic DSCs

Transcription:

ZX-NUNCHUK documentation 1 ZX-NUNCHUK (#8000339) Wii-Nunchuk interface board 1. Features l Interface with Wii Nunchuk remote control directly. Modification the remote control is not required. l Two-wire Interface. Easy to interface with any modern microcontroller l Connect to INEX microcontroller board via 3-pin JST connector. l +5Vdc supply voltage. On-board +3.3V regulator. l 2x4 cm. size. 2. Board contents : l ZX-NUNCHUK board x 1 l JST3AA-8 cable x 2 l Documentation x 1 The Wii-Nunchuk remote control is optional. This is also sold separated. Controller is provided in the Nunchuk Interface kit (#8000347). 3. General information There is 3-axis accellerometer sensor LIS3L02AL of ST Microelectronics inside the Wii- Nunchuk. It includes a 10-bit A/D converter, an analog joystick and 2-button switches. The figure 1 shows the components of Wii-Nunchuk and connectorís pin assignment. Z button C button Analog joystick +3.3V SDA N/C 3-axis acceleromoter sensor is installed in right-angle axis with joystick SCL Handheld Nunchuk component Pin assignment of Nunchuk connector. See from front view. Figure 1 : Wii-Nunchuk remote control information

2 ZX-NUNCHUK documentation K1 SCL +5V. SCL +5V. SDA K2 SDA R1 4.7k R2 4.7k IN C1 0.1 F 16V IC1 78L33 OUT C2 0.1 F 16V +3.3V C3 47 F 16V óÕ㪌 ѺÃкº 3.3V. ãëœ Í IC1 78L33 ÍÍ áåœçµ Íä IN ä»âñ OUT ྠèí㪜 Ò¹ ( Ò 3 Ѻ Ò 1 Í IC) R3 47 R4 47 +3.3V SCL SDA ͹à¹ç àµíã Nunchuk ZX-NUNCHUK µ Íä»ÂÑ ºÍà POP-INTERFACE ËÃ Í JX-POP Figure 2 : ZX-NUNCHUK scematic diagram and shows the connecting with Wii-Nunchuk The wiring signal of Wii-Nunchuck has 4 lines. It includes +3.3V supply voltage (red line), Ground (white line), Serial clock line - SCL (yellow line) and Serail data line - SDA (green line). They are connected to special female connector and assigned pin location are shown in the figure 1. The interfacing protocol is 2-wire interface or I 2 C bus compatible. The logic level is +3.3V. The ZX-NUNCHUK is designed for bridging between any modern microcontroller and Wii-Nunchuk remote control. The 3-axis accellerometer sensor can detect accelleration ± 2g maximum. The schematic diagram of ZX-NUNCHUK and how to interface with the Wii-Nunchuk remote control are shown in figure 2.

ZX-NUNCHUK documentation 3 Center position Read data about 512 Swing to left direction Slow : X-axis accelleration is less deviation. Fast : X-axis accelleration value reduce fast. Swing to right direction Slow : X-axis accelleration is less deviation. Fast : X-axis accelleration value increase fast. Center position Read data about 512 Move forward direction Slow : Y-axis accelleration is less deviation. Fast : Y-axis accelleration value increase fast. Move backward direction Slow : Y-axis accelleration is less deviation. Fast : Y-axis accelleration value reduce fast. Lift-up direction Slow : Z-axis accelleration is less deviation. Fast : Z-axis accelleration value increase fast. Center position Read data about 512 Lift-down direction Slow : Z-axis accelleration is less deviation. Fast : Z-axis accelleration value reduce fast. Figure 3 : Wii-Nunchuk physical operation

4 ZX-NUNCHUK documentation 4. Protocol Wii-Nunchuck is a slave I 2 C bus device. It has 2 slave ID for writing (0xA4) and reading (0xA5) data which is as follows : 1 0 1 0 0 1 0 R/W The reading data of the Wii-Nunchuk consists of 6 bytes data. Before using these data, programmer must decode these data following : Exact data = (Redaing data XOR 0x17) + 0x17 The summary of exact data after decoding can show as follows : Data byte receive Joystick X Joystick Y Accelerometer X (bit 9 to bit 2 for 10-bit resolution) Accelerometer Y (bit 9 to bit 2 for 10-bit resolution) Accelerometer Z (bit 9 to bit 2 for 10-bit resolution) Address 0x00 0x01 0x02 0x03 0x04 Accel. Z bit 1 Accel. Z bit 0 Accel. Y bit 1 Accel. Y bit 0 Accel. X bit 1 Accel. X bit 0 C-button Z-button 0x05 Byte 0x00 : X-axis data of the joystick Byte 0x01 : Y-axis data of the joystick Byte 0x02 : X-axis data of the accellerometer sensor Byte 0x03 : Y-axis data of the accellerometer sensor Byte 0x04 : Z-axis data of the accellerometer sensor Byte 0x05 : bit 0 as Z button status - 0 = pressed and 1 = release bit 1 as C button status - 0 = pressed and 1 = release bit 2 and 3 as 2 lower bit of X-axis data of the accellerometer sensor bit 4 and 5 as 2 lower bit of Y-axis data of the accellerometer sensor bit 6 and 7 as 2 lower bit of Z-axis data of the accellerometer sensor

ZX-NUNCHUK documentation 5 5. Programming 5.1 Initialize start Nunchuk command Set the Nunchuk as ready after power-on. Write the command 0x40 and 0x00 follows the slave ID byte 0xA4. Normally this command is written at once. START 0xA4 0x40 0x00 STOP 5.2 Conversion command (0x00) Send this command to get all sensor data and store into the 6-byte register within Nunchuk controller. This must be execute before reading data from the Nunchuk. START 0xA4 0x00 STOP 5.3 Data read command Send the slave ID for reading (0xA5) and wait for the stream data 6-byte from the Nunchuk. START 0xA5 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 no STOP Next, decode the data to exact data by XOR with 0x17 and plus with 0x17. This step is very important. Do not skip this step!

6 ZX-NUNCHUK documentation 6. Example : Interface Nunchuk with Arduino POP-168 This example show the data reading from Wii-Nunchuk by Arduino POP-168 microcontroller module. The POP-168 is fit on the POP-Interface baord or Project board (JX-POP168). Connect with Wii-Nunchuk via ZX-NUNCHUK interface board. The reading data will be shown on the Arduino IDEís Serial monitor. The construction circuit is shown below. The example C code shows in the Listing 1. DB-9 (optional) 5 K1 RS-232 3 2 IC1 POP-168 +5V 1 Di 1/TxD 2 Di 0/RxD 3 4 5 An 0/PC0 6 An 1/PC1 7 An 2/PC2 8 An 3/PC3 9 An 4/SDA/PC4 10 An 5/SCL/PC5 11 An 6/AN6 12 An 7/AN7 1 12 ATMEGA168 SW2 24 RESET 23 22 RESET 21 VDD/+5Vdc 20 Di 9/PWM/PB1 19 Di 8/PB0 18 Di 7/PD7 17 Di 6/PWM/PD6 16 Di 5/PWM/PD5 15 Di 4/PD4 14 Di 3/PWM/PD3 13 Di 2/PD2 RM1 Nunchuk POP-168 13 µ Í Ò Ǿ µ Í Í ºÍà POP-INTERFACE SDA SCL M ZX- NUNCHUK /******************************************************************************** * Code for read data from Wii nunchuck., base on http://www.windmeadow.com/node/42 * File : ArduinoNunchuk.pde * by : K.Worapoht * Hardware: Arduino, POP-168, AVR ATMega168, * connect SDA to PC4 (An4) and SCL PC5 (An5) *******************************************************************************/ #include <Wire.h> #define nunchuk_id 0xA4 >> 1 unsigned char buffer[6];// array to store arduino output int cnt = 0; void setup () Serial.begin (9600); Wire.begin (); // join i2c bus with address 0x52 nunchuck_init (); // send the initilization handshake delay (100); Listing 1 : Arduino C code for interfaing Wii-Nunchuk with Arduino POP-168 (continue)

ZX-NUNCHUK documentation 7 void nunchuck_init () Wire.beginTransmission (nunchuk_id); // transmit to device 0x52 Wire.send (0x40); // sends memory address Wire.send (0x00); // sends sent a zero. Wire.endTransmission (); // stop transmitting void send_zero () Wire.beginTransmission (nunchuk_id); // transmit to device 0x52 Wire.send (0x00); // sends one byte Wire.endTransmission (); // stop transmitting void loop () Wire.requestFrom (nunchuk_id, 6); // request data from nunchuck while (Wire.available ()) buffer[cnt] = nunchuk_decode_byte (Wire.receive ()); // receive byte as an integer cnt++; // If we recieved the 6 bytes, then go print them if (cnt >= 5) print (); cnt = 0; send_zero (); // send the request for next bytes delay (100); // Print the input data we have recieved // accel data is 10 bits long // so we read 8 bits, then we have to add // on the last 2 bits. void print () unsigned char joy_x_axis; unsigned char joy_y_axis; int accel_x_axis; int accel_y_axis; int accel_z_axis; unsigned char z_button; unsigned char c_button; joy_x_axis = buffer[0]; joy_y_axis = buffer[1]; accel_x_axis = (buffer[2]) << 2; accel_y_axis = (buffer[3]) << 2; accel_z_axis = (buffer[4]) << 2; // byte outbuf[5] contains bits for z and c buttons // it also contains the least significant bits for the accelerometer data // so we have to check each bit of byte outbuf[5] if ((buffer[5] & 0x01)!=0) z_button = 1; else z_button = 0; if ((buffer[5] & 0x02)!=0) Listing 1 : Arduino C code for interfaing Wii-Nunchuk with Arduino POP-168 (continue)

8 ZX-NUNCHUK documentation c_button = 1; else c_button = 0; accel_x_axis += ((buffer[5]) >> 2) & 0x03; accel_y_axis += ((buffer[5]) >> 4) & 0x03; accel_z_axis += ((buffer[5]) >> 6) & 0x03; Serial.print (joy_x_axis, DEC); Serial.print (joy_y_axis, DEC); Serial.print (accel_x_axis, DEC); Serial.print (accel_y_axis, DEC); Serial.print (accel_z_axis, DEC); Serial.print (z_button, DEC); Serial.print (c_button, DEC); Serial.print ("\r\n"); // Encode data to format that most wiimote drivers except // only needed if you use one of the regular wiimote drivers char nunchuk_decode_byte (char x) x = (x ^ 0x17) + 0x17; return x; Listing 1 : Arduino C code for interfaing Wii-Nunchuk with Arduino POP-168 (final) Figure 4 : Shows the reading data from Wii-Ninchuk remote control on the Arduino s serial monitor. First 2 bytes are X and Y axis data of Joystick. Next 3 bytes are X, Y and Z axis of accellerometer sensor and last 2 bytes are C and Z button status. If any button is pressed, the data will equal 0. MNT-ZXNUNCHUK20080717