monkeyfork
Posts: 20
Joined: Tue Oct 29, 2013 10:14 am
Location: orlando

catPooPee

Sat Sep 29, 2018 10:50 pm

I am a ways into my project catPooPee (aka PooPeePi ) which records overhead video of cat's litter box (using "motion") and records weight of litter box using load-cells (3-5kg load cells arranged as three hard points touching floor ). I want to move forward with ID of cat using openCV but that software suite is not in my skill set yet. I'd really like recommendations to help me down a path of least resistance of Identifying cat by color of collar.

Motion video is running well on old original pi burning about 25% of cycles. Measuring load-cells is off-loaded to arduino uno underneath litter box and is sent serially to overhead rpi. Rpi and RPi-cam is currently in structure above litter box but will be relocated to pole mount in future. Daily videos are offloaded to another server. I'd like to migrate entire system to one rpi-zero-w eventually if within it's limits of computational power.

Here is video of recent gangsta cat behavior uncovered <grin> by catPooPee. ( https://youtu.be/y2UVLkZmGP8 )

Any help to move forward with openCV on rpi greatly appreciated.

monkeyfork
Posts: 20
Joined: Tue Oct 29, 2013 10:14 am
Location: orlando

Re: catPooPee

Thu Oct 11, 2018 3:53 pm

humm... crickets. Maybe I should give more to receive. I have decided that it would be better to do the "which-cat-recognition" on a more powerful server where the daily collection of cat-event jpg's and avi's are moved to on a daily basis. I _think_ it will be easier to configure and use openCV for that sort of task on ubuntu than Raspbian but that's still total unknown for me. So, specifically for the RPi, I'm moving toward doing the load-cell weight measurement directly on the RPi rather than offloaded to a serially connected arduino. I've found this code base;
https://github.com/ggurov/hx711
for the very nice/cheap instrumentation amp that I'm using. Looks promising, will report after testing.
I am using 3 load-cells per litter box (underneath a platform that supports litter box) and was amazed to find that the weight is NOT equally distributed. Maybe it's a function of cat-center-of-mass versus centroid of load-cell contact points??? (I am static's challenged).

For anyone interested in connecting load cells as I have already tested (connecting load-cell to arduino, then arduino serial to RPi) this is where i started; https://github.com/bogde/HX711

I'm building up a second litter box now that I hope to connect the three load-cells (using the proprietary but documented synchonous serial protocol) very soon, reports to forum will follow.

wpballa1
Posts: 41
Joined: Sat Jun 27, 2015 12:49 am

Re: catPooPee

Tue Oct 16, 2018 12:47 am

Well I did something similar (just video with motion) to see which cat was missing the box. It turned out to be the one with arthritis. Rather than video identification, could you do it by weight? That might be a lot simpler in the long run.

monkeyfork
Posts: 20
Joined: Tue Oct 29, 2013 10:14 am
Location: orlando

Re: catPooPee

Tue Nov 06, 2018 5:22 pm

Thanks for input wpballa1. It appears with weight difference between _my_ two cats and accuracy of the load cells that I can indeed differentiate and ID which cat is in box with weight. However, I've already seen a few instances where one cat is in the box and one cat is on the platform (with load cells) harassing the cat in the box (grrrr) so the weight is screwed. So, I'm trying to cover the corner cases and lower the false alarms and provide other sensing methods for anyone that wants to try this. I will work toward pet-microchip sensing (not hopeful), and collar bound RFID (hopeful, but will piss off the cats). But first I'm working on using openCV to detect colored collars (slightly hopeful, cause I don't know openCV)

wpballa1
Posts: 41
Joined: Sat Jun 27, 2015 12:49 am

Re: catPooPee

Thu Nov 08, 2018 12:52 am

Well, we've got 4 cats and 5 cat boxes so they don't argue over who is using which one. After a while I can tell who did what by the shape of the poop! Of course that doesn't work with the pee...

PhatFil
Posts: 751
Joined: Thu Apr 13, 2017 3:55 pm

Re: catPooPee

Thu Nov 08, 2018 2:45 am

While I applaud your inventiveness i am dumbfound as to WTF and WHY???

I have dotted on all my cats over the years, i lost my lil black stealth cat Daisy about 3 years ago and still expect to find her occupying the corner of my eye in every room of my home, I was raised to understand that in the grand scheme of things Cats come first, For my formative years i would return home from school and wait while my Mam finished cooking the cats dinner (fish rabbit or chicken) before i was given my frozen reheat..

anyway good luck with the project and i look forward to the write up, I guess filling the cloud with cat scat is no worse than the bile found in social media

monkeyfork
Posts: 20
Joined: Tue Oct 29, 2013 10:14 am
Location: orlando

Re: catPooPee

Thu Nov 08, 2018 3:38 pm

thx for testimonials and data. to answer WTF & WHY. background. I spent life disliking cats and being a dog person. Then I spent some romantic weeks with beautiful russian lady in Sochi who is bonkers for cats. We spent much budget and time helping strays. That was NOT my plan but the experience changed me about cats. Now I'm certified cat-person. Of course all this happens about the time I retire. So... got all these aerospace skill sets and time on my hands... voila... project "catPooPee" that i'm sure will splinter and fork into many more cat-tech projects, ha.

I'm in a great maker space (Familab, Orlando) where I'm trying to recruit openCV expertise to pursue the first goal of ID-by-collar-color, then on from there. Periodic reports will be made to rpi-forum.

btw... the real WHY is that I've been convinced that cat dropping analysis (and weight tracking) may be a path of least resistance to monitoring cat health (so far I'm trusting but have goal of verifying).

PhatFil
Posts: 751
Joined: Thu Apr 13, 2017 3:55 pm

Re: catPooPee

Thu Nov 08, 2018 8:51 pm

Power to you, and Go For It (as you indeed are..) a mod, hack, or even a complete redesign/build of the automatic litter boxes that filter and discard the doings i can get behind 100% i can even understand the addition of say rfid collar tags and a reading coil-loop around the doorway and perhaps even a load cell or two to record mass of litter scat and liquid ejected each time to be used for a health related data log. but i would halt way before i started a photographic record of the scat left behind, no no no no no.. then again i bet there is a category on pornhub or similar that would welcome such media?? No disrespect intended, just honest horror at the prospect, Anyway have fun and enjoy, just not too much eh ;)

monkeyfork
Posts: 20
Joined: Tue Oct 29, 2013 10:14 am
Location: orlando

Re: catPooPee

Sat Dec 08, 2018 8:53 am

Update on catPooPee. With help from local maker space (Familab, Orlando) I _finally_ got a good working environment for openCV (with C++ bindings on lubuntu 18.04). I've hacked a number of how2s for openCV and am now confident that I can identify which cat (of 2) is in the litter box for an 'event' (based on color of collar). Weighing the cats upon arrival (to the litter box) is looking good using 3 load-cell contact points is looking good (for long term cat-weight tracking). However, determining weight of their deposits is going to be a bit tricky due to long term drift of the load cells (probably caused by self-heating of resistors in wheatstone bridge of load-cell). The HX711 based load cell amps have a power down feature that may help in fighting temperature drift but that is untested. So for now the planned system for 2 litter boxes (scalable to more boxes) looks like this;
- rpi-zeroW + rpi-cam running motion will capture box visit events (one avi plus sequenced jpgs) overhead litter box on pvc tubing structure.
- arduino nano running HX711-multi code base to manage 3 load-cells (5kg) will connect to rpi-zeroW via usb.
- central cat-server will pull accumulated poo-pee events from each remote rpi-zeroW (with local purge) on daily basis.
- central cat-server will prepare daily report based on motion event combined with weight measurements during the events.

I was discouraged from trying to incorporate pet-chip RFID detection due to poor detection range. However, collar borne passive RFID looks very good and I have access to some good tribal knowledge locally. (ID of cat using openCV and color of collar is not probably scalable)

Drawings for catPooPee platform that contains hardpoints for load-cells and pvc pipe structure for holding rpi-zeroW will be made available at some point.

Kalayana
Posts: 1
Joined: Wed Dec 19, 2018 8:46 pm

Re: catPooPee

Thu Dec 20, 2018 1:23 am

In response to Phatfil asking WHY, I had the same question after meeting 'monkeyfork' at Familab. He convinced me of the need though. First, on the individual level; when one of his cats was ill he said he would have realized sooner and prevented unnecessary suffering if he'd known that one particular cat had stopped using the litter tray regularly.

Also he's thinking far into the future. When we start having general purpose robots doing household chores we will create less landfill if they can detect when to clean the litter tray, rather than changing it at set times.

This catPooPee project is a step towards a bigger environmental project. And when he's developed this system there might be wider applications of the technology.

monkeyfork
Posts: 20
Joined: Tue Oct 29, 2013 10:14 am
Location: orlando

Re: catPooPee

Fri Dec 21, 2018 11:16 am

thanks kalayana for mission support)) Your perspective is valued. I should think more about how to present intent of project. Now a short catPooPee update for proof-of-life (i am old, that is always in question). The arduino code base HX711-multi is now working (after minor tweaks) for the triad of load-cells (for litter box weight measurement) and giving reasonable data (still drifty as a ten-cent gyro because of temp coefficient of resistors in loadcell combined with self-heating effects). The arduino connects to a rpi-B-early. The arduino is pumping out 3 measurements of the litter box weight at 10hz @ 115200bps. I've now written C code that receives the weight data and prepends a motion-like time stamp to record.

So... Motion running full time can consume 20% of available cycles (of old rpi). Layering on handling of the serial data from arduino is peacefully coexisting with motion so far although I did have apparent buffering problems that I've bandaided (to be analyzed later, right now I need drama).

Quick analysis of weight vs video are nominal and weight tracks with video. I've now captured a few full 'events' and will start spreadsheeting
the data to see if it's possible to measure the weight of 'deposits' and how well weight can be used to ID the cats. (my two furry lab assistants are close in weight so they make a good test case).

PhatFil
Posts: 751
Joined: Thu Apr 13, 2017 3:55 pm

Re: catPooPee

Fri Dec 21, 2018 1:18 pm

consider my vision expanded ;) :oops:

monkeyfork
Posts: 20
Joined: Tue Oct 29, 2013 10:14 am
Location: orlando

Re: catPooPee

Wed Dec 26, 2018 3:17 am

Christmas 2018 sitrep of catPooPee. There is a fly in my ointment :-( The weighing system for litter box plus cat works fine for clearly indicating that a cat is present... but I can do that with the motion videos. Need to get to accuracy and precision and repeatability to weigh their deposits. Initial weight data indicates goofy things like litter box weights tiny tiny bit less after the cat's visit than before. Don't think the cat comes to the litter box to eat dirt so that finding is suspect. My first guess of the errors in repeatability or showing small weight changes over very short period of time comes from the haphazard way in which I constructed the platform on which the litter box rests and which holds the three load cells. Take a look at my thrown-together platform and hazard some guesses (please)
platform0 pix link: http://dabeak.com/platform0_3strut_3LC_ ... 2357~2.jpg

platform0: 3/8" plywood scrap for planar surface. 1/2" AL angle used to fab struts that hold load-cells (at extreme ends). arduino and load-cell amps mishmashed willie nillie toward center. Assembly contacts floor by 3 M4 hex head bolts and extreme end of load cell. The 'struts were intended to stiffen the plywood to minimize sag when loaded.

My guess is that in taking path of least resistance for fabrication, the floor contact points are a few degrees off plumb. The off-plumbness is aggravated by the platform not being stiff enough. Fully loaded with litter box, litter and cat there is a perceptible sag in middle. When cat jumps out after 'event' the sag rebound plus stiction of the floor contacts probably changes how far off vertical the contact points are oriented.
Next action is to remount all the load cells to ensure vertical force vector and to stiffen platform to eliminate sag.

After reading up on the HX711 load cell amp I see lots of folks chasing both noise and drift issues. I'm sure I'll get to that but that's fine tuning compared to errors that I have now.

Still convinced that cats are extra-terrestrial engineers.

monkeyfork
Posts: 20
Joined: Tue Oct 29, 2013 10:14 am
Location: orlando

Re: catPooPee

Thu Dec 27, 2018 4:52 pm

Ok... I'm officially jazzed now. After yesterday's tweaks on the platform that has load-cells as floor contacts I'm getting very good data.
Here is time history of a "pee-event" (helpfully arranged by my furry lab assistant PeachO).
http://dabeak.com/test25dec2018_02_peachO_pee_event.pdf

Note stairstep on on leading edge. I believe this to be cat stepping into box. Stepping onto the platform in someplaces will actually "unload" some loadcells and probably accounts for this artifact. Also note a bit of scratching around early, a section of calm, then another section of scratching around as would be expected. Then near end of event a spike as PeachO launches himself out of the box. Finally and most importantly, a baseline shift that hopefully will be a standard data point, the weight of the cat-deposit.

I could make available the raw data and the associated jpg's and avi's from overhead motion triggered cam if anyone is interested in analyzing. I'm not very good at that aspect and would welcome opinions.

The "tweaks" on the platform yesterday was stiffening with aluminum angle and adjusting hard points (load-cell floor contacts) so that they are much closer to being orthogonal to floor.

monkeyfork
Posts: 20
Joined: Tue Oct 29, 2013 10:14 am
Location: orlando

Re: catPooPee

Fri Jan 18, 2019 5:33 pm

I've had to do another spin of my catPooPee platform. My failure analsis crew (cat PeachO and cat Piffy) have shown me how clever they are at destroying electronics. long story short, load-cells with associated delicate strain-gauge wires were underneath platform away from platform perimeter, hopefully out of reach of inquisitive cat-claws. My lab assistants schooled me... they can reach a LOOOONG way and #26 wire doesn't stand a chance against cat claws! So, now deciding how to put a skirt around perimeter of platform that will cut gap down to about 1/4" (get your paws under that you little bastards!). In mean time, check pix of what I call "hardpoints", a metal place to mount load-cell. http://dabeak.com/catPooPee_hardpoint_l ... 4915~2.jpg It's fabbed out of electrical junction box cover plate, very cheap in US. Another cover plate is used to complete the hardpoint as they are sandwiched on opposite sides of 5mm cheapie homestore plywood. Mo pix of new design platform soon. Meow

Return to “Advanced users”