Cat door informer sensor

Thread Starter


Joined Jun 30, 2022
Hello All. I made a cat door informer. My plan is simple.

I installed an accelerometer ( ADXL335 ) on the cat door. ( Please see diagram at the very bottom of this post ).
If a cat goes through the door, the accelerometers' x or y or z axis changes in value.

My Arduino, that works in tandem with the accelerometer ( ADXL335 ) informs me when a cat goes through the door.
Its a fairly simple setup.

Here is the issue:
When the cat is done going through the door, the door keeps oscillating!
This is messing things up for me.
Because the sensor, which is the accelerometer in this case, is physically oscillating, I am getting these extra, false, unnecessary readings that are telling me that a cat is going through the door, when in reality, it is not!

It is the door oscillating around the threshold 'z' value that is creating the fale messages.

The oscillations are making the z value of the sensor go from 344 to 350 and then back to 344 to 349 etc etc.

Every time the cat door oscillates such that the z value is greater than 348, a false message is being generated that a cat just went through!

Ideally, once the z value is higher than 348 I want the Arduino to tell me just once, that the cat came in.

When the cat door is fully closed, My Arduino was telling me that:
x = 274
y = 341
z = 338

Everytime a cat goes through the door, the serial monitor is telling me that:
x = 274
y = 341
z = 352

I dont want the extra "A cat just came in" fake messages which are being generated due to the oscillations of the door around the threshold value of 348.

( This will be an issue going forward, because I want to have a buzzer in this system and I don't want the buzzer going off due to the oscillations. i just want one buzz when the cat comes in.)

  1. Can you guys give me some feedback on how to stop the fake messages that are being generated due to the oscillations? Is there a electronics hardware solution to this kind of a problem?
  2. I am willing to replace the project with any other sensor. Can you recommend other types of sensors, which might job this job without these oscillations/ fake message issues? I choose an accelerometer just cause it was lying around.

Ty for the replies!

Untitled Diagram (1).jpg


Joined Aug 7, 2020
My cat door has a small magnet to prevent the wind blowing it open. If I needed to detect the cat going in or out, I‘d put a reed switch so that it was activated by the magnet.


Joined Jul 10, 2017
There is a simple solution: Do not sample again, once the door movement is sensed, for the time it takes for the cat door to stop swinging.
Your project is definitely overkill. A tilt switch or magnetic reed switch would have been much simpler sensors.


Joined Jan 27, 2019
Welcome to AAC.

Let’s deconstruct your problem and see if you have a solution or a new problem.

You have a cat. (This problem is out of scope)
You provide a door (a flap in a door) so the cat can leave and enter the house when it wants to.
You want to know when the cat has used the door.
You have an accelerometer that you feel the need to use as part of the solution. (This is now part of the problem)
You’ve written a program that uses changes to the accelerometer data as a proxy for a signal the cat has used the door.

So, now you find that the a change in the accelerometer data doesn’t correspond to a cat passage, though that information is in there. So, think about it. Observe the event you want to alert for—

The cat uses the flap, it is necessarily pushed up and out of the way. The accelerometer data changes and your device generates an alert. Indeed, a cat has used the flap.

OK, so that… wait a moment, the flap is moving again, and there’s no cat! It is now a gravity detector, and you get one or more cat-free gravity alerts. Why?

Because you underestimated the time a cat event takes. You stopped paying attention to the existing cat right after the accelerometer told you if was there and immediately began looking for future cats. But the flap needs to return to a resting position before the effect of the present cat is done.

The cat doesn’t just push the flap up, it swings the flap back and forth. A “cat event” from the flap-as-evidence point of view takes a few seconds. So you have to either:

1. Actually identify the signature of a cat-used-the-flap event, which includes several accelerometer changes, or;
2. Have the detector ignore everything after the first change for a period that allows the flap to come to a rest.

The first option is actually the best. First of all, it will filter out the person-door opening and closing, something not a cat imparting energy to the door or flap, or a false use where the cat changes its mind. If you want to know about these events, it’s simple enough, just characterize them as you did the successful passage events and use that signature. (Same for a knock on the door, and the door opening and closing).

The second is “simple” but is bound to be subject to many false alarms.

I would favor optical sensors—two of them. You can place them so the flap triggers them when it moves. This lets you track exits and entrances separately, and with a little cleverness, even if the cat actually came in or out. You will need to deal with the swinging flap just like above, but that’s because a cat event includes it—you are just dealing with reality.

You can reduce the settle time using some scheme to decelerate the flap as it swings down. I would be inclined to try using rare earth magnets and some substantial copper pieces. The eddy currents induced in the copper by the magnets in motion will provide braking proportional to the speed of the flap, nicely damping the swing.


Joined Aug 7, 2020
What are the consequences to the cat of a "cat event" being detected? Is there any advantage to the cat of being able to use the cat door without a "cat event" being generated? If so, the cat will soon learn. . . . . .