Instructable: http://www.instructables.com/id/EHC35QJHV4DBLNA/
Github: https://github.com/sana-malik/CatGear

Cat Gear is an indoor positioning system for cats using Samsung Galaxy Gears. We used a method called "fingerprinting" with 3 Android phones as beacons, described in [1].

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
  • Any Bluetooth-enabled device to attach to the cat. We used Samsung Galaxy Gear.
  • Tape
  • A web server with a database
  • A visualization for the data

Steps (which are all described in detail in the Instructable):

1. Set up a web server to collect data
The server receives and stores the 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.
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. For training, we sent the Gear Id, the Android phone Id, the RSSI value, and a tagged location.

2. Attach the three beacons to different parts of the space
  1. DSC_8262edit-1000px.jpgDSC_8266edit-1000px.jpg
    DSC_8273edit-1000px.jpg
    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.

3. Install data training app on each phone
external image FYTLNPIHV851GQP.MEDIUM.jpg

  • 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. We did not pair the Gears with the phones for this -- having them in scan mode was enough.

4, Collect fingerprinting or training data
external image FXTIP69HV851G8D.MEDIUM.jpg
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.

5. Install the data logging or testing app on the Android phones
external image FG08I5ZHV851GUC.MEDIUM.jpg
We then ran the data logging app. 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.

6. Attach the Galaxy Gears on the cats
external image FD7LL4RHV851G94.MEDIUM.jpg
external image FU0U3AGHV851G8U.MEDIUM.jpg
We then attached each Galaxy Gear on each cat. We used string to elongate the size of the strap to make sure the straps were comfortable and not too tight.

7. Let the system run for several hours
external image F0K6RIJHV851G96.MEDIUM.jpg
external image FEK39X2HV851G8N.MEDIUM.jpg
We ran the system for about 44 hours.

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.

9. Visualize and analyze data

Analysis and Insights:

The visualization shows that the cats move around quite a bit. Our ground truth logging (manually written while collecting data) indicates that the bluetooth indoor positioning gives very good room-level accuracy (correct almost always), but exact location (e.g., on the desk versus the window sill in the bedroom) is a bit noisy. Thus, the visualization may show the cats jumping around in the room a bit when they are actually stay still.



Orange Kitten's position throughout the apartment. She seems to stay mostly in the bedroom, and doesn't go much anywhere else. She is a sedentary cat.
Orange Kitten's position throughout the apartment. She seems to stay mostly in the bedroom, and doesn't go much anywhere else. She is a sedentary cat.

Grey Kitten is much more active than Orange Kitten -- she explores the entire apartment and spends pretty much equal time in all the rooms.
Grey Kitten is much more active than Orange Kitten -- she explores the entire apartment and spends pretty much equal time in all the rooms.






















The heat maps confirm the behavior that is typical of each of the cats -- Orange Kitten is more sedentary and spends most of her time in the bedroom, whereas Grey Kitten splits her time between all the rooms in the apartment.

The cats were in the same location 14.2% of the time while we were home.
The cats were in the same location 14.2% of the time while we were home.

At times when we were not home, they were at the same location 26.5% of the time.
At times when we were not home, they were at the same location 26.5% of the time.






















A motivating questions was knowing how the cats interact when no one is home. Typically, when someone is home, Grey Kitten will be in the same room as the person and Orange Kitten will be elsewhere. Since both cats are fairly social (but hardly with each other), we wondered if they would seek each other's company as a last resort when no one else was around. It turned out they were around each other more when no one was home, but this may have just been because it was around their nap time when the data was collected while no one was home.


References:
[1] http://www.kptang.com/pubs/gsmlocalization-hotmobile06.pdf
[2] http://inburst.io/bluetooth-rssi-to-actual-distance/