Wireless catflap notification using Twine and Blink(1)


7 posts
by mailliw » Fri May 10, 2013 11:16 am
Hi all,

Got my Pi a few days ago and already in love with it, and in the spirit of sharing accomplishments I thought I'd share my first project: a catflap movement detector and notifier.

Twine sits on the catflap and, when it vibrates, sends a notification to my home network's public IP. I route this via a secret port to Pi. Flask is running an app which listens on that port for any connection, and then via Python runs a command-line which triggers Thingm's Blink(1) USB LED light, flashing green. Completely indebted to Diogo who wrote a Python wrapper for this. It also flashes blue when the temperature drops beneath 18c, though I've only done this for pointless kicks.

And it all happens in the space of about 2 seconds, which frankly amazes me. A nice, neat, slightly pointless and very silly way to get silent visual notification of when the cat comes and goes - and has taught me so much about how linux, debian and python all talk to eachother. Video here.

Next: time to make Pi and WeMo talk!

Will
Posts: 33
Joined: Fri May 10, 2013 10:51 am
by todbot » Fri May 10, 2013 10:42 pm
This is awesome!
Posts: 1
Joined: Fri May 10, 2013 10:40 pm
by mailliw » Fri May 10, 2013 10:59 pm
No, Tod, you are! Thanks for all the Apis. I understand a fraction of them but they've been brill. Any idea how to do a quick flash 10 times, white? Flash on, flash off...but faster than --blink?!
Posts: 33
Joined: Fri May 10, 2013 10:51 am
by raf » Thu May 23, 2013 9:08 am
Hi
Loving the idea of this. How hard would it be to extend it so you couls connect Pi to this catflap for example?
http://www.staywell.co.uk/intl/uk/products/pet-porte-smart-flap.aspx

This catflap works by reading the cats microchip. What its really bad at is setting opening and closing times (its comical). An internet enabled one would allow proper opening and closing times (FYI - I've yet to find a catflap on the market that does this (except this one and its difficult - if you want it to open at 5am then you have to wake up and program it at 5am))

You could extend it further by noting if the cat is on ot out (if more than one which is in or out) and if you really care you can plot your cat(s) day by how many times he/she comes and goes by storing the chip info. When you are away you can get emails telling you that your cats have come home etc.

Just a thought

Thanks

Raf
Posts: 2
Joined: Thu May 23, 2013 8:58 am
by mailliw » Thu May 23, 2013 3:50 pm
That's a great idea. I have one of their catflaps, but it's the model beneath it - just has the microchip detection but no timings. Two issues that I can see:

1) Communicating with the microchip detection electronics. I've played with the mechanism before and I think the door lock is released/closed by turning on/off an electromagnet. Actually communicating with the electronics, and having the Pi do something useful when it's activated, would need someone to take the thing apart and see how it works. Way beyond my capabilities!

2) Then there's the timings. How does this work? When it hits a certain time, it's locked? How is it locked? By magnet or motor? Again you'd need someone to take the chip board apart and see how it all works.

Let me know if you're going to do something with it...I'd be keen to help, but have absolutely no knowledge of electronics other than wiring a plug!
Posts: 33
Joined: Fri May 10, 2013 10:51 am
by raf » Fri May 24, 2013 11:10 am
Hi
Yes i thinik it works via electromagnet and I agree re: getting Pi to make the catflap do something based on an event is the tricky bit.

The way the catflap is set up is that during the day its open (cats can go out). At night the catflap locks (cats cannot go out). Whatever the time of day the cats can always come in (as long as they have been programmed).

So basically the Pi will have to just control the lock that allows the cats out or not and that would be via electromagnet (still no idea how to do that)

I have instruction son how to program the catflap if you want to try it with yours I can send

Thanks

Raf
Posts: 2
Joined: Thu May 23, 2013 8:58 am
by mailliw » Mon May 27, 2013 3:29 pm
Mine isn't as good as yours - it doesn't have the timer function. Just the microchip, but thanks anyway. We need someone with electrical wiring knowledge to take a Sureflap apart and see how it works!

Anyone willing?
Posts: 33
Joined: Fri May 10, 2013 10:51 am