How to: Cheap Accelerometer with the Wii Nunchuck如何:便宜加速度Wii的Nunchuck

nunchuck
As you're probably well aware, the正如你可能清楚地知道, wiimote wiimote and nunchuck nunchuck have a vast array of sensors built into them.有各種各樣的傳感器內置到他們。 Instead of buying pre-assembled breakout board for $35, or attempting to solder a tiny surface mount accelerometer, learn to exploit the features of the Wii Nunchuck and have a fully assembled accelerometer, joystick, and pushbuttons for just $12.50 shipped (不是購買預組裝突破局為35美元,或試圖焊一個小的表面貼裝加速度,學習的特點,利用Wii的Nunchuck並有充分組裝加速度,操縱桿和按鈕只有12.50美元發運( on ebay易趣 ). ) 。

wiichuck_adapter11

Why use the nunchuck insead of the actual WiiMote? Wiimotes can be about $40 and have a lot of extra features you wont need at the moment. 為什麼使用nunchuck INSEAD的實際WiiMote ? Wiimotes可以40美元左右,並有很多附加功能,你習慣需要的時刻。 Plus, the nunchuck has a cable which can easily be plugged into the Arduino.另外, nunchuck的電纜,可以很容易地插入到阿都伊諾。 Of course, there are plenty of other ways to當然,還有許多其他方式來 connect the wiimote to your pc連接wiimote到您的PC but this way we can interact with other hardware using the Arduino.但這樣,我們可以與其他硬件使用阿都伊諾。 If you've never used the Arduino, see如果您從未使用過的阿都伊諾,見 our tutorial我們的教程 .

1. 1 。 Connect the Nunchuck to your Computer連接Nunchuck到您的計算機

wiichuck-diag1

The Nunchuck communicates through 6 bits of data.該Nunchuck傳達到6位的數據。 To read this data, you'll need to connect the wiimote to a microcontroller.閱讀這些數據,您需要的wiimote連接到微控制器。 In this case we'll use在這種情況下我們會使用 the Arduino在阿都伊諾 . You can either cut the cord on your Nunchuck or purchase an adapter so it fits snugly into your Arduino programmer board.您可以降低您的Nunchuck脊髓或購買一個轉接器,以便它符合緊貼到您的阿都伊諾程序員局。 View more detailed查看詳細 instructions指示 about connecting the nunchuck and I2C (how they talk to each other).關於連接nunchuck和I2C (他們如何互相溝通) 。

2. 2 。 Setup the Software and Download Code安裝的軟件和下載代碼

code_talkers1

If you don't already have it, download the如果您還沒有它,請下載 Arduino software阿都伊諾軟件 (free). (免費) 。 Next, download the下一步,下載 code代碼 which deciphers the 6 bits of data send from the Nunchuck and prints it to your computer's serial port.其中deciphers 6位的數據傳送從Nunchuck並打印到計算機的串行端口。 To learn more about how this communication works, see the若要了解更多關於如何傳播的作品,請參閱 author's tutorials作者指南 or the original source原始來源 .

3. 3 。 Resulting Output結果輸出

nunchuck-data

By using the serial monitor of your Arudino software (or other serial monitoring software), you'll see the above output.通過使用串行監控您Arudino軟件(或其他串行監控軟件) ,您會看到上面的輸出。 Sure, view the results as numbers is fine, but visually representing data in real time is far sexier.當然,查看的結果數量是優良,但視力代表數據實時遠遠性感。 Using a program called利用一個名為 Processing加工 , you can read the above data and display it like the image below. ,您可以參閱上述數據並顯示它像下方的圖片。 See our thorough tutorial about how to graphically visualize data.看到我們的徹底教程如何生動直觀的數據。

4. 4 。 Visualizing Data in Real Time可視化數據的實時

nunchuck-visualization

Watching numbers steam in (step 3 image) is fine and dandy, but sometimes you just need something more to create a truly new perspective.收看數字蒸汽(第3步的形象)是罰款和花花公子,但有時你只需要更多的東西,建立一個真正新的觀點。 Processing加工 is the program I've used, it's pretty easy to該程序是我用,這是很容易 learn學習 , uses the same interface as Arduino, and can render 2D and 3D visualizations with small amounts of code. ,使用相同的接口阿都伊諾,並可以使二維和三維可視化與少量的代碼。 Check out our tutorial to learn how to請參閱我們的教程,以了解如何 graphically visualize data圖形可視化數據 .

Now that you've learned how to read data from a nunchuck as well as data visualization, go make something awesome and don't forget to現在,您已經學會了如何讀取數據從一個nunchuck以及數據可視化,去作出一些可怕的和不要忘記 subscribe to HacknMod訂閱HacknMod for more fantastic posts.更多的精彩文章。

Comment:評論: