Wednesday, 9 May 2012

Raspberry Pi Wifi - WG111T

In this post I will describe the progress I have made so far in getting my WG111T USB wifi adaptor working with Debian Linux on my Raspberry Pi. 

My first stop was to consult the list of supported hardware. This was initially encouraging as it lists the WG111v2 as supported but sadly my WG111T uses a different chipset. This page also links to an example of getting an arbitrary USB wifi device working. This suggested I look for firmware on the linuxwireless.org site. Google suggested that I needed the ar5523 firmware. The change log for this firmware isn't very encouraging as it refers to the kernel panicking when the device is probed. Furthermore it's not clear how I would build and install this firmware.


More googling turned up a wiki page which described in much more detail about how to build and install the firmware. Following these steps I got as far as "dpkg-buildpackage -us -uc" before hitting an error that my version of debhelper was too old. Thankfully I was able to use apt-get to force an upgrade to an appropriately newer version. This got me as far as running "m-a a-i ar5523" where I hit the following error:

Without the kernel headers I am now stuck so my next task is to work out how to get these installed. It was late by this point so I gave up for the night.
 

Getting Started with Rasperry Pi

On Febuary 29th I got up at 6am along with far too many other geeks and tried to place an order for the newly released Raspberry Pi. The demand was so high for the original 10,000 units that the websites of both distributors were knocked offline. By 8:30 I managed to complete an order with Farnell from my iPhone on the way into work. Yesterday my Raspberry Pi arrived and I could finally get started!

Like any computer the Raspberry Pi needs to be hooked up to a number of peripherals to become useful. The first and most important addition is an SD card with one of the Raspberry Pi OS images loaded onto it. I never got round to preparing this in advance so my first step was to download the Debian Squeeze image onto my windows XP netbook (my only computer with an SD card writer) and write it to my 8GB SD card (using Win32DiskImager as per these instructions).

With the SD card ready I connected up my Pi.

  • 4 port powered USB hub - this expands the 2 built in USB ports to 5 USB ports. However, I'm using one of the hub ports plus a micro USB cable to power the Pi which only leaves me with 4 ports available.
  • 16GB USB memory stick for extra storage.
  • Combined USB keyboard/mouse wireless receiver.
  • HDMI cable from the Pi to my projector which I will use as the screen.
There is no power switch so as soon as I plug in the USB hub power supply the Raspberry Pi starts booting. Unfortunately the first time I did this there was no output on the screen. Thankfully this was just caused by the HDMI cable being loose in the Raspberry Pi - the connector is quite stiff and I had to push firmly to fully insert my cable. The screen didn't actually display anything with a properly inserted connector but a quick reboot of the Pi was enough to prompt the connection to be detected.

After all this I was rewarded with a login prompt requiring me to head back to the OS downloads page to check the default username and password. Once logged in I set the clock at the suggestion of the welcome message and then considered my next move.

I ultimately want to connect my Pi over wifi and I have an old WG111T USB wifi radio lying around. My first real challenge is to get this USB wifi working. While I work on this I dug out a huge network cable to stretch across my room to my router and hooked up my Pi. Amazingly, after a few seconds the Pi had successfully DHCP'd and I could ping www.google.com. At this point I decided to make my Pi experience a bit prettier and ran startx to launch the GUI.

I had a quick play with the browser and found that things seemed sluggish but usable. An impressive feat for such a cheap device! I was also amused by the -1% CPU being used by some processes :)

Before I got my Pi I had been encouraged about the possibility of getting my USB wifi working thanks to the list of verified hardware which included the WG111. Unfortunately the verified version was the WG111v2 not the WG111T so I am in fact stepping into uncharted territory. My next post will detail my progress with this task.
 

Wednesday, 2 May 2012

Little Bits

I have recently started watching some TED talks again on my way to work. Yesterday I saw an excellent presentation about a project called Little Bits.

Little Bits is an attempt to do to electronics what Lego did to construction - make it fun and accessible for kids to play with. It's worth checking out the TED talk.

Sunday, 22 April 2012

Electronics to keep the wife happy

This weekend I decided to do something a bit more obviously useful than my usual projects. My house includes a cupboard under the stairs that is lit by a battery powered light. However, the light is a bit useless as it is always running out of battery really quickly.

 

The first step is to open up the light and take a look inside. This turned out to be quite straightforward as I just needed to remove four screws and pull the top off.

The internals are very simple with color coded wires. The only surprise is that there was a round female connector fitted to a round hole on the rim of the light. This looks like it would allow the light to be mains powered but that is no good to me as there are no sockets in the cupboard I'm using the light in.

With the cover off I took the chance to measure the current used when the light is switched on. The result: 500mA! No wonder the batteries lasted for such a short time! However, I'm not entirely surprised by this result as the light was using an incandescent bulb.

As an aside - I always find measuring current really awkward as you have to insert the multimeter in series in the circuit which is tricky when the probes are just pointy metal tips rather than clips which can hold a wire.

The next step is to make this light better. I decided the easiest way to do this would be to replace the incandescent bulb with an LED. I took a look on maplin and picked out a bright white LED which runs at 3.6V and only draws 100mA to produce 18000mcd of light. According to this site 18000mcd is 2.1 lumens which compares to 850 lumens for a 60w incandescent light bulb.

The 3.6V requirement means that I only need three of my 1.2V rechargeable batteries and won't need to add a resistor. The first step was to insert a wire instead of the fourth battery.

The next step was to remove the incandescent bulb along with its screw socket (which I have saved in case I ever need them in another project) and solder an LED in its place. The only tricky part of this was that the wires in the light were stranded instead of solid core which made the soldering more fiddly.


That's all there was to it. I put the case back together, turned on the light and took a picture.


The light is brighter than this picture suggests (my phone overcompensated with the exposure) but it is a bit less bright than I had been hoping. In future I might add an extra LED or two which would double or triple the light output with a corresponding reduction in battery life (more LEDs = more current but the same voltage).

Once everything was assembled I got out my multimeter and measured the current and was pleasantly surprised to find the current was only 70mA rather than the expected 100mA. Since I am using 1700mA batteries this means I expect a battery life of about 24 hours compared to the 3 hours which I would have got with the incandescent bulb.

 

 

 

Wednesday, 18 April 2012

Wiimote Head Tracking - Follow Up

After my previous post I came across some interesting related content.

More Head Tracking

I found a tutorial which used a different Wii library (Wii Yourself) and describes how to create a clone of the Johnny Lee VR demo using Ogre3D.

Light Brush

I also decided to take a look at r/arduino and quickly spotted an interesting related project which uses the Wiimote as part of an Arduino powered Light Brush. The reddit thread credits this blog (http://liightbrush.wordpress.com/) with the idea and links to this blog (http://mrarduino.blogspot.co.uk/) about the implementation referenced in the reddit post.

A bit of further googling turned up http://kenfrederick.blogspot.co.uk/2009/08/lightbrush.html which was an interesting post about trying to implement a light brush. This post also links to some other similar projects such as the Lightscythe.

Monday, 16 April 2012

Wiimote Head Tracking

Background

In December 2006 the Nintendo Wii was released. This included the Wiimote controller which provided an interesting new motion tracking system. The Wiimote connects to the Wii over Bluetooth and includes two kinds of sensors. A 3-axis accelerometer and an IR camera. For the purposes of this post the camera is the more interesting part.

The infrared camera has a resolution of 1024x768 with built-in hardware blob tracking of up to 4 points at 100Hz. This is used in combination with the Wii sensor bar which is actually just an array of 6 IR LEDs, 3 at each end, to provide accurate motion tracking of the Wiimote when it is pointed at the sensor bar.

In December 2007 a develope called Johnny Chung Lee posted a video showing how the Wiimote could actually be used in reverse to accurately track a users head. This involved mounting IR LEDs on some glasses to take the place of the sensor bar and placing the Wiimote in front of the screen pointing at the user.

This demo was built on top of the Wiimotelib C# library for using the Wiimote on windows. A forum which discusses the head tracking demo is available here.

In a recent episode of Gadget Geeks on Sky One they used this technology to build a virtual window for a hotel room. This inspired me to investigate the technology myself.

My Hardware and Results

To build my own IR glasses I bought the following components:
I connected the battery, switch, LEDs and resistor together in a simple series circuit and built the circuit around an old pair of cheap sunglasses which I found at home. I was quite pleased with how the results looked.

The complete glasses:

Close up on the side with the switch and the battery.

Full view of the side with the battery.

I then setup a Wiimote on top of my TV with some masking tape holding it in place. I used some more masking tape to hold an iPhone wide angle legs in front of the camera to give it a wider field of view - the camera normally only has a ~45 degree field of view.
A view of the TV including the attached Wiimote:
A close up of the Wiimote:
The results can be seen in this video.



Conclusions

I was quite pleased with how good this looked. However, the are a few key limitations.
  • The lack of stereoscopic depth cues means that in person the 3D effect is much less effective than the video would suggest. If I combined this head tracking with a 3D TV I expect the combined effect would be really impressive.
  • The field of view of the Wiimote camera is a really limiting factor as it is easy to move out of its view at which point obviously the head tracking stops working.
  • The previous limitation is made much worse by the fact that the camera only works over fairly short distances. I found that once I moved much more than a meter away from the camera it started to struggle to keep track of me. This forces you to stay much closer where the narrow field of view is more annoying.

Other Consoles

The Wii has sold the highest number of units out of the current generation of games consoles (vs the Xbox 360 and PS3). However, as of Autumn 2010, both of the rival consoles have released their own motion tracking systems. Interestingly, both of these systems work in a similar way to the camera based head tracking covered in this post. In fact, the original creator of the head tracking demo, Johnny Chung Lee, ended up working on the Xbox Kinect development team.

Xbox Kinect

The Xbox Kinect system uses an infrared projector to project a pattern of infrared light. This is then captured by a 640x480 pixel 30fps infrared camera. This input is augmented with a 640x480 pixel 30fps rgb camera. The advantage of this approach is that the IR light source and detector can be contained in the same package and the player doesn't need to wear/hold anything to be tracked.

It is interesting to note that both the resolution and frame rate of the IR camera is lower than the one used in the Wiimote.

Playstation Move

The Playstation Move uses an approach which is much closer to the one described in this post. The Playstation Eye camera provides a 640x480 60fps rgb picture which works even in very low light. This enables the use of the Playstation Move controllers which have a coloured sphere on the end. The system automatically picks the best color to stand out against the current background and then uses simple image processing to track the coloured sphere within the camera image. The known size of the sphere allows for the accurate measurement of depth.

Once again the actual resolution of the camera being used is lower than the one used in the Wiimote.

Research

Johnny Chung Lee has a blog which has some interesting posts about motion tracking and other tech topics. The post which stood out to me was this one. In particular, the following two videos are pretty exciting. Both of these are systems that work entirely by analysing RGB video without any extra sensor data.





Monday, 9 April 2012

New Blog - Coding

I haven't been doing much work on Arduino projects recently as I have been spending all of my time on coding projects. I have enjoyed posting to this blog so I have started a new blog to talk about these coding projects.

http://mchr3k-coding.blogspot.com/2012/04/introduction.html