One off projects

RFID cat door:

A friend has an old cat that strugges to open the cat door, also other cats have the same magnetic tag so are able to come in / out of the house..

Solution: RFID!

Note that in NZ there is no embedded RFID in our cats like in Europe..



Function overview:

Inwards open function:

  1. Sense (RFID) cat
  2. Open inwards

Outwards open function

  1. Sense (infrared) cat or button
  2. Open outwards

Close function

  1. Wait x seconds
  2. Check inwards (RFID) & outwards (Infrared) sensors clear
  3. Slowly close door monitoring for blockage

Close blockage monitoring

  1. Monitor current draw on servo, if overcurrent or still drawing current after open/close should be completed then go to error state


  1. Optical sensor on closed position, will remove need for calibrate function...

Calibrate function

  1. Sense calibrate button
    1. Close door
    2. Flash both leds
    3. Sense either inwards or outwards buttons and move servo incrementally per the direction specified
    4. Sense calibrate button
      1. Stop flashing LEDs
      2. Save close position

Manual controls (buttons)

  1. Hold / Close / Calibrate

Status LEDS

  1. Power
  2. Inwards open
  3. Outwards open
  4. Both 2 & 3 solid: Hold (on solid)
  5. 2 & 3 cycling: Error
  6. 2 & 3 flashing in unison: Calibrate


Proposed building blocks:

  • 12V DC primary supply
  • Self contained RFID reader per ebay
  • Broken magentic secured cat door
  • RC Servo
  • House alarm infrared monitor
  • 5v PIC Microcontroller. & life support components
    • ICSP
    • 5v Regulator

PIC MPU selection

PIC function requirements (pretty undemanding)

  • Onboard oscillator (or RC)
  • PWM
  • AD

Pin count:


Purpose Pin
Door servo PWM RC2 (CCP1)
Servo current monitoring RA0 (A0)
Infrared sensor / Outwards button
RFID / Inwards button
RB4 (INT1)
Button: Hold / Close / Calibrate RB6 (CN)
LED Inwards RC0
LED Outwards RC1

A PIC16F628A has more than enough to do the above, but as I've a few old PIC16F* 28 pin dev boards and a couple of PIC16F876's as well as plenty of PIC16F886's and to allow for any feature creep later.. we will use one these chips.  This also allows me to connect an LCD display whilst debugging etc..

Temporary for debugging


Purpose Pin Count
LCD Data RCH 4
LCD Control RS RA5 1
LCD Control RW
RA3 1
LCD Control E
RA2 1





Power rail requirements:

  • 12V Automotive RFID system
  • 7.5V PIC board power input
  • 6V: RC Servo


The mainboard (remember we try to use our parts bin wherever possible)..


Well save our own older 28 pin prototype boards and instead use a spare KPIC-2840 proto board from ( (that I never really liked as it dedicates way to much board space to RS232 when I'm a RT232RL USB fan so would rather have seen that instead.  Also the ICSP socket part has its pins oriented 180 deg different from my normal RJ12 6p6c Jack supplier)..

We will start with the PIC16F876. We will use a ceramic 4mhZ oscillator as we have then lying around.

On the stock KPIC-840 protoboard:

  • PIC18F876 MPU
  • Some 0.1uF bypass caps for the MPU
  • Power input protection diode, KA7805 5v regulator & 2 x support caps
  • MCLR to ground reset button, with pullup & ICSP MCLR isolation diode..
  • ICSP socket
  • Power LED & resistor



Additional mainboard components:

Power supply rail dropping via diode..:

We expect to have a 12V regulated supply so will feed this directly to the RFID kit, then through a few rectifier diodes to drop it to 7.5v for the PIC, then through another couple of rectifier diodes to drop it for the servo.

RC current sensing:

We have onhand a very handy looking Allegro ACS706ELC-20A (Bidirectional 1.5 mΩ Hall Effect Based Linear Current Sensor with Voltage Isolation and 20 A Dynamic Range).  A litte expensive at US$3.00 but interesting enough to trial it.

So we will see if this is usable... it requires no support components and is 4.5-5.5v Vcc.  We will insert it in the path of the RC servo supply..  (We will breadboard thsi part of our application first).

RFID & Infrared input signals:

These devices switch output high (12V) when triggered.. we will need to drop this to 5V, so we will go from through a 1kR to a grounded 5V zener diode then to PIC input pins..

UPDATE: The Allegro part is 20A and our puny 0.3A hardly registers on it..