iPhone presence detection

I have a post up over at EchoDitto Labs talking about detecting the presence of an iPhone over a wifi network.

The basic idea is pretty simple: you set up your router so that it always gives the phone the same IP address (you *are* running a custom Linux firmware, right?). Then you run a script every minute or so that pings the phone’s assigned address (the script can also be run on the router). Depending on whether the ping is successful, you perform an action — in the post I just log the results and then graph them, but it’d be just as easy to have the router load a given webpage. I’m thinking that it might be neat to have my router and Emily’s router both report to this site whenever they see me. I could use that data to populate a little box on the sidebar indicating whether I’m in Philly or DC. Or at work, I suppose.

But I’m not sure what granularity I want to provide for such a display, or if it’d actually be useful to anybody. It is, I admit, pretty creepy.

5 Responses to “iPhone presence detection”

  1. Mike says:

    Perhaps it would be easier to wait for the iPhone SDK to come out, and then write some sort of app that contacts your site on a regular basis, which can say what city you are in based on what IP address the request originated from.
    Then people could use the app even if they have not hacked their router.

  2. Tom says:

    That’s a great idea Mike — although come to think of it, there’s already a semiregular polling app on the iPhone: the mail client. It might be possible to troll through POP3 logs and pick out where requests are coming from. A quick SSH session into my host makes it look like I don’t have access to that information though, unfortunately.

  3. mike d says:

    Actually, that would be pretty cool – 95% of my use of Facebook is just updating what town I’m in so my adoring fans can keep track…
    The one nuance you’d like, either for the SDK or Linux implementation, would be to have an option to switch it off, or only have it update once every couple of hours. Otherwise if you’re traveling, you’d have to explain why you were saying you were in Detroit or Atlanta (if you’re flying) or constantly updating your location from Laurel to Columbia to Catonsville to Baltimore to Towson to Perryville… (if you’re driving).
    Although maybe that concern is a little overly-sensitive.

  4. ben wolfson says:

    So you set up a fake POP server that exists only to receive requests from your phone, and add it to the list of those polled.

  5. Tom says:

    Exactly — and I’ll do that if I have to. But after writing that I realized that it would be easy to just look at my companys IMAP logs. So I have a sample tarball waiting for me. When I have a chance I hope to write a script that’ll plot the company’s employees’ locations on a google map, for display on the monitor in our lobby (only for those who opt in, of course — with the city-level granularity that I expect to get it shouldn’t be a big deal).

Leave a Reply