Up-to-date spatial data of indoor environments are needed in an increasing number of applications.
Optimized routing and navigation in large public buildings is one of the most needed application these days.
Lack of availability of GPS signals inside buildings makes indoor mapping and navigation a challenging issue.
InDoor Tracker is our solution for this problem
We planned an indoor mapping gps app that synchronize the phone location up to a 10 cm accuracy.
Finally we design an indoor tracker app using 2 Texas Instruments CC1350 launcpad boards over BLE protocol.
The app show you your track inside building for a 5 cm (!!) accuracy.
The InDoor Tracker is a complete indoor mapping solution that includes an android app that connect to 2 TI CC1350 .
First the app looking for the 2 boards connection under bluetooth protocol, using BLE.
The board identify the phone and start transmit sound signals while the phone record these signals.
Using triangulation we can measure the location of the phone according to the 2 launchpad CC1350 boards.
2 X CC1350 Launchpad Boards running ti-rtos .
Phone running Android
2 X K50 - 8 ohm Speaker
On the board we added API to the speaker, using that api we builded the board side bluetooth protocol implementation.
The board wait for the phone to recognize it, After the phone recognize each board using bluetooth protocol the board using the speaker API we build to send sound signals .
the signals are being converted to a HD '.wav' file.
We built Digital Signals Processing software using python that can analyze the WAV file to track the phone inside the space our boards cover using triangulation.
Android App Dependencies:
A little bit of physics… Speed of sound is 343 m/s. As farther we get from the board, the longer it takes for the sound to reach us.
Assuming the board transmits the same pattern over and over again in a cyclic way, and we are able to identify the beginning of that exact pattern each time, we'll get a series of time indexes with a constant difference between each other.
But what happens if we move? Let's say we change location (getting away from the board) right after one pattern ends and before the next one begins. The time difference will no longer be constant:
d – Distance between locations
Delta t = Constant + d/343
More interesting for us:
d = 343*(Delta t – Constant)
And now we have a way to calculate the distance!
In order to make it possible, we made the board transmit a pattern made of two short signals with a different frequency and then stop for the same time.
The first part of the algorithm is to identify the points when the frequency changes from one to another (in the middle of each signal).
To do so, we used Band-pass filter on the signal data (green one is the original).
After a lot of experiments we realized these points are not always where we expect them to be. But in order to find our location, theoretically it enough to have one accurate point from the entire samples made as we stood still.
So now all we need to do is to eliminate inaccurate points. Considering that we know the time difference supposed to be between 2 adjacent points we can get rid of points that doesn’t apply, that worked Wonders!
We can stay at one place for a few seconds and get several accurate points.
Due to our significant use of comparisons we need to calibrate the system. Therefore our first location will always be right next to the board, distance 0, and only after that we can start move around the place.
From all the points we get while our distance is 0, we need to choose one, this one will use us to calculate distance for all other points.
We took the one that had the lowest value according to this formula:
val = (abs(Pi+1-Pi)-Constant)^2 + (abs(Pi-Pi-1)-Constant)^2
Let's call this point P0. The distance d of Pi from the board is:
d = 343*(Pi – (P0 + Constant*i))
We are almost done!
For each location we get a number of points, for each point we calculate the distance, we get an array of distances.
Not all distances were accurate so we tried to take the average,and yet, not good enough. The median of the array was much better.
Let's recall the object of the project – Identify locations in 2D space.
In each location we calculate distance from both boards and we intersect the two circles created from the boards' location and radius (distance) and that's it, we finally know where we are!
We had some challenges during the work on our project :
Working with sound waves:
None of us had any experience with electricity or waves, the first thing we did when we started the project was to study about sound waves, amplitude and frequencies.
Working with the board:
In order to make sound we wanted to work with time units, but instead we worked the board ticks
Lack of documentation
Ble multiple connection
Can hold only one connection at each moment
At first we wanted our system to work with frequencies no one can hear, apperantly the equipment (speakers) is very expansive
Analayizing the sound signals is very tricky when there is noise
Took us a lot of time to calibrate the system and get good results
In order to estimate the distance we tried using the amplitude, theoretically the farther you go the amplitude supposed to be smaller. In practice, it wasn't this way, probably cause of the environment we tested it in.
In order to find key points in our pattern we tried to we tried to use correlation accordind to the formula:
(arr[t]*SUM(sin((2*pi*f*t)/rate))^2 + (arr[t]*SUM(sin((2*pi*f*t)/rate))^2
It may work now considering we changed the band-pass filter, but it didn't work at first
Why did we choose to solve it in this specific way?
The first strategy come to mind is obviously syncing clocks and compare time instead of measuring differences.
Actually it's not that simple, we tried doing that at first, but it was very challenging, easier to use repeated pattern, same outcome :)