MEAM.Design - MAEVARM - mWill IR Blob Tracker


Operating on the mBUS peripheral subsystem, the mWii module includes the same Pixart system-on-chip CMOS IR camera found inside the Nintendo Wiimote, along with a 25MHz oscillator, a 3.3V regulator, and level shifters for bi-directional communication with the m2 microcontroller. The Pixart sensor consists of a 128x96 pixel monochrome IR camera paired with a custom processing unit capable of tracking four infrared light sources at 100 Hz using 8X sub-pixel sampling for an effective resolution of 1024x768.


To use the mWii module, you will first need to download and include support for the mBUS subsystem, which can be done from here. You will then need to download the following mWii-specific support files:

Be sure to include the C file in your project:

  • For Windows OS users, if you're using Option 1, you will then need to right-click on the Source Files folder, and select Add Existing Source File(s)..., then select the m_wii.c file, and if you're using Option 2, place m_wii.c in src/.
  • For Mac and Linux users, if you're using Option 1, edit your Makefile to add "m_wii.o" after "main.o" on the OBJECTS line and if you're using Option 2, place m_wii.c in src/.

Also, place the H file next to your main file for Option 1 or place the H file in inc/ for Option 2, and include m_wii.h in your main routine.


A standard set of routines have been implemented to configure the Pixart sensor to track four IR blobs with high resolution. To initialize the sensor, you can use the following function that will return 1 if successful or 0 if there was an error:

char = m_wii_open(void)

Once opened, you can request data from the sensor using the following:

char = m_wii_read(unsigned int* blobs)

Where blobs is the pointer to a twelve-element unsigned int buffer. The data that the sensor places into the buffer will consist of four three-byte packets (one for each tracked blob). Within each packet, the first element will be the 10-bit X position, the second element will be the 10-bit Y position, and the third element will be the 4-bit size, like this:


Note: The system will attempt to maintain blob assignments, provided the blob remains within the field of view at all times. If the chip does not detect four distinct blobs, it will return 1023 for the X and Y position of the empty blob containers.