… the saga of the twittering cat door continues …
Now that I have the basic prototyped twittering cat door working, I really wanted to make some improvements.
I wanted to use the pull-up resistors which are built-in to the Arduino input pins. I found a great explanation of these here : http://sheepdogguides.com/arduino/aht0button.htm. That should save adding resistors of my own to the reed switch input circuits, and make the wiring less of a rats-nest. This means that I can connect the pin to ground via the reed switch, and in the software tell it to “connect to +5v”. The sketch then assumes that the trailing edge of the switch fires the event, and assumes that HIGH is the normal state of the circuit, when the switch is off. When the cat activates the reed switch, the pin is pulled to LOW. This is the complete reverse logic to the pull-down resistor arrangement I had before.
I also noticed that the original prototype causes lots of “double-reported” events, so it appears that the cat “came in”, then “came in” again… all within a 2-3 second timeframe. I added a “cool-down” period in the sketch to prevent a second event “firing”. That should remove the “double-reporting” issue.
Making the red LED blink when there is a problem will make it more noticeable. The green LED should stay solid-on when it’s working, as I don’t want that to be distracting. Blink rate is 1-second on, 1-second off.
Then I got to thinking that it would be good to see the status of whether the cat is “in” or “out” without having to refer to a the PC. (I have an ancient mobile, so don’t use twitter on it). Perhaps a third LED in yellow showing “in” or “out” cat status. In the sketch logic I set this whenever a circuit through the switches is made, regardless of the “cool-down” timer.
I acquired a “protoshield” from http://www.nuelectronics.com and set-to soldering the header pins in place.
I decided to put one of my small breadboards on it, and add a couple of external connectors. The “OUT” block connects to the “cat going out” sensor…etc.
All in all, a much cleaner machine, and pretty much ready for being packaged… but that’s another story.