How to: Cheap Accelerometer with the Wii Nunchuck How to: Cheap Accelerometer med Wii Nunchuck

nunchuck
As you're probably well aware, the Som du förmodligen väl medveten om wiimote Wiimote and och nunchuck Nunchuck have a vast array of sensors built into them. har ett brett spektrum av sensorer inbyggda i dem. 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 ( Istället för att köpa förmonterade breakout board för $ 35, eller försöker att löda en liten yta montera accelerometer, lära sig att utnyttja funktionerna i Wii Nunchuck och ha en färdigmonterad accelerometer, joystick och tryckknappar för bara $ transporteras 12,50 ( on ebay på 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. Varför använda Nunchuck Insead av den faktiska Wiimote? Wiimotes kan ungefär $ 40 och har en hel del extra funktioner du wont behöver just nu. Plus, the nunchuck has a cable which can easily be plugged into the Arduino. Plus har Nunchuck en kabel som lätt kan sättas in i Arduino. Of course, there are plenty of other ways to Naturligtvis finns det många andra sätt att connect the wiimote to your pc Anslut Wiimote till din pc but this way we can interact with other hardware using the Arduino. men detta sätt vi kan samverka med annan maskinvara med Arduino. If you've never used the Arduino, see Om du aldrig har använt Arduino, se our tutorial vår tutorial . .

1. 1. Connect the Nunchuck to your Computer Anslut Nunchuck till datorn

wiichuck-diag1

The Nunchuck communicates through 6 bits of data. Den Nunchuck kommunicerar med 6 databitar. To read this data, you'll need to connect the wiimote to a microcontroller. Att läsa denna information, måste du ansluta Wiimote till en mikrokontroller. In this case we'll use I detta fall vi använder the Arduino Arduino . . You can either cut the cord on your Nunchuck or purchase an adapter so it fits snugly into your Arduino programmer board. Du kan antingen klippa sladden på din Nunchuck eller köpa en adapter så den passar perfekt i din Arduino programmerare ombord. View more detailed Se mer detaljerad instructions instruktioner about connecting the nunchuck and I2C (how they talk to each other). om att förena Nunchuck och I2C (hur de pratar med varandra).

2. 2. Setup the Software and Download Code Setup Software and Download Code

code_talkers1

If you don't already have it, download the Om du inte redan har det, ladda ner Arduino software Arduino programvara (free). (gratis). Next, download the Därefter hämta code kod which deciphers the 6 bits of data send from the Nunchuck and prints it to your computer's serial port. som dekryptera den 6 databitar sända från Nunchuck och skriver till datorns serieport. To learn more about how this communication works, see the Om du vill veta mer om hur denna kommunikation fungerar, se author's tutorials författarens tutorials or the eller original source originalkällan . .

3. 3. Resulting Output Resultatutdata

nunchuck-data

By using the serial monitor of your Arudino software (or other serial monitoring software), you'll see the above output. Genom att använda den seriella övervaka dina Arudino programvara (eller annat serienummer kontrollerande mjukvaran), ser du ovan produktionen. Sure, view the results as numbers is fine, but visually representing data in real time is far sexier. Visst, se resultatet eftersom siffrorna är bra, men visuellt representerar data i realtid är mycket sexigare. Using a program called Med programmet Processing Processing , you can read the above data and display it like the image below. Kan du läsa ovanstående uppgifter och visa det som på bilden nedan. See our thorough tutorial about how to graphically visualize data. Se vår grundlig handledning om hur man grafiskt visualisera data.

4. 4. Visualizing Data in Real Time Visualisera data i realtid

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. Watching nummer ånga (steg 3 bild) är bra och dandy, men ibland är du bara behöver något mer för att skapa en verkligt nytt perspektiv. Processing Processing is the program I've used, it's pretty easy to är det program jag har använt, är det ganska lätt att learn lära , uses the same interface as Arduino, and can render 2D and 3D visualizations with small amounts of code. Använder samma gränssnitt som Arduino, och kan göra 2D-och 3D-visualiseringar med små mängder kod. Check out our tutorial to learn how to Kolla in vår handledning att lära sig graphically visualize data grafiskt visualisera 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 Nu när du har lärt sig att läsa data från en nunchuck samt data visualisering, går att göra något häftigt och glöm inte att subscribe to HacknMod Prenumerera på HacknMod for more fantastic posts. mer fantastiska inlägg.

Comment: Kommentar: