Using bluetooth to identify devices in range out of potentially thousands? - algorithm

Greetings!
The idea is simple. Let's say that I have a service wherein people can walk up to a kiosk and "pair their phone" with a bluetooth device on that kiosk. We'll ignore why people would do this, but let's say that they have an incentive to do so.
Let's say that I have convinced thousands (if not millions) of people to do this thing... and they're walking around with their cellphones with bluetooth ON. (Not discoverable.) How do I solve the problem of scanning for "known devices" if there is a possible pool of millions of known devices?
Again, I don't want to connect with them once I've actually done the initial pairing. I simply want to know they are proximate.
Thoughts?

Well, the first thing is that even if your kiosk has a Class 1 Bluetooth radio in it, which can actually go farther than the advertised 100 meters, it's still extremely unlikely that there will be millions of Bluetooth cell phones who have previously paired with your kiosk within the range of your kiosk's radio. So that narrows down the potential number of Bluetooth devices you're dealing with.
Second, if a device is not discoverable, then it doesn't matter if you've paired with it before or not. You will not find it using a general "Hello, is anybody out there?" inquiry scan. If you've paired with a device, you will know its Bluetooth Device Address and can therefore ping it explicitly and get an answer. This doesn't seem like a reasonable thing to do if you're thinking you might have millions of cell phones paired with your kiosk. (Have you thought about the fact that if you have multiple kiosks your users would have to pair with each kiosk separately? Do you really need to pair with the cell phones to do what you need to do?)
Having said all that, a general inquiry scan will produce a list of discoverable Bluetooth devices in the vicinity of your kiosk's radio. You could use that list to search your own list of devices paired with the kiosk. I can't remember if you get back just the friendly name in the first response or if you get a BD_ADDR as well. If you just get the friendly name, there could be multiple devices with the same friendly name, as I doubt many users change their phones' friendly names.
It's been a while since I really delved into the Bluetooth spec so things may have changed.

Pairing may be overkill: that's about establishing secure communications. Worse, ISTR some phone UIs don't separate pairing (having a secure channel) and trust (allowing the remove device to do stuff without asking the user whether it should), although I hope modern phones get this right.
If you just want the other device's Bluetooth address, you could get people to send the kiosk a business card or something. Or tell them to become discoverable and have your kiosk initially find them. Or they could pair, but as Kirsten says, they'd be paired with a single kiosk: you may not care if all you want is their address, though, rather than the secure channel.
Now you've got a list of Bluetooth addresses. You can share these addresses between multiple kiosks if you've got some sort network between them. In an ideal world, detecting proximity would then be a matter of performing BT inquiry (you don't even need full device discovery here, just knowing what addresses are out there is enough) and matching the addresses you get from that against your list. But that only works when remote devices are discoverable (which means they're listening for inquiry packets, doing what the spec calls inquiry scanning). If they aren't, you'd have to try to connect to each one in turn (you can drop the connection once you know the other guy is there). You could parallelise this with multiple BT radios, but you're looking at a few seconds per address per radio. You're doing the old "Redfang" brute-forcing that people got excited about a few years ago, but it's going to be slow: http://www.newswireless.net/index.cfm/article/924
Of course, if people aren't leaving their devices discoverable, the implication is they don't want to be found, so it's not surprising that this doesn't work.

Related

How not to store MAC addresses but still keep the knowledge about how it moves across the city?

I heard that there are companies that can track people's WiFi-enabled devices (smartphones, laptops, tablets) by collecting MAC addresses from their probe requests.
So, let's say that I have a distributed network of access points which gather those probe requests (I'm asking just out of curiosity). There are many privacy concerns about the idea. What can I do to have statistical knowledge about people moving from point to point but without storing their MAC addresses?
I thought that I could hash that MAC addresses using hash functions, so I wouldn't have MACs and I would still be able to track devices by comparing hashes. But that's not enough. I think that maybe there's something more that I can do.
Ideally, I could have just IDs of devices (but not MACs, my own IDs). Is there a way to accomplish that?
Perhaps the access points would have to talk with each other and somehow magically agree that this MAC is the same MAC as previously and send to the server the ID which is assigned to this MAC by combining data from some (all?) access points. That way it would be harder to get the MACs.
I think a hash is exactly what you want here, why would it not be enough? If you hash the MAC with an algorithm like HMACSHA256 and just store the resulting hash, even if someone where to get hold of your database AND your secret key they wouldn't be able to work out what the MAC addresses were, unless they also had those MAC addresses which they could then hash with your secret key and compare to the ones in your database to see if there was a a match.

GSM-based mobile phone sensor

Alright, this may sound completely insane, I am not an electronics guy, just asking.
As far as I'm concerned, there are two most popular technologies for close-range communication: RFID and NFC. These technologies are just emerging in the mobile phones, as you don't see a lot of devices supporting them. Is it possible to build a GSM based sensor for the purposes of detecting who's sitting at the desk?
Let me describe the context. I'm working with a mobile phone operator to build a shop as part of my studies. They are able to install any GSM transceiver anywhere, and use it legitimately.
As NFC is not quite there yet, one of my proposals to them is to let people use their phones instead of (or as they would use) any RFID card, like Oyster in London, in order to make payments, quickly change tariffs, top-up, etc. I imagine that this may be possible by making a low-power GSM base station combined with a proximity sensor.
If so, then we can get a phone user with the strongest signal, get the information from the proximity sensor to define if there is a phone in front of the sensor and thus detect who is the user. What do you think? Is it something possible?
You can definitely have low powered base stations but they would generally be for a small area in a big venue/city or for a house or room.
Any phone in the coverage area from that operator would connect to that cell if it had the best signal, so you would find it very difficult to distinguish between two users who are a couple of feet apart. I'm guessing this would not be good enough for your use case.

Time measurement between two points

i need to measure the time between 2 points. I can not use a simple watch because i have no free hands for this. (mountainbike - downhill)
My first idea was to set two GPS points and measure the the time between those points, but I think it will be to inaccurate.
my second idea was to set one bluetooth device to each Point and just measure the distance from me to the bluetooth device , check the shortest distance and save the time.
But than I realized that I would need 3 bluetooth devices to make a distance calculation, which is kinda annoying.
Any idea how i can measure the time between two points with an accuarcy <1sec ?
I want to control this via smartphone.
edit:
Okay i have another idea. Maybe i could set one bluetooth device to each point. I set the signal strenth to <=1m. Than i could easily start and stop the time until i receive the bluetooth signal on my android.
Do you think this would be the best approach ?
It seems you're trying to take total and split times for a course. Definitively, forget of using bluetooth for other things that are not constant transmissions, with slow connection time... (I speak from experience). Of course you want to do it in the cheap, because there already professional solutions for that (e.g.).
From my point of view, if you want something accurate and been able to integrate it with you phone, you'll need the following:
DIY photocell sensors. Maybe involving simple chip (e.g. msp430), phototransistor-diode pair, cheap 433mhz transmitter and batteries.
DIY 433mhz receiver for your phone. There already many boards that supports android open accessory library, (e.g. 49$ from sparkfun), so you only have to connect it to a 433mhz receiver and to your phone.
Custom code programming in your android phone. To be able to receive the signals from the split signal senders and keep track of all times.
It seems to be a pretty decent project for under $250-200(if you self made it :P).
One possible solution that does not require any special hardware would be to use a smartphone at the finish line. You would only need an extra smartphone (SP) with net connection, and some software.
SP sends the start signal to your phone. You start when you hear the signal.
SP uses its camera to detect when you reach the finish line.
SP calculates the time between start and stop and displays it, and possibly sends the info to your phone, too.
Maybe you could even record a video with time stamps.
(Of course, the low cost solution would be to let one of the guys to use a stopwatch at the finish line.)

How to convert Wifi RSSI to level of Wifi strength in menu bar in Mac OSX?

I can get the value of Wifi RSSI. but don't know how to convert it into level of Wifi strength as we can see in the menubar in Mac OSX (If I receive a strong Wifi, the wifi status will be bold black on all 4 lines of wifi icon).
Is there any methods or library that I can use to do this? Thx in advance.
I don't think you'll find anything in the API to do this.
I think you might have to Use Scienceā„¢ and do a manual check, literally walking away from your WiFi access point with laptop in hand, noting down the RSSI values at which the WiFi signal indicator icon changes. Do this a few times and you'll likely find a correlation. I can't imagine it would take more than ten or fifteen minutes to get a good range of sample values.
It's probably worth trying it with more than one type of Mac, if possible.
There is no public API for this. You'll have to figure it out yourself. You might be able to use something simple like (RSSI+100)/8 and then clamp the result between 0 and 4 bars.
Also, you'll want to use a rolling average over a few seconds to keep the bars from jumping around if the signal ends up at a boundary case or jumps around.
PS: AFAIK, Apple uses a more complex algorithm which takes Transmit Rate into consideration.

How to differentiate between lan card and data card?

I have a data card with me.
I wanted to know, is there any way programmatically I can tell that, it is data card or it is LAN card?
I have used IFTable, I have used IListManager, INetwork manager provided by Microsoft, but not able to solve the problem.
Edited
I have one lan card and one data card connected on my system, I want to do some operation on data card, but I don't know, when my data card is connected and when my LAN card, enumerating will give me list of all connections, but how to identify LAN and Data card among them.
You should clarify your problem. What problem are you trying to solve? Why do you want to distinguish the cards?
That said, some ideas:
If you just want to identify your specific cards, every network card has a unique ID (the MAC). You can retrieve it using networking tools.
If you want to identify the type of card, you can try to get PCI information, and look for a string. But that is difficult in the general case, because there are so many different types of cards. So you'd need to clarify your question.
There is no clear distinction between the different kinds of networks anymore. On the one hand, LANs have gone wireless with WiFi. On the other hand, public networks have gone local with femtocells. Hence, it becomes increasingly difficult to distinguish the two kinds of networks, and therefore the network cards connecting to them. There is no clear boundary.

Resources