We have three cats and the cat litter tray can get full quite quickly. Before we we have realised that the cat litter needs changing one of the cats has decided to go somewhere else in the house. This varies depending on how much the cats have been allowed out and the weather. An indication of cat litter use would be useful so that we can easily gauge when it is time to change the litter.
Cats in the litter are detected using an ultrasonic range finder which sends out a ping above the cat litter tray at regular intervals. If the distance measured is less than the length of the tray then a cat is sitting in the litter tray. This detection is used to count the number of visits and output the count onto a display.
Blue pixels indicate no. of visits. All pixels green to indicate cat presence detection for testing etc. Red pixels indicate cat litter needs changing. Circuitry is in an enclosure so that it cannot be disturbed by cat activity.
Cat presence detection includes a debounce feature. All variables for cat litter tray length, debounce delay, no. of NeoPixels, error margin and ratio for detections to LED indication can be set at the top of the code for personalisation and adjustments.
- If a continuous power supply can be guaranteed this could be made to be self-calibrating. The user would need to press a button each time the litter gets changed, having inspected it closely, and the code would calculate the average maximum.
- It turns out that the NeoPixels are rather bright and a glow can be seen upstairs during the night, especially when all eight pixels are lit. A night shutoff button could be included to allow the user to switch off the LEDs temporarily but for the code continue counting visits.
- An automatic version of night shut off might use a PIR to detect cat or human activity in the general vicinity and activate the LEDs and the ping loop for a handful of minutes. This is probably better because it makes sure that we do no forget to turn the lights back on in the morning and end up back at square one with the cats having 'accidents' elsewhere in the house.
- If using PIR as above, the Arduino could be put into lower power mode and be sleeping with LEDs and ping off until there is an interrupt from the PIR. This would allow it to be ran off batteries.