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.
The electronic add-on part interfaces to the sensor in two basic ways:
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.
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".
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.)
Watch those LED outputs and wait until one or more LEDs remain lit for at least 500ms.
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.
Every 10 seconds, repeat #1.
Specific Design Information
Here 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.
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.)
How-To: Build a WiFi biquad dish antenna
Wireless enthusiasts have been repurposing satellite dishes for a couple years now. This summer the longest link ever was established over 125 miles using old 12 foot and 10 foot satellite dishes. A dish that big is usually overkill for most people and modern mini-dishes work just as well. The dish helps focus the radio waves onto a directional antenna feed. We're building a biquad antenna feed because it offers very good performance and is pretty forgiving when it comes to assembly errors. Follow along as we assemble the feed, attach it to a DirecTV dish and test out its performance.
Why? With just a handful of cheap parts, a salvaged DirecTV dish and a little soldering, we were able to detect access points from over 8 miles away. Using consumer WiFi gear we picked up over 18 APs in an area with only 1 house per square mile.
Building the antenna
Biquad antennas can be built from common materials, which is nice because you don't have to scrounge around for the perfectly-sized soup can. We did have to buy some specialized parts before getting started though.
The most important part here is the small silver panel mount N-connector in the center of the picture; the entire antenna will be built on this. We purchased it from S.M. Electronics, part# 1113-000-N331-011. The "N-connector" is standard across the majority of commercial antennas and you can connect them to your wireless devices using "pigtails." The longer pigtail in the picture is a RP-TNC to N-Male pigtail that we'll use to connect our antenna to a Linksys WRT54G access point. The short pigtail is a RP-MMCX to N-Male pigtail so we can connect to our Senao 2511CD PLUS EXT2 WiFi card which is pictured. We also purchased 10 feet of WBC 400 coax cable so we wouldn't have to sit with the dish in our lap. We got our surplus DirecTV dish from Freecycle. We'll cover the reason for the mini butane torch later.
Trevor Marshall built one of the first biquad WiFi antennas found on the internet. We followed the slightly more thorough instructions found at martybugs.net. Here are the raw materials we started with:
The wire is standard solid-core 3-conductor wire used for most house wiring. We didn't have any copper printed circuit board material laying around so we used this thin sheet of copper and supported it using the 1/4-inch thick black plastic pictured.
The first step in building the element was stripping and cutting a 244mm length of wire.
We marked the wire every 31mm with a permanent marker and began bending the wire into a double diamond shape. We tried to make the length of each leg 30.5mm.
The easiest way to make really sharp bends in the solid copper wire is to use two pairs of pliers. With the pliers held perpendicular to each other bend the wire against one of the sets of jaws.
The element with all bends completed:
Next we cut out a 110mm square of black plastic to use as a base for the reflector. We drilled a hole in the center to clear our connector.
We then soldered a piece of copper wire to the center pin of our N-connector.
Next we soldered a piece of of wire to the outside of the connector. We ran into some trouble here. Our cheapy iron was not capable of getting the connector's base hot enough to make a good solder joint. We bought a butane torch and used that to heat up the surfaces. This worked pretty well except it desoldered our center pin. We recommend you solder the outside piece of wire first before doing the center one.
After the connector had cooled it was attached to the black plastic base using epoxy. The thin copper sheet was attached to the front with epoxy and trimmed to fit.
We let the epoxy cure for a while before proceeding. The next step was to solder our bow tie shaped element to the vertical wires. The element was supported by two pieces of scrap copper trimmed to 15mm to ensure proper positioning.
Then the extra wire was trimmed off and the outside wire was soldered to the ground plane to complete the antenna.
To make mounting to the dish easy we modified the original feedhorn. Here is what it originally looked like.
After removing the housing, internal components and shortening the feedhorn looked like this.
The antenna is attached by inserting the N-connector into the tube and then connecting the coax cable.
Here is a picture of the final antenna assembly ready to be attached to the dish.
Since the satellite dish has an off-center feed it looks like it is pointed at the ground when it is level with the horizon. Even though there are no angle markings for setting the dish at 0 degrees inclination we can still ensure that the dish is pointing at the horizon by setting the dish angle to 45 degrees and mounting it on a tube with a 45 degree angle.
Test results
The Engadget Corn Belt Testing Facility has broadband access provided by a local WISP. So we knew if we plugged in our antenna we were sure to pick up something in the area. We pointed the dish at the closest grain elevator, where the WISP mounts their antennas. We connected the dish feed to our Senao card and started up Kismet.
We expected to get one AP, but five is even better. Looking through the info strings we were able to determine where the APs were since the WISP had named them according to the town they are in. The AP on channel 5 is the one we pointed at in town A, 2.4 miles away. The AP on channel 6 is located in town B, 8.2 miles away. The two APs on channel 1 are a bridge between town A and town C which is located 2.6 miles directly behind the dish.
Our next test was to hook our WRT54G up to the dish and point it at a hill 1 mile away. We drove to the top of the hill and used an omnidirectional mini whip antenna with our Senao card to detect it.
Our router was picked up easily. The found 14 other WISP APs including town D, 7.8 miles away. The WISP is definitely using some high powered equipment if we're just picking this up with an omnidirectional antenna.
For a final test we put the dish on the roof rack and parked on top of the hill to see if we could pick up any more APs.
Our final count is 18 APs, 17 of those belonging to the WISP. This was a pretty fun project and shows that you can build decent wireless solutions using consumer gear.
For the curious: The WISP gives its subscribers a patch antenna with a built in power-over-ethernet access point. Once the antenna is mounted to the roof they run a single ethernet cable into the house which means they don't have to worry about signal loss from coax. These client boxes are manufactured by Tranzeo.