Building a Wii “Sensor” Bar project

I meant to post this a few days ago but I was exhausted… but here it is today.

Introduction

Inspired by the hacks and videos on the InterWeb about being able to use a Nintendo Wii Remote (Wiimote) controller on a PC, I bought a Wiimote a few months back so that I can use it on a PC via Bluetooth and hopefully dev some games that utilizes its motion based interface. (Side note: I haven’t been able to pick up a Wii system yet as it’s still pretty hard to find a unit without camping out. :( ) I’ve finally had the time to get started on using it. First step though is to create a homebrew Wii “Sensor” Bar. It’s really not a sensor bar as the name implies; all it really is is a bunch of infrared LEDs on the both ends of a bar – an infrared emitter if you will. The Wiimote controller itself has the IR receivers which it can use to act as a pointing device.

Warning: some technical mumbo jumbo below.

Research

Sunday evening last week was day 1 when I first started. I spent the first day doing some research on net, on the forums and wiki of WiiLi.org and WiiBrew.org. Most people on this thread made their own bar using only four IR LEDs bought from Radioshack (part #276-143) but I decided I wanted more than four. Since I plan to use the Wiimote on my PC, I wanted to get power from the USB port which will always be available as long as a PC is around.

Design

On the following Monday I spent most of the day coming up with the circuit I wanted. For electrical engineer majors, this step is probably a no brainer, but I’m not in electrical engineering and I’m still new to circuit theory. I came up with a few designs and verified if it was correct with a couple of kind folks at AVRfreaks.net (thanks!). I ended up using the following parts in my design:

  • 6 IR LEDs (part# LTE-4208 – 940nm, 1.4V @ 50mA, 20º angle)
  • A prototype board apparently made by “Lab-Easy”, easy to cut with scissors(!).
  • 18 ohms 1/4W resistor
  • USB type B receptacle
  • ~20 AWG gauge multi strand wires (for easy soldering)

And here’s the very simple circuit diagram:

USB Wii Sensor Bar schematic diagram

A little bit of circuit theory: It’s important to note that by default the USB port can only supply a current up to 100mA on the power line. This circuit, in theory, will draw up to the maximum 100mA provided since there are two series of IR LEDs in parallel. Drawing anymore could cause some power problems on the USB network…

Aesthetics

For the aesthetics, to make it look somewhat good, I used these from Active Surplus on Queen St. in downtown Toronto: 2 glass containers that will enclose the IR LEDs on each side and a foot long tube thingy made out of hard glue (I think). In the picture I’ve already cut the plastic tube down to about 19 cm, which is roughly the distance between the left and right group of IR LEDs on a real Wii sensor bar. I also made a cut on the right side which is where the USB connector will go.

USB Wii Sensor Bar - glass & plastic tubes

Building it

Tuesday and Wednesday were spent putting and soldering the circuit together. I first cut out two rectangular pieces of the prototyping board with scissors. I made them small enough so that each of them can easily fit inside each of the glass containers with the IR LEDs on it. Then I soldered on an 18 ohms resistor and three of the IR LEDs all in a series for each board. One one of them I added the USB connector. This is what the two parts look like afterwards:

USB Wii Sensor Bar - Circuit boards 1

Just like on the real sensor bar, the two outer IR LEDs in each group are angled outwards while the ones in between are straight. I slightly bent the two outer IR LEDs on each side so that they’re angled while leaving the middle ones straight:

USB Wii Sensor Bar - Circuit boards 2

Once that’s done, all that’s needed is to to finish the circuit is to connect the ground and +5V lines from both boards to the USB’s ground and +5V line with wires through the plastic tube to get this:

USB Wii Sensor Bar - Circuit boards 3

For the board with the USB connector on it, I stuck that into the plastic tube first on the side with the opening for the USB connector and then I put some hot glue around it so that it would stay in place.

USB Wii Sensor Bar - USB connector

After that I glued on the second board on the other side. And finally I carefully put on the glass containers on both sides and hot glued them onto the plastic tube. Now all I needed to do was connect a USB cable to it and voila!

USB Wii Sensor Bar - Finished

It’s done!

Even after plugging it in, the naked human eye can’t see anything different but if you look at it through a camera you can see a faint purple-ish glow emitting from the LEDs – it works!

USB Wii Sensor Bar - It’s on and it works

I tested the Wii remote with this sensor bar using a test application that comes with ManagedWii Wiimote driver library and I was able to pick up IR reception from as far away as 4 metres. I also tried using the IR Windows mouse cursor script included in the GlovePIE driver and it worked pretty nicely. The Wiimote was able to move the mouse cursor across my entire 1280×1024 desktop. I was worried for a bit that the 20º angle range was too small but it doesn’t seem to be the case, at least not yet…

What’s next?

Now that I have my sensor bar, it’s time to learn some C# and dig into XNA!

I’m going to SIGGRAPH 2007!

SIGGRAPH07
A month from independence day today I’ll be heading to Pearson airport on my way to San Diego! I was one of the fortunate students who’ve been accepted to volunteer at this year’s SIGGRAPH being held at the San Diego Convention Center. My Chariot of Fire partner David was accepted too. I can tell you that the application process is quite competitive since I was put on the waiting list until a few weeks ago I got an email saying I got accepted. Travel assistance and housing accommodations are provided to a select few and since I was on the waiting list, I guess they gave them all out before I could get one. :( David was fortunate to get an offer early on so he was able to get some travel money and housing.

On the application form they asked a lot of questions relating to your interpersonal skills rather than your interest in computer graphics. For those who are considering to volunteer in the future, here are some of the short answer questions (max 200 words) they asked on this year’s form:

  • Describe your cross-cultural and interpersonal skills and experiences.
  • Provide a recent real-life example of how you have handled stressful situations (especially those involving people).
  • Explain one goal you set for yourself in the past year and how you achieved it.

And finally they had a creative thinking question. There were three topics to choose from. One of which was:

  • Finish this story: Nothing seemed unusual when I looked around the room until I noticed…

I don’t remember what the other two were unfortunately. You also need one reference from anyone that’s within the graphics industry or from a professor/teacher you know at your school. If you seriously want to volunteer but don’t know any prof in your school, then it’s time to consider making relationships with some of them.

Since I didn’t get any travel assistance or housing, I’m going to have to pay for everything out of my own pocket. :( I’ll be staying at a hostel which is much cheaper than staying at a hotel. My costs so far has been:

  • Plane ticket: $615
  • Hostel (6 nights): $28 x 6 = $168
  • Travel insurance (inc. baggage, medical, cancellations): $60

So that’s comes up to about $850. Quite an expensive volunteer position I must say.

As part of the package this year, they’re giving all student volunteers a year’s membership to ACMSIGGRAPH – yay! I don’t know if I’ll be using it a lot but hey it’s more “free” stuff.

Oh, and here was my answer to the creative question:

… I noticed a couple of rats ran out of a corner and across the side of the dark room. I was standing in the middle of the room quietly thinking until I was frightened by the rats and jumped back. As I did, my back hit a heavy old wooden clothes hanger. It toppled over and made a loud bang as it hit the wooden floor. I took a few deep breaths to calm myself down then looked over to where the clothes hanger had fallen and saw something which looked like a door handle. I went closer and sure enough it was a trap door. Being curious as I always am, I opened the door and was greeted by the stench of wood. I went down with my flashlight in hand and was surprised to stacks of books everywhere. There was one particular large stack of books that caught my attention. The first book on it was called Graphic Gems II; and underneath it was Graphic Gems IV. The entire stack was the collection of the Graphic Gems series! So this was where father kept his graphics books; I feel like the King of the treasure hunters.

Microsoft pwns me (Sigh)

Since Wednesday I’m finished with my English: Science Fiction course that I was taking for the first half of the summer for six weeks. Yet, it still feels like the summer just started…

Last time I talked a little about Microsoft’s XNA at EnergizeIT. Jean Beauclair, who is part of Microsoft Canada’s “Developer Evangelist team”, made a comment about XNA that when it was first announced, major game companies that produce AAA games didn’t take XNA seriously. They thought of it as a “toy” that’s only for hobbyists and amateurs and that it didn’t have a place within the professional industry. In fact, the first line in the XNA Game Studio Express documentation specifically says:

Microsoft XNA Game Studio Express is a set of tools based on Microsoft Visual C# 2005 Express Edition that allow students and hobbyists to build games for both Microsoft Windows and Xbox 360.

After several months of being released and people (i.e. hobbyists, students, and the like) actually started using it and produced some games, things are kind of changing now. Game companies are noticing XNA, according to him… really…? I don’t think game companies will immediately switch to XNA if it’s considered an amateur’s tool. And to develop a title across more than one console platform, XNA is out of the question for obvious reasons. Oh, and just as an aside: I see the term “cross-platform” being thrown around a little bit when Microsoft is referring to XNA. This is kind of misleading as it is not cross-platform across consoles, rather it’s cross-platform only across a Windows PC and Xbox360. Ugh.

So my main issue with using XNA is that it’s made by Microsoft. By using XNA I’ll be tied down to developing only for Windows and/or Xbox 360. I’ll admit that I am a little bit of a Nintendo fanboy. If Nintendo ever does open up the DS or Wii for hobbyists to develop for, I’ll be jumping on the wagon without a second thought. Also, I can forget about satisfying the Linux crowd. My second concern is that I won’t get a chance to hone my OpenGL skills. After finishing Chariot of Fire, I just felt like I was just getting started with OpenGL. With those being said, I really should put things into better perspective:

  1. Majority of PCs out there is over 90% +/- a few percentage. Big audience, yes. But really I shouldn’t be caring about this; I’m better off in the short run to produce something a few people would enjoy.
  2. Game ideas and mechanics are the meat. It doesn’t matter what platform it runs on as long as it works the same across them. Porting, although can be a lot of work, is doable. But coming up with good game ideas is harder. I should be prototyping, not productioning.
  3. Based on the U of T Computer Science curriculum, it appears that there’s a dying number of students with C/C++ skills being produced. I like to think of myself as one of the rare students who knows C++ like the back of their hand and show off. :) But compared to some of the newer programming languages like Python and Java, there’s less overhead involved in these languages than C++. Garbage collection, pointers being dealt with seamlessly, and built-in data structures and libraries are things which, I guess, are being taken for granted in the newer languages and using them would reduce coding time.
  4. I want to get a working demo done in about a month from now just in time for the SIGGRAPH 2007 conference

I’ve briefly looked at the documentation and wow, it takes so much less code to get an XNA app (which I think is a layer above DirectX9) running than it did with classic DirectX9 using C++. The framework even provides a base class with all the required methods to implement that’s typical of a game app. XNA includes a math library along with some support for curves, sweet. I was doing a little bit of experimenting with bezier and b-spline curves recently but never got around to finishing it…

So considering these points, I’m gonna bite the bullet and dive into XNA for a little while. Congrats Microsoft, you pwn me. Sigh.

C++ inventor is in town!

From the U of T Computer Science Community forums, and from there originally from IEEE Toronto:

On Friday July 20, 2007 Dr. Bjarne Stroustrup will give a talk on “C++0x
Support for Generic Programming”

The talk will be held at Bahen Center for Information Technology, located on 40
St. George Street at 6:30 PM.

After the meeting there is opportunity for asking questions, mingle and
networking at Bar Mercurio restaurant, 270 Bloor West.

Don’t miss this golden opportunity to have your C++ burning questions answered
by the inventor of the language himself.

This seminar is free and open to public.

NOTE: no room number has been announced yet. Stay tuned.

In the game industry, there is no question that C/C++ is widely used… although that could be changing… I figure I’d spread the word as well. It’s already written it down on my calendar.

Portfolio: OpenGL game demo Chariot of Fire

I have just put a portfolio page for projects that I’ve worked on so far (actually only one significant work which I am satisfied with. The rest, although not at the time of completion, I feel a little embarrassed about and could use some more work and refining…). Check it out.

Changing your Windows Live (Passport) ID registered email

Occasionally I’ll post something off topic. This is one of of them.

I always thought that the email one registers for a .NET passport/Windows Live ID was permanent and that you can’t change it. But today I was surprised to find that you can. So for those who’re using still using their abandoned Hotmail email address(es) just for MSN Messenger, you can now change it to your current email address at https://account.live.com

My day spent at EnergizeIT! 2007

Congrats to Microsoft for being the first topic I’m gonna blog about. :P

Today Microsoft Canada held their 2nd annual EnergizeIT! event today at the Toronto Metro Convention Centre. I have to confess that I planned to go just for the free swag… mainly the free Office 2007 Professional give away.

Continue Reading »

Hello World!

I remember attempting to learn the C programming language for the very first time just a little under 10 years ago in the summer of ‘98, although I didn’t get too far. I was learning off the very popular C for Dummies Vol. 1 & 2 by Dan Gookin and the very first command line program that I wrote in C was a variant of the “Hello World” cliche program. Dan tried to be funny and witty so he called it his “Good bye cruel world!” program instead. I can’t believe a decade has almost gone by since…

Anyway, this blog will be mainly focused on my main interest and passion: video games, game development & programming, and the gamedev scene and community in Toronto. I’ve been hooked on the subject for over ten years now ever since I read the Dec ‘95 issue of Nintendo Power. It featured an interview with the Shigeru Miyamoto, creator of the Mario and Zelda series and commonly referred to as the “Spielberg of video games“. It was that interview article in Nintendo Power that inspired me to get to where I am today, and for the next few years ahead.

I hope you enjoy your stay.