Introduction: Cat Tracking Using Bluetooth Indoor Positioning

Picture of Cat Tracking Using Bluetooth Indoor Positioning

This Instructable teaches you how to build a system to track indoor positioning of cats. The purpose of this project is to get insight into pet positioning and see their interactions.

The system incorporates RSSI (Received Signal Strength Indicator) to estimate cat position. A bluetooth device is put on the cat, and other bluetooth devices are used as device scanners ("beacons"). These beacons scan the area for the Bluetooth device attached on the cat. The scanning process results in a RSSI for the discovered device. The stronger the RSSI, the closer the cat is to the beacon. In order for the localization to work, we collected "fingerprints" of the RSSIs to multiple beacons to be used as training data for a classifier to predict the location of the cat. After collecting fingerprint data, we ran the live system with the cats to collect test data. We used Machine Learning on the actual test data to predict the location of the cats using the fingerprint data.

The system is based on http://www.kptang.com/pubs/gsmlocalization-hotmob...

List of Materials

  • One or more cat to track.
  • An apartment or space for cats (preferably a natural environment the cats are comfortable in)
  • At least three Bluetooth-enabled devices to use as beacons. We used Android phones with an RSSI reporting app (explained in steps 3-5)
  • Any Bluetooth-enabled device to attach to the cat. We used Samsung Galaxy Gear.
  • Tape
  • A web server with a database (explained in step 1)
  • A visualization for the data (explained in step 9)

.

This instructable was made as part of the CS graduate course "Tangible Interactive Computing" at the University of Maryland, College Park taught by Professor Jon Froehlich. Please see http://cmsc838f-s14.wikispaces.com/ for more details. This project was done by Hitesh Maidasani and Sana Malik.

Step 1: Set Up a Web Server to Collect Data

The server should be able to accept and store data in a database. The code for the server is available at https://github.com/sana-malik/CatGear.

The server receives and stores training fingerprint data. The process for collecting the fingerprint data is explained in Steps 3-4.

The server also receives and stores the actual testing data once the whole system is live. This process is explained in Steps 5-7.

The server can be hosted on a local machine or on any cloud service such as Heroku. We used a node.js server hosted on Heroku in order to avoid running a local server for the entire experiment which was run for over 36 hours.

The database and tables should be setup. Attached is a dump of the PostgreSQL database with sample data (b012.dump). The dump also consists of the schemas of the tables.

Step 2: Attach the Three Beacons to Different Parts of the Space

Picture of Attach the Three Beacons to Different Parts of the Space

Tape the three Android phones to different parts of the space.

We taped one phone under a living room coffee table, the second to the table in the dining room, and the third to the dresser in the bedroom.

Ensure that the phones are connected to a stable power supply and that the phone sleep settings are turned off.

Step 3: Install Data Training App on Each Phone

Picture of Install Data Training App on Each Phone

The Android app for collecting training data is located here: https://github.com/sana-malik/CatGear/tree/master/...

The app has a text box for the ID for each test point location. When "Scan Devices" is pressed, the app scans the area for the two Galaxy Gears. Once they are found, the app sends the RSSI values for each Gear to the web server along with the location entered in the text box and the current phone's MAC address which is used to identify each phone. If the Gear is not found, the app reports a zero value.

Note: Do not pair the Gear with the phone. The app simply scans the area for all Bluetooth-enabled devices.

Step 4: Collect Fingerprinting or Training Data

Picture of Collect Fingerprinting or Training Data

This step is the most time consuming step.

We chose 15 spots in the apartment to track: table, litter, scratch post, hallway, dresser, couch, counter, desk, lvngrm corner, kitchen window, balcony, door, bed, bed window, food.

We placed both Gears at each location and ran the fingerprinting app on each of the three phones with the appropriate label from the above list. The app scanned for both Gears and reported the RSSI of both Gears (labeled with a gear id) to the server with the location. We ran the app 7 times at each location for reliability.

Example:

Place the two Gears at the desk. Now run the app on the first phone with the label "desk" seven times. Next run the app on the second and third phone with the same label 7 times each.

Now, the database table for the fingerprinting data should have 21 rows with location "desk. Of these 21 rows, 7 are for one MAC address, 7 for a second MAC address, and another 7 for the third MAC address. There should be some post-processing done to join these 3 sets of 7 rows to just one set that has the three RSSI from the three devices on one row.

After doing this for all 15 locations, the table should have 315 rows. After doing the post-processing and joining, the table should have 105 rows.

Step 5: Install the Data Logging or Testing App on the Android Phones

Picture of Install the Data Logging or Testing App on the Android Phones

Once the fingerprinting data has been collected, the actual test data can be collected to observe the behavior of the cats. Now install the data logging app on the phones. Our app can be found here: https://github.com/sana-malik/CatGear/tree/master/...

The app scans for the Gears. The Gears can be at any location within the area. Once the app has discovered the Gears, it reports the RSSI from of both Gears (with a gear id) and the phone MAC address. This app scans every 12-15 seconds and reports the RSSI's to the server. So, there are 3 of these apps running simultaneously and reporting to the server.

We do some post processing again on this data to join the three RSSI reading of the same gear and average the readings over a minute time frame.

Step 6: Attach the Galaxy Gears on the Cats

Picture of Attach the Galaxy Gears on the Cats

Attach each Galaxy Gear on each cat. This may need some modification to the strap of the watch since each cat's neck has a different size. We used string to elongate the size of the strap. Ensure that the watch is not making the cat uncomfortable since this is an experiment and the device should not modify the cat's usual behavior. Also, ensure that the Gear should not be easily removed by the cat.

Note: These cats were not harmed or distressed by wearing this collar.

Step 7: Let the System Run for Several Hours

Picture of Let the System Run for Several Hours

We ran the system for about 44 hours.

While doing this, it is a good idea to keep track of some sort of manual log for some location points that the cats are at. This can help test the accuracy of the location classifier used in the next step.

Step 8: Run Location Classifier

We used a K-Nearest Neighbors classifier to predict the locations of each test point. A test point consists of 3 RSSI readings from each phone for a particular Galaxy Gear. Using this test point and the training fingerprinting data, we run the KNN classifier with N=3 to obtain the predicted location.

The classification code is located at https://github.com/sana-malik/CatGear/blob/master/....

Step 9: Visualize Data

Picture of Visualize Data

Using the predicted locations during the 44 hour period, we visualize the data using a heat map and a time flow location map.

The visualization code is available at https://github.com/sana-malik/CatGear/tree/master/...

Comments

DummyD (author)2017-10-01

sorry for this stupid question of mine but im hoping someone will answer this...can i use ble (BLUETOOTH LOW ENERGY) as beacons and track android phones instead?? thanks in advance for the one who will answer this

Ala'aR (author)2015-12-28

LOVED IT

roshan_gop (author)2015-05-08

Which version of Android are used ? Please reply ASAP

Navi NathaneC (author)roshan_gop2015-11-16

ASAP.

(Protip: demanding quick answers is one of the main reasons why questions dont get answered.)

samuel.vdv (author)2015-04-28

Hey cool project.

I'm wondering what's the accuracy you are getting?

Check out this arduino shield called pozyx for indoor positioning with an accuracy of 10cm. You can use it for tracking, or in your case, you can use it to quickly build a RSSI database without manually having to measure all the points. By just walking around and measuring the RSSI with a BLE shield and the position with the pozyx shield you have a database in no time! Check it out: www.pozyx.io

bjf5051 (author)2015-03-04

can you use anything that transmits Bluetooth to stand in for the watch? Does this work for multiple floors?

Fwank49 (author)2015-02-24

Is there a pre-compiled apk for the rssi reporter?

ch.quin (author)2015-02-04

Can i have the procedure and method to teach me how to make it? i need it for my fyp. need it asap!thx so much

papablecamz (author)2015-02-01

what android version did you use ? reply asap.

OsamaA (author)2014-10-14

Hi, I do really appreciate it if you can explain the fingerprint process, and also how can be connecting to database

DJCoopes (author)2014-08-18

There are 11 'apps' at the website...
not sure which one.

yaba (author)2014-05-17

Awesome project. Will build it as soon as I can convince my girlfriend to have a cat :)

Fr0stByte (author)yaba2014-05-20

or sneakily put on the girlfriend ;)

yaba (author)Fr0stByte2014-05-20

LOL :) NSA is doing that for all of us, no need to buy gadgets :)

yaba (author)Fr0stByte2014-05-20

LOL :) NSA is doing that for all of us, no need to buy gadgets :)

agis68 (author)2014-05-20

very neat!!!! what is the cover range of a bluetooth device or it varies

hmaidasani (author)agis682014-05-20

The phones we used could scan devices that were 10-15 feet away. I assume it does vary from device to device.

agis68 (author)hmaidasani2014-05-20

thanx. I ask cause i have 2 cats and they hidding in my house which is quite big.....and sometimes (hardly if they are hungry) i seek all house places and its annoing.

hmaidasani (author)agis682014-05-20

Yeah, you can definitely make this a real time application that tells you where your cats are.

Trillistar (author)2014-05-20

neat idea, would make it much easier to find the collar when my cat takes it off:)

DJCoopes (author)2014-05-18

Can't find the app.

hmaidasani (author)DJCoopes2014-05-19

Which app are you referring to? Did you not find it here: https://github.com/sana-malik/CatGear?

Wolfbane221 (author)2014-05-15

Cool data! Why not do this on yourself to see where you spend the most time while your at the apartment or house?

hmaidasani (author)Wolfbane2212014-05-16

Something worth trying in the future.

Techtopoly (author)2014-05-16

Really neat concept! Typo correction, I believe you meant to say "These cats were" ... not ... "harmed or distressed by wearing this collar."

hmaidasani (author)Techtopoly2014-05-16

Fixed. Thanks.

About This Instructable

71,687views

230favorites

License:

More by hmaidasani:Cat Tracking using Bluetooth Indoor Positioning
Add instructable to: