How to: Cheap Accelerometer with the Wii Nunchuck Hvordan: Billig Akselerometer med Wii Nunchuck

nunchuck
As you're probably well aware, the Som du sikkert godt kjent, den wiimote Wiimote and og nunchuck Nunchuck have a vast array of sensors built into them. har et stort utvalg av sensorer innebygd 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 ( I stedet for å kjøpe ferdigmontert brekke hovedkortet for $ 35, eller forsøker å lodde en liten surface mount accelerometer, lære å utnytte funksjonene til Wii Nunchuck og ha en ferdig montert accelerometer, joystick, og trykknapper for bare $ 12.50 sendes ( 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. Hvorfor bruke Nunchuck INSEAD av den faktiske Wiimote? Wiimotes kan bli rundt $ 40 og har mange ekstra funksjoner du ikke trenger for øyeblikket. Plus, the nunchuck has a cable which can easily be plugged into the Arduino. Plus har Nunchuck en kabel som enkelt kan plugges inn i Arduino. Of course, there are plenty of other ways to Selvfølgelig, det er nok av andre måter å connect the wiimote to your pc koble Wiimote til PC but this way we can interact with other hardware using the Arduino. Men denne måten kan vi samhandler med andre maskinvare bruker Arduino. If you've never used the Arduino, see Hvis du aldri har brukt Arduino, se our tutorial Ta introduksjonskurset . .

1. 1. Connect the Nunchuck to your Computer Koble Nunchuck til datamaskinen

wiichuck-diag1

The Nunchuck communicates through 6 bits of data. Den Nunchuck kommuniserer med 6 biter av data. To read this data, you'll need to connect the wiimote to a microcontroller. For å lese disse dataene, må du koble Wiimote til en mikrokontroller. In this case we'll use I dette tilfellet vil vi bruke the Arduino the 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 enten klippe ledningen på Nunchuck eller kjøpe en adapter slik at den passer perfekt inn i Arduino programmerer ombord. View more detailed Se mer detaljerte instructions instruksjoner about connecting the nunchuck and I2C (how they talk to each other). om å koble Nunchuck og I2C (hvordan de kan kommunisere med hverandre).

2. 2. Setup the Software and Download Code Oppsett av programvare og nedlastingssteder Kode

code_talkers1

If you don't already have it, download the Hvis du ikke allerede har det, laster du ned Arduino software Besværlig programvare (free). (gratis). Next, download the Deretter laster du ned code kode which deciphers the 6 bits of data send from the Nunchuck and prints it to your computer's serial port. som deciphers de 6 biter av data som sendes fra Nunchuck og så skrives det til datamaskinens serieport. To learn more about how this communication works, see the Hvis du vil vite mer om hvordan denne kommunikasjonen fungerer, se author's tutorials forfatterens tutorials or the eller original source opprinnelige kilde . .

3. 3. Resulting Output Resulting Output

nunchuck-data

By using the serial monitor of your Arudino software (or other serial monitoring software), you'll see the above output. Ved å bruke den serielle skjermen din Arudino programvare (eller andre serielle avlytting programvare), vil du se ovenfor utgang. Sure, view the results as numbers is fine, but visually representing data in real time is far sexier. Sure, viser resultatene som tall er greit, men visuelt representere data i sanntid er langt mere sexy. Using a program called Ved hjelp av et program kalt Processing Processing , you can read the above data and display it like the image below. Kan du lese ovennevnte data og vise det som bildet nedenfor. See our thorough tutorial about how to graphically visualize data. Se våre grundig veiledning om hvordan du grafisk visualisere data.

4. 4. Visualizing Data in Real Time Visualisere data i sanntid

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 tall damp i (trinn 3 bildet) er fint og dandy, men noen ganger du bare trenger noe mer for å skape et virkelig nytt perspektiv. Processing Processing is the program I've used, it's pretty easy to er programmet jeg har brukt, er det ganske lett å learn lære , uses the same interface as Arduino, and can render 2D and 3D visualizations with small amounts of code. Bruker samme grensesnitt som Arduino, og kan gjengi 2D-og 3D-visualiseringer med små mengder av koden. Check out our tutorial to learn how to Sjekk vår veiledning for å lære å graphically visualize data grafisk visualisere 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 Nå som du har lært å lese data fra en Nunchuck samt datavisualisering gå lage noe fantastisk, og ikke glem å subscribe to HacknMod abonnere på HacknMod for more fantastic posts. for mer fantastisk innlegg.

Comment: Kommentar: