lunes, 14 de marzo de 2011

Giving Yourself a Sixth Sense for Wireless Networks

Giving Yourself a Sixth Sense for Wireless Networks




What? How?

Amaze your friend(s) and terrify your enemies by granting yourself the ability to supernaturally sense wireless network hotspots! (Well, apparently supernaturally, anyway.)

You will easily and quite literally "feel" wireless access points in the vicinity and automatically sense their signal strength as easily as you feel the wind on your cheek.

All you need is a few parts and some careful electronics work.

What This Is

This project is for a small electronic unit that allows the user to sense the presence and relative signal strength of wireless hotspots. It can be worn as a pendant or carried in a pocket. It is "always on" and communicates the presence and signal strength of an in-range hotspot by way of sequences of pulses - like a heartbeat you can feel. The stronger and faster the "heartbeat", the stronger the wireless signal detected.

It does not actually authenticate or otherwise interact with a hotspot in any way. It is a 100% passive device, meaning it transmits nothing --- it can detect hotspots, but cannot be detected itself.

How It Was Made

This project consists of a microcontroller, some custom interface electronics, a small vibe motor, and an off-the-shelf Wi-Fi detector - the one I used is by D-Link and is keychain-sized.

Here is the sensor I used, and some pictures of the construction. Details of the design will follow.










How It Works

The microcontroller periodically "presses" the button on the detector to initiate a reading. Then the microcontroller "reads" the output from the indicator LEDs on the detector, and uses this as the basis for pulsing out a signal on the vibe motor, which the wearer can feel.

In this way, the unit keeps you updated on the presence and signal strength of a wireless hotspot in your vicinity. No pulses means no signal. Short pulses means a weak signal. Faster, more frequent pulses means a stronger signal. This feedback is very much like a heartbeat, and is extremely intuitive to interpret.

How To Make Your Own

First of all, I use a microcontroller in this project. If you aren't familiar with terms like 12F629 or .HEX files and how to blast them into a PIC, you will have trouble with this project.

The D-Link sensor I used works like this -- press the button and the LEDs light up in a "scanning" pattern while it looks for a signal. It can be in this scanning pattern for up to a few seconds. Afterwards, it lights up either one, two, three, or four of the green LEDs to indicate relative signal strength. If there is no signal detected, a single red LED is lit. The LED(s) remain lit for a few seconds, then the sensor shuts off.

If your chosen sensor works differently, you will need to adjust the electronic interface and the program in the microcontroller accordingly.

Click for larger versionThe electronic add-on part interfaces to the sensor in two basic ways:

  1. The "Button Hitter"

    This is how a digital output from the microcontroller "pushes" the activation button on the sensor. A digital "0" to the spot indicated on the graphic triggers the sensor.

  2. The "LED Watcher"

    This is how the microcontroller senses which LEDs are lit (or not lit) and reads them as digital inputs. As shown on the diagram above, the indicated spots beside each LED can be read as a digital "0" when the LED is lit.

Operation

This is a basic description of how the unit works (the code in the microcontroller is a little more complicated, but this will tell you what happens).

The microcontroller program is a big loop that does the following tasks asynchronously: activates the sensor every 10 seconds or so, checks to see if any LEDs are lit solidly (a signal strength reading is ready), pulses an appropriate "heartbeat".

  1. Activate the sensor. (Note that the "scanning" - where LEDs light up momentarily back-and-forth in an old-school Cylon-eye fashion - can take up to a few seconds to complete.)

  2. Watch those LED outputs and wait until one or more LEDs remain lit for at least 500ms.

  3. Did any LEDs remain lit? If so, then check which one(s). This tells us the signal strength. Then depending on the signal strength, set the "heatbeat rate" to reflect the strength of the signal detected:

Signal strength 4 (highest): pum-pum-pum-pum-pum-pum

Signal strength 3 (high): pum-pum ... ... pum-pum ... ... pum-pum ... ...

Signal strength 2 (low): pum ... ... ... pum ... ... ... pum ... ... ... pum ... ... ...

Signal strength 1 (lowest): No change (provides hysteresis beftween LOW and NO signal).

Signal strength 0 (none): No heartbeat.

  1. Every 10 seconds, repeat #1.

Specific Design Information

Click for Larger ImageHere is a schematic of the interface and electronics. The sensor and electronics run on a 3V supply (provided by CR2032 cells in parallel) and the vibe motor has a separate power supply. A couple AAA cells or even another CR2032 cell should do the trick.

I used the Microchip 12F629 microcontroller, and Melabs' PICBasic compiler.

Download the source code

Download the .HEX file

I ignore the lowest signal strength LED for purposes of reading the sensor's output (I actually do not read it, and as a result it acts as a "no change"). This provides some hysteresis between the LOW SIGNAL and NO SIGNAL results.

The HIGH SIGNAL and NO SIGNAL are OR'd together on GP5 on the PIC. This saved me an I/O pin at the time. Since a HIGH SIGNAL reading lights all the signal LEDs, if GP5 is low (active) then I can check GP4 (the next signal LED down) to determine the "real" reading. If GP4 is also low, then the HIGH led was lit. If GP4 is not low (led not lit) then the NO SIGNAL led was lit. This is explained more fully in the source code -- but the short version is that I saved an I/O pin by doing it this way. (The I/O pin I "saved" (GP1) is unused in the schematic -- this is intentional as I was actually having quite a lot of trouble with it, so I simply avoided the problem and just left it alone.)



1 comentario: