[HN Gopher] Localize your cat at home with BLE beacon, ESP32s, a... ___________________________________________________________________ Localize your cat at home with BLE beacon, ESP32s, and Machine Learning Author : lormayna Score : 187 points Date : 2021-02-04 09:39 UTC (13 hours ago) (HTM) web link (github.com) (TXT) w3m dump (github.com) | ksm1717 wrote: | Part of me was expecting that "cat" was a technology term I | didn't know | adolph wrote: | No, just the normal utility that first "appeared in Version 1 | AT&T UNIX." It uses Bing by default but you can specify a | translation service in your cat.conf. Use like this: | | $ cat -L "en/us" /tmp/french-file.txt | universa1 wrote: | See also [1], a research collaboration that did this basically 12 | years ago... Iirc they also had a project where they tracked cats | across a town... But most of their "experiments" were just | tracking interactions between pupils and not so much the location | tracking... Though I remember the original hardware (was open | sourced) had this as well. | | [1] http://www.sociopatterns.org/ | PeterStuer wrote: | At least over here all cats have an RFID implant injected after | their first vet visit. I'd try to work with that instead of | putting a BLE on the cat. Your localization target ("Cat is in | kitchen" etc.) is coarse grained enough to make it work with | RBP's. | bo0tzz wrote: | As far as I know, the usual range on those implants is no more | than ~30 cm, so I expect you might need a pretty powerful | transmitter to find them across a room. | rtkwe wrote: | That's less a hard number and more a limit of how much power | you're directing at it (with limits due to the inefficiency | of RF energy transmission mostly) and how sensitive your | receiver is. The passport RFID tags have been read from over | 200 feet away for example. (this number is from years ago | too) | | https://www.darkreading.com/vulnerabilities--- | threats/resear... | faeyanpiraat wrote: | You might be able to monitor chokepoints with a low RF | pollution, like the small square opening at the main | entrance/exit of the house. | | This way you can tell when your Cat has left the building | without getting cancer. | reaperducer wrote: | I like this project a lot. It makes me wonder if I put one of | those Apple AirTags on her for the HomePods to sense, if I can | then say, "Hey, Siri, where is the cat?" | | It would be nice to get a response like, "She's in the litter | box" so I know to use a different bathroom to wash my hands. | JoeAltmaier wrote: | Confused: how do you train the model? Don't you need an | independent source of 'cat location' data? | snvzz wrote: | Or you could just shake the cat food envelope. | Razengan wrote: | That's for cat summoning, not locating | mmastrac wrote: | In fairness, it will localize the cat to a 1m radius circle | around your feet within 10 seconds. | Razengan wrote: | That's a cat relocator then, to be precise. | rsmets wrote: | With a few other other elements (i.e. weather) added to learning | model I bet this would be super accurate! Pretty neat. I love | finding use at home DIY use cases with commodity hardware, ESP32s | ftw. | ajb wrote: | Interesting. I was hoping for someone to do this with LoRa, which | would allow you to find your cat in a bigger area. | hombre_fatal wrote: | PSA: Make sure to get collars for your cats that either detach | under load or, perhaps best, have an elastic segment that lets | them slip it off if it catches. | | A couple months ago my friend found his cat dead after her collar | caught while jumping over the fence. Poor little baby beast. :/ I | look at my fun-loving critter basking in the sun as I write this | and it breaks my heart to imagine her suffering like my friend's | poor cat did. | | Example of a collar with elastic segment: | https://amazon.com/dp/B07P8V374M | intricatedetail wrote: | Once on my way from work I saw a cat jumping and catching its | collar in the fence and choking. Fortunately I got there quick | and released the poor thing. | adfm wrote: | We've gone through a lot of collars with our cat and he seems | to tolerate the neoprene and velcro type the most. The brand | I'm familiar with is Beastie Bands. They're more secure than I | imagined and fit loosely without snagging or easily pulling | off. Additionally, it seems to generate less matting, which is | a plus. | godelski wrote: | PSA: Keep your cats inside. They will live longer, healthier, | and so will the birds. | | And if they are indoor make sure they have areas to run around, | be sure to play with them (they are a pet! They are your | responsibility!), and watch their diet (often people let them | get too fat and it takes awhile for cats to lose weight). | HeyLaughingBoy wrote: | One of our dogs disappeared for two days. Then on my way home I | got a frantic call from my wife that he had come home but his | leg was in a bear trap. | | Turned out to be a coyote trap and there was a plastic link on | the chain that attached it to the tree or whatever, that he had | chewed through then limped home on three legs. If not for that | link, he'd probably have died out there since the person who | set it was clearly not checking it every 24 hours as required | by law. | | Luckily he was big enough that the trap couldn't close tightly | enough to damage his leg and he was running around fine by the | next day. | jmkb wrote: | My cat will remove them within 20 minutes, never to be found. | I've reluctantly settled on the non-safety collar after losing | a half dozen. Although if I equipped one with RFID I could at | least have a shot at locating his stash! | godelski wrote: | My cat used to do the same. But then I found out that she | likes the color red (or orange). Once I switched to that | collar it would only come off every few days and seemed more | like an accident. She also likes the bell and when she first | got it would proudly walk in a way that made a lot of noise. | | So idk if this helps, but maybe try different colors and | configurations and find what your cat likes. Also tightness | has a lot to do with it. | danesparza wrote: | What about a harness design? | jmkb wrote: | I think that would be even more likely to snag on | something. | | edit -- but of course danging by something other than a | neck might be preferable... | avidiax wrote: | Maybe replace the elastic section with a loop of fishing line | that's rated at 1/4th the cat's weight (loop having 2x the | rated strength). Too strong for the cat to remove, but will | snap under their own weight. | | Or the cat might be OK with the breakaway collar now, due to | "learned helplessness". | monadic3 wrote: | The term for this is "break-away collar" if that helps. | dkersten wrote: | I've also seen them referred to as "safety collars". | birksherty wrote: | What is the need for collar in animals? To enslave them without | their wish, for our needs or their? Do they want them? May be | change your location, if can't let them roam freely, not fit | for having a pet. Don't make slaves. | sgt wrote: | Do they still sell rigid collars? | onli wrote: | Yes. And that's not all that bad if you use them to go for a | walk with the cat, like with a dog on a leash (but then a | harness is better). But it's a real problem if the cat is | alone. The veterinarian looked so damn sad when talking about | how important those breakaway collars are... | godelski wrote: | If you're walking them get a harness (same for a dog). | Don't pull on the neck, pull on the body. This is not only | better for them but you'll have more control. | mft_ wrote: | One of our cats removes hers within minutes. She purrs when you | put it back on - I think she sees it as a game. :) | aidenn0 wrote: | From what I can tell at least 90% of cats see annoying humans | as a game. | tamaharbor wrote: | A 'cat scan'? | pacaro wrote: | There used to be (~20years ago) a catscan website where people | posted images of their cats as taken with flatbed scanners | (when those were a thing). It wasn't uncontroversial. | | One of my favorites was a color scan taken in multiple passes | with filters. The cat was not stationary through the whole | process | kaybe wrote: | I managed to find some, hiding behind CAT scans and quantum | cat/dog scanners (wtf): | | https://thecatscan.tumblr.com/ | | http://www.cat-scan.com/cat-scan/ (put up your sunglasses..) | mzkply wrote: | I bet you Airtags will be put on every cat and dog since it's | likely they'll be picked up by everyone's iPhones, not just the | owner's. | paulie_a wrote: | Very cool and I know what I am building this weekend | akiselev wrote: | An off the shelf solution: https://www.tabcat.com/ | | Works well for some outdoor critters | sli wrote: | This is interesting. I've been considering a similar project | using computer vision, but I think I'd prefer to just set this up | instead. | colechristensen wrote: | This beats my method of cat locating, which usually takes the | form of increasingly urgent searching followed by noticing my | target following me around wondering what I'm up to. | kuu wrote: | Very cool project! :D | kimburgess wrote: | If you make the bump to Bluetooth 5.1+ RTLS like this get even | more interesting as you can measure not only signal strength, but | angle of arrival too. Nordic Semiconductor have some beautiful | development kits [1] for this if you want to play. Cisco also | have quite a nice write-up [2] on other approaches to location | resolution from WiFi and BLE. | | It's worth acknowledging that setups like this exist in most | workplaces, shopping centres, stadiums and other public spaces in | many developed countries. 'Free wifi' is not there for your | benefit. There are useful experiences enabled by this which may | make your life simpler in some contexts, but also worth being | cognisant of how common this is. If the benefit provided to you | does not balance the privacy loss, you may be interested in | https://account.meraki.com/optout and https://optout.smart- | places.org/ (you may need to pop a few addresses in here if you | use private addresses on iOS). | | [1]: https://www.nordicsemi.com/Products/Low-power-short-range- | wi... | | [2]: | https://www.cisco.com/c/en/us/td/docs/solutions/Enterprise/M... | pjc50 wrote: | If somebody manages to build a reasonable-precision (tens of cm?) | indoor location system with decent user experience (ie reasonably | easy to set up, reliable, cheap, and stable), they have a massive | hit on their hands. Never mind the cat, never lose a key or a | remote ever again. Or your pills. Hugely valuable for the | elderly. | MaheshC wrote: | Are you aware of what a chipolo is? | Cthulhu_ wrote: | There's commercial products for locating cats outside; probably | GPS and either a mobile chip to pass the data or LoRa. $75 or so, | but I'm sure they come with subscription costs as well because | monies. | | There's a cat in our neighbourhood with one of those, it's funny | to walk out there in the middle of the night (we violate curfew | and walk the dog close to midnight) and see a cat with a collar | with some blinking lights staring at us from the bushes. | | Kinda wish one of our cats had one of those when he went missing, | but it's likely he would've lost the collar at some point anyway | (he looked like he squeezed himself through a tiny hole and | couldn't get out again until he lost a ton of weight two+ weeks | later when he came back) | xkcd-sucks wrote: | Have you actually seen a commercial LoRa small animal tracker? | Most asset/animal trackers I've seen are a bit chunky to go on | a cat collar so I'm working on one with a better form factor. | | But my cat really doesn't like collars, so the real utility | seems to be in locating where he managed to remove it... | Razengan wrote: | > _we violate curfew_ | | Why? | djrogers wrote: | Perhaps because COVID is not more prevalent at night? Or | maybe GP feels that walking ones dog at 11:45pm is safer than | walking it when more people are outside? Or perhaps they are | sociopathic maniacs who look for nonsensical regulations they | can violate with impunity. | | Who cares why, and what business is it of yours? | kelnos wrote: | Agreed, and that also raises the question of why the | original poster chose to include the bit about breaking | curfew in the first place. The comments stands up just fine | without it, it's not important to the story they were | telling, and all it's done is created an irrelevant, | pointless subthread. And I am a part of the problem for | contributing to it. | renewiltord wrote: | Classic swallowing of bait haha. Surely you could have | guessed why. | flyingfences wrote: | > Why? | | Why not? Curfews are ridiculous, authoritarian measures taken | to curb "improper" activities not associated with walking a | dog. | jfk13 wrote: | Alternative point of view: they are a mitigation for the | fact that many people cannot be trusted to behave sensibly | (in terms of protecting society at large from this | pandemic) if large numbers of people are out and about at | night, and it is not feasible to check each individual's | activities to assess whether they're "improper". | ptudan wrote: | Without anymore context, I'll assume that he's referring to a | logic lacking covid curfew in the US. Those might make sense | for dense downtown districts with bars, but almost nowhere | else | astura wrote: | I shake the treats to geolocate my cat. | aidenn0 wrote: | Mostly OT, but this article made me ponder it: | | I know that people have done various forms of radar with wifi | signals; I wonder if I could have a few sensors throughout the | house and use ML to determine if various doors are open or | closed. | idlewords wrote: | Remember that the more precisely you track your cat's location, | the less you will know about its momentum (although since it's a | cat, you can assume it is zero for most of the day). | Whitespace wrote: | I don't need Machine Learning to tell me that my cat is sleeping. | 95% accuracy rate with zero training! | hyperman1 wrote: | They only disappear if you need to find them. | | Case in point: The vet. Our cat somehow knows from our | behaviour that the visit is today, and disappears off the face | off the earth. We had to cancel a visit because we spent more | than two hours searching and were late. | | So new appointment a day or 2 later, and we watch every step of | the beastie like hawks. She disappears behind a cabinet, does | not come out, and can be found neither behind or inside. Huh? | It turns out the back of the cabinet is open, and there is a | really tiny space between drawer and back. If I open a drawer, | she goes up/down a layer. | | I knew all the time she was less than 50cm from me, and it | still took me 15 minutes to figure this out. I've been thinking | about creating a tracker, but then , the cat healed enough to | lower the frequency of vet visits. | godelski wrote: | The trick I've found is that when they go in a dumb hiding | place act as if it is super hidden and amazing. If you really | don't need them then just let them hide and pretend to search | for them (never make eye contact but make sure you look like | you've looked in the area). It will become their favorite | hiding spot quickly and then you get to decide how to use it. | m463 wrote: | You could probably get the other 5% if you have a specific time | you set out food. | | catnip might introduce jitter. | RealStickman_ wrote: | Yes, but where? Mine rotates that spot on a weekly basis. | dkersten wrote: | Mine tend to stick to the same four or five spots. Those | spots do change, but rather infrequently. | k__ wrote: | My changes their spots depending on temperature. | | From warm to cold: | | Hall floor | | Livingroom floor | | Hall box | | Livingroom box | | Livingroom couch | | Bedroom bed | | Bedroom bed under the sheets | detaro wrote: | so you only need a thermometer and machine learning to | solve the task? ;) | godelski wrote: | I just need 1 heated blanket. | adolph wrote: | And it is always local. I18n the cat would be something to see. | Jon_Lowtek wrote: | oh come on, you had more then zero training on that model. | simiones wrote: | Will this solution work if my cat has become non-local by having | it's state become entangled with some wave-packet? | holman wrote: | If you're using Home Assistant, Room Assistant is a lovely | project to repurpose Raspberry Pis to handle BLE tracking as | well: | | https://www.room-assistant.io | skeletonjelly wrote: | Side note: that is some really elegant documentation | teddyh wrote: | I don't want to localize my cat. I prefer subtitles. | arethuza wrote: | I actually have a MeowTalk cat translator app installed on my | phone... | | Have never had a chance to try it as, of course, our cat | refuses to say anything if a phone is pointed at him :-| | w0mbat wrote: | I localized my cat to Japanese and now he says "nyan" instead | of "meow". | cjdell wrote: | An unfinished project on mine is to try to track my cat outside | using an ESP32 LoRa module attached to his collar. | | The idea is to periodically send a list of WiFi SSIDs along with | RSSI's so I can triangulate the cat's location using the signal | strengths of each network. Similar to how the first iPhone would | find your location without needing GPS. | flak48 wrote: | You might find Gene Bransfield's War Kitteh project | enlightening: https://www.youtube.com/watch?v=DMNSvHswljM | [deleted] | ryanschneider wrote: | I'm pretty sure this is the first time I've seen the word | "localize" used to refer to spatial location and not | cultural/linguistic locale. Totally makes sense but definitely | threw me off when first reading the headline. :) | Lvl999Noob wrote: | I was thinking that it would localize cat (unix command) | somehow. | isbvhodnvemrwvn wrote: | In Polish locating something is "lokalizowanie", I guess that's | why the word "localize" was used. | leetcrew wrote: | not technically wrong, but "locate" would be more idiomatic | here. I don't think english is the author's first language. | puzzlingcaptcha wrote: | It's a calque from Polish, where "to locate" is "lokalizowac" | gota wrote: | I think all Latin languages as well. From "locus" meaning | place. | mattkrause wrote: | There also shades of different meanings. | | 'Locate' implies that you're predominately interested in the | object being sought but 'localize' suggests you're more | interested in the place where it is/was. I think localize can | also be less-than-exact if it rules out some plausible | locations, but it seems odd to partially 'locate' something. | | It's used a lot in neurology/neuroscience for the process of | identifying where (e.g.) a tumor is or the brain structures | on which a particular behavior or process depend. | theschwa wrote: | Localization is actually the common term, frequently used in | robotics and autonomous vehicles. There's a really | interesting field of research here [0]. | | [0] - https://en.wikipedia.org/wiki/Simultaneous_localization | _and_... | mhh__ wrote: | It might be _a_ common term but I don 't think it's _the_ | common term here. | theschwa wrote: | I totally hear that. Especially if people are commenting | that they were thrown off. I just wanted to make sure | people knew to use this term if you're looking to learn | more about the topic of this project. If anyone is | looking to implement this or another method to do indoor | mapping, you'll probably want to familiarize yourself | with the research field of Simultaneous Localization and | Mapping or SLAM. | mikepurvis wrote: | I work at a robotics company, so we've had a perception | team that manages robot localization since forever, and | now that we're _also_ internationalizing our product, | there 's a separate frontend team dealing with third- | party localization firms to create the needed | translations. :) | singlow wrote: | Yeah, _localize_ has always meant to adapt something to | its location, when I've seen it used. _Locate_ means to | determine the location. | | Edit to add: But I can see how in a specialized field, | where methods for locating an object are frequently | discussed, using localization over location would be | useful for describing the process of finding something, | since location is also a noun referring to the place | itself. | mikepurvis wrote: | Well and in the specific context of SLAM, the business of | localizing is itself an adaptive and constructive | process. "Locating" is what the user does when they | simply tell the robot where it is on the map. | _Localization_ is building a continuous graph of your | immediate surroundings and past movement history and | fitting that to what is known about the environment. | w0mbat wrote: | I'm pretty sure it's actually wrong usage, and should be | replaced with "Locate" in this context. | | "Localize" has various meanings, but in a physical location | sense is to _restrict_ something to a particular area, e.g. | "We successfully localized the fire to the Johnson farm so no | other farms were damaged.". | | I can't see a definition that is equivalent to "locate" or | "find". | didymospl wrote: | I don't know what's idiomatic here as English is not my | first language, but according to my dictionary "localize" | can also mean "to find the position of something" | | https://dictionary.cambridge.org/dictionary/english/localiz | e | | Maybe it's British vs American English? | w0mbat wrote: | I looked at Merriam-Webster online, the snippet Google | pulls from the OED and the Mac dictionary app which uses | the New American Oxford. | | "Locate" would lead to less confusion among readers. It | unanimously has the right definition, and is a simpler | word. | MauranKilom wrote: | I think one of the reasons that one is not used because | usages like "Simultaneous Location And Mapping" (instead | of the "Simultaneous Localization And Mapping" that SLAM | stands for) would read a bit strange... "location" is | more commonly used to mean "the place" and not "the act | of finding the place". | mywittyname wrote: | A better title would be either: | | Locate your cat at home using... | | Or | | Domestic Feline location using... | | Depending on the level of techno-mumbo-jumbo the author is | looking for. | wpearse wrote: | Aircraft guidance systems have localizers, too. | | It's not wrong, and I would encourage the author to leave it as | it is. | danaliv wrote: | ...which, funnily enough, don't tell you where you are. :) | roel_v wrote: | So I don't know much about ML; how much better would one expect | ML (which I take in this context for 'deep neural network'?) | approaches to be compared to a multinomial logistic regression, | for applications like this? Is logistic regression old school | and/or outdated now? | martin_a wrote: | I think ML is completely unnecessary here. In the end it's | triangulation of a signal. No need for ML after all. | | Looks like a classic case of the famous Jurissac Park quote: | "Your scientists were so preoccupied with whether or not they | could, they didn't stop to think if they should." | fock wrote: | iirc BLE is not that exact and you'd also have to | model/measure your sensor position. I think creating a | primitive statistical model for looking up the location seems | sensible but the ML aspect is definitely a little bit | overrated, but I think this thing was never meant to | clickbait (it's means to an end available for ~40years now). | eeZah7Ux wrote: | The pattern emerging from RF reflection across rooms is not | completely obvious. | | "ML" is just a very overstated word for: "I have a handful of | example data and a library that does basic math things" | djrogers wrote: | > In the end it's triangulation of a signal. No need for ML | after all. | | Triangulation works accurately in open space, however this | use case is inside a home with signals being blocked, | bouncing, or attenuated by walls, mirrors, appliances, etc. | On top of that, the goal is to use as few BLE rx'ers as | possible (meaning not one per room). Given those constraints, | a trained ML model actually does make sense. | srean wrote: | There are no convincing reasons to consider logistic regression | to be outside of ML. ML isnt just deep learning. To me its a | collection of mathematical tools that help in designing | predictors. This involves stats, optimization, algorithms, | stochastic processes, information theory. | | The main difference between stats and ml is (i) community, (ii) | stress on the details of compute and the focus on prediction | accuracy rather than accurate recovery of parameters. A scheme | that ensures good prediction even if the parameter is not | recovered, for ML that's still a success. | nix0n wrote: | This is a cool project. | | But my first thought was: Input: "meow" Output: "miau" | laurent92 wrote: | I was looking at GPS localisers for walking dogs in the forest, | but it's 10-200$ + ~$7 a month. | | So I'm wondering whether a timer that inflates a big red | balloon after 4hrs wouldn't be the best choice. | eeZah7Ux wrote: | ...to safely fly the dog back home. | elisaado wrote: | why don't you use a drone? | TrueGeek wrote: | I've been using a GPS collar for a my escape artist dog for a | few years. Do you have a link to your big red balloon | Kickstarter page? | [deleted] | MisterTea wrote: | Far simpler cat location method: Shake a box of dried cat food | around and then pick the cat which is yours. | mattanamg wrote: | "What a lack of privacy" says the cat | ljhsiung wrote: | -- "now let me sit in my owner's pants as he sits on the | toilet" | reaperducer wrote: | "Have you seen my butthole? Look at my butthole! Let me turn | around so you can get a better view of my butthole!" -- Every | cat ever. | EGreg wrote: | And proceeds to lick its genitals in front of you | 1_2__4 wrote: | So I have some experience with this. I decided to add BLE beacons | to my vehicles and bicycles, and an RPI to listen for the pings | and retransmit them over mqtt. The idea was I could setup some | Home Assistant alerts for things like "multiple vehicles are | absent at once" or "vehicle went from home to away at odd hour" | where "odd hour" is something like 12AM-5AM, a time when I | wouldn't expect me or my vehicles to be departing. | | The way I implemented it was to have each beacon transmit on I | think 1s (might have been 5s to save power) intervals, and some | python code on an RPI that listens for them, with a timeout for | each. If the listener gets a ping it immediately forwards it to | mqtt as a "home" ping, using the beacon id to set the topic. If | it doesn't get a ping within the timeout then the rpi generates | and sends an "away" mqtt message for that beacon. My expectation | was to have it alert me within ~2-3 minutes of a vehicle going | from "home" to "away". In practice: | | - BLE beacons aren't very popular really, most of them are made | by small foreign companies who don't sell them in places like | Amazon. The ones Amazon does sell are kind of crappy. Setting | them up usually involves downloading a vaguely-sketchy app to | your phone (I haven't figured out how to configure them from the | rpi). They all seem kind of janky honestly. | | - Bluetooth and Wifi use the same (some) hardware on an rpi, | meaning if you start rapidly scanning for BLE tokens your wifi | performance will drop to the point of the rpi being unusable (ssh | sessions timing out). I fixed this by buying a separate USB | bluetooth dongle, although even that was a pain to get working in | the pybluez module - in general bluetooth under linux along with | the python bindings are finicky and crap out easily, it seems. | | - I have my dmesg and syslog spammed with "Bluetooth: hci0: | advertising data len corrected" when using bluetooth scanning, I | managed to find a couple bug references to it and other people | complaining about it but no fixes over multiple system updates. | | - It's just... Not reliable. I don't know why. I've tried really | hard to make it reliable, and maybe the problem is the RPI-as- | bluetooth (maybe if I used a microcontroller as the receiver it | would work better?), but I've tried all variations of scanning | windows and such and dug down into the code for Bluez without | figuring out either what I'm doing wrong or where the issue is. | Beacons will supposedly not ping for minutes at a time despite | being on a 5s interval no matter what I do, and this is for | beacons maybe 6 feet from the receiver (although ones further | away do timeout more). | | The last thing is what finally killed the project for me. I had | it (still have it) all setup in HA with notifications and | schedules and such, but I just turned off all the automation for | it until I get a chance to tear it down. Failed experiment. ___________________________________________________________________ (page generated 2021-02-04 23:00 UTC)