» Electronics » Arduino Wii Nunchuk turns into a computer mouse

Wii Nunchuk turns into a computer mouse



The hero of our story is again the Wii Nunchuk controller. As soon as the programmer Tod E. Kurt wrote a library for Arduino, allowing you to work with him, friends began to come up with a variety of applications for him. Either the magic screen toy is controlled, or the virtual helicopter in the game for MSX ... Well, the author of Instructables under the nickname Kriegwesen figured out how to use such a controller as a regular computer mouse with a USB interface. It's like a trackball - no rug needed. No, this is better than a trackball - you don't need a table either.

Usually, improvised connectors are used to connect the Arduino to the Nunchuk. The master decides to do without one, opening the case and placing some very small clone of Arduino there. But he does not have a screwdriver with a sting of a triangular section. The master orders it, but it takes too long to wait. Nothing, useful for other projects. Here he opens the cable and pulls out four conductors from it:



For homemade any Arduino-compatible card that can emulate USB HID devices, as well as pins specially dedicated for SDA and SCL lines of interface I, is suitable2C. The Arduino Leonardo board fits both criteria. The conductors in the Nunchuk cable usually have the following color coding: white - common, red - plus power (correctly apply 3.3 V, but from reviews, and from 5 V nothing fails), green - SDA, yellow - SCL . But it also happens that the colors are non-standard, so it is better to take that piece of cable that after snacking which remains with the connector and ring according to its pinout.

Combining everything as described above, the master writes a sketch:



The program needs a header file laid out here. After downloading it, rename it to nunchuck_funcs.h

The master puts all the iron in a box that looks like a soldering box, and fixes the cables inside with Sugru. You can take a real junction box, and fix the cables in another way.







In the current version of the firmware, everything works stably, but the scroll function is not implemented. In the future, the master plans to make sure that when one of the buttons is pressed, scrolling occurs according to signals from the Nunchuk accelerometer.
0
0
0

Add a comment

    • smilesmilesxaxaokdontknowyahoonea
      bossscratchfoolyesyes-yesaggressivesecret
      sorrydancedance2dance3pardonhelpdrinks
      stopfriendsgoodgoodgoodwhistleswoontongue
      smokeclappingcraydeclarederisivedon-t_mentiondownload
      heatirefullaugh1mdameetingmoskingnegative
      not_ipopcornpunishreadscarescaressearch
      tauntthank_youthisto_clueumnikacuteagree
      badbeeeblack_eyeblum3blushboastboredom
      censoredpleasantrysecret2threatenvictoryyusun_bespectacled
      shokrespektlolprevedwelcomekrutoyya_za
      ya_dobryihelperne_huliganne_othodifludbanclose

We advise you to read:

Hand it for the smartphone ...