Hi,
I'm looking to build an installation where I need to sense position and direction inside a limited 3D space. Each person in the room should have a device that you can point around the room and they should get feedback when pointing at certain objects in the room. There could be more than 20 devices in operation at once.
What options do I have for building such a (handheld) device? I assume that I can get rotation with a magnetometer, but how could I get hold of the position of each device?
Sensing position in space
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Sensing position in space
For room-sized positioning, you have a couple of options: GPS or audio ranging.
GPS has a 'circular error probability' (CEP) of 1.8 meters. If you take 100 readings and mark their positions on the floor, 95 of them should be within 1.8m of the device's actual position. You can filter the readings to produce better estimates over time, but you have to pay for it in response time. The same filter that trims away random system errors will also trim away legitimate changes in position. That isn't so bad when you're tracking a vehicle moving at a more or less constant speed in a more or less constant direction, but doesn't work so well for situations where people are moving around a room. The stops, starts, and changes in direction look almost exactly like the GPS module's random error.
Audio ranging requires a bit more setup, but can give you very good estimates from a single set of readings.
The basic idea is that you build at least three fixed towers that emit audio pulses the moving devices receive. Sound travels at about 350m/s, or about a third of a millimeter per microsecond. If you can measure the time between when a tower emitted its signal and the time the moving device received it to a resolution of 30uS (pretty easy for most microcontrollers today), you can estimate the distance from the tower to the mobile device to within about 1cm.
If you have three towers at known positions, you get three distance estimates that can only map to a single point on the floor.
The trick is getting a reliable estimate for when the tower emitted its signal. There are ways to do that just with the audio signals.. the mobile device can emit a chirp and the towers can echo the chirps back, creating a round-trip time that the mobile device can measure. Managing the traffic for that is a bit complicated when you have lots of devices that want to check their positions though. In that case, it's better to go with a strategy where all the mobile devices are passive.
Fortunately that's easy to do: have the towers emit pulses of light at the same time they emit the audio signals.
Light moves about a million times faster than sound, so the mobile devices will see the flash of light almost instantly. The time between seeing the flash and hearing the sound provides a usable measurement of the time it took the audio signal to go from the tower to the mobile device, and all the mobile devices can take their range from a single tower pulse.
If you give each tower its own pulse pattern.. "AA", "II", and "MM" in morse code (.-.-, ...., ----).. the mobile units will be able to decide where each pulse comes from. Have the towers watch for each other's pulses and have them take turns so they don't interrupt each other, and you get a workable ranging system.
You can use IR LEDs to emit the light pulses, and if you do that you may as well use the standard 38kHz signal frequency. It would be nice to emit the audio waves at the same frequency, but that would be well into the ultrasonic range and you might have trouble finding microphones with good response at that frequency. A frequency of 22-25kHz would still be too high for people to hear, but close enough to the range where standard (cheap) electret microphones work to give you easy detection.
GPS has a 'circular error probability' (CEP) of 1.8 meters. If you take 100 readings and mark their positions on the floor, 95 of them should be within 1.8m of the device's actual position. You can filter the readings to produce better estimates over time, but you have to pay for it in response time. The same filter that trims away random system errors will also trim away legitimate changes in position. That isn't so bad when you're tracking a vehicle moving at a more or less constant speed in a more or less constant direction, but doesn't work so well for situations where people are moving around a room. The stops, starts, and changes in direction look almost exactly like the GPS module's random error.
Audio ranging requires a bit more setup, but can give you very good estimates from a single set of readings.
The basic idea is that you build at least three fixed towers that emit audio pulses the moving devices receive. Sound travels at about 350m/s, or about a third of a millimeter per microsecond. If you can measure the time between when a tower emitted its signal and the time the moving device received it to a resolution of 30uS (pretty easy for most microcontrollers today), you can estimate the distance from the tower to the mobile device to within about 1cm.
If you have three towers at known positions, you get three distance estimates that can only map to a single point on the floor.
The trick is getting a reliable estimate for when the tower emitted its signal. There are ways to do that just with the audio signals.. the mobile device can emit a chirp and the towers can echo the chirps back, creating a round-trip time that the mobile device can measure. Managing the traffic for that is a bit complicated when you have lots of devices that want to check their positions though. In that case, it's better to go with a strategy where all the mobile devices are passive.
Fortunately that's easy to do: have the towers emit pulses of light at the same time they emit the audio signals.
Light moves about a million times faster than sound, so the mobile devices will see the flash of light almost instantly. The time between seeing the flash and hearing the sound provides a usable measurement of the time it took the audio signal to go from the tower to the mobile device, and all the mobile devices can take their range from a single tower pulse.
If you give each tower its own pulse pattern.. "AA", "II", and "MM" in morse code (.-.-, ...., ----).. the mobile units will be able to decide where each pulse comes from. Have the towers watch for each other's pulses and have them take turns so they don't interrupt each other, and you get a workable ranging system.
You can use IR LEDs to emit the light pulses, and if you do that you may as well use the standard 38kHz signal frequency. It would be nice to emit the audio waves at the same frequency, but that would be well into the ultrasonic range and you might have trouble finding microphones with good response at that frequency. A frequency of 22-25kHz would still be too high for people to hear, but close enough to the range where standard (cheap) electret microphones work to give you easy detection.
- jensa
- Posts: 191
- Joined: Wed Dec 21, 2011 9:35 pm
Re: Sensing position in space
Thanks for a great reply Mike!
I've tried GPS indoors before and it's not very reliable, but the audio/light combo could work really well. Thanks!
J
I've tried GPS indoors before and it's not very reliable, but the audio/light combo could work really well. Thanks!
J
Please be positive and constructive with your questions and comments.