Litter-Robot Pi Hack

by imrobber in Circuits > Raspberry Pi

743 Views, 1 Favorites, 0 Comments

Litter-Robot Pi Hack

Problem.jpg
Solution.jpg

SAFETY FIRST: WORKING WITH LIVE VOLTAGE IS DANGEROUS! While "only DC" it can still hurt you and/or cause damage. Pay attention to what you are doing, stay within your abilities, and stay frosty!

Let me start by saying we LOVE our Litter-Robot (LR)! Their product and customer service have been great.

Problem Statement: Latest move caused the rotating drum to slightly deform and now the built-in LR features do not function properly.

Background: We live overseas. We both work and have two cats. Therefore, the LR is not optional for any of us, (lazy) humans or felines. Because I did not have the movers properly pack the LR (did not keep the original packaging), the drum (part of LR that rotates sort of like a cement mixer) was deformed ever so slightly (currently my only complaint on the LR; just a little too finicky, should build in some play). LR Customer Service shipped a replacement under warranty, no questions asked, but the dimensions of the packaging are such that I cannot have it shipped to where we live for a reasonable price, so the real solution languishes in our stateside residence.

While the LR does complete a full cycle (i.e, "cleans" the litter and deposits waste in the bin) when power is initially applied, that's where it stops; it no longer alerts us when it's time to take care of the bin and we can't use the bluetooth features. You can't see it in the static picture, but the three lights on the front blink in succession, basically telling me there's something wrong. I started thinking about this and thought to myself "if I can interrupt the power to the device periodically, let's say every three hours, wouldn't that 'fix' things?" Then I remembered playing with my Raspberry Pi (RPi) and relays turning lights and devices on and off. I was off to the races.

One more thing before we tuck in: This is not meant as a python tutorial or how to wire circuits. It is only a quick project to show that an RPi and a relay can be used to automate a mundane task, turning something off and on. I've spent quite a bit of time on Instructables.com, gleaning knowledge and ideas, so I thought I'd give something back to the group that has given me so much. Thanks to all you RPi geeks! You are all awesome!

Supplies

RPi.jpg
Single Relay plain.jpg
DC Barrels.jpg

Raspberry Pi; I'm using a 3B+ but could totally do this with a Zero. In fact, I have a Zero stood up with the code running on it. Works great on the Zero so will be replacing the 3B+ as soon as I care or need the 3B+ for something else. Besides, the 3B+ is total overkill for this simple project. I'm also keen to try an Arduino or one of the Feathers that Adafruit sells, think it would work great too but that's another Instructable.

Single relay module; all over Amazon for very reasonable prices. The ones I purchased were $8 for five modules and I saw them on Amazon UK for £8 for six relays. Get what you will but definitely recommend the optocoupler relays even though the volts and amps are very low.

DC barrel connectors; are optional but make installation easier. I was fortunate that my barrel connectors matched the power in for the LR and I didn't have to patch into the LR's DC wall wart.

A container to mount everything in; this can be anything. I didn't have a project box so I used some standoffs and an old storage container with a lid. I wanted something with a lid because cats are cats and I didn't want them getting hurt.

Wire the Relay

Single Relay.jpg
RPi wiring.jpg
relay pins.jpg

Go back and read the first sentence! Now continue ...

If you've never worked with relays before, you have two choices: Fail On (NC - Normally Closed) or Fail Off (NO - Normally Open). If this is confusing to you spend some time on YouTube; The Engineering Mindset (this guy is awesome!) has a great relay introduction and PiddlerInTheRoot (another fantastic resource!) has a video on the RPI and working with the 5V relay.

Wiring the DC power: I wired the positive (+) side of the DC power through the NC side of the module. This means, should the RPi fail, the power to the LR will remain on. With power available regardless of the state of the RPi, the LR can be cycled manually (have you turned it off and on?) by the cat humans or cat sitter several times per day until I get a chance to fix it. I just connected the negative (-) wires together as they are not switched.

Wiring RPi to relay: I wired pin 2 (5V power) to the "+" pin on the relay; pin 9 (GND) to the "-" pin on the relay; and pin 11 (GPIO 17) to the "S" (data) pin on the relay. Depending on the relay sourced, you may have different labels but should have one data, one negative (-), and one positive (+).

I know that I will get some comments that I didn't isolate the RPi. I thought about this but my system is already isolated through multiple transformers and, while a good thing to do (ESPECIALLY WITH MAINS POWER!) I didn't think it was necessary. I've had it running for over 100 days and it's not failed yet. Flame away...

Coding the RPi

The attached text file is actually the python script that I'm running. It is not elegant or efficient but then again, it doesn't have to be; it just needs to do what I need it to do. There's commented code in there that will allow you to test your relay down to five minutes. I basically cobbled together things I'd done in the past and that's that.

I set the RPi to launch the script at startup (instructions available, google it). This way if we lose power (happens a few times a month where we live) the script is started and running at all times.

Downloads

Clean-Up

I have the RPi on my network so I can VNC into it and make changes. If I find something I want to try, I can go ahead and do it; I'm my own CCB!

Feel free to ask questions but there's a reason I've only posted one thing; I'm busy and barely carved out 30 minutes to type this up.

Again, thanks to the community for all the great ideas.

Now, back to building that octocopter!