0 Results
Your current location: Home > Technical Solutions > > Use a proximity sensor to create a cat doorbell

Use a proximity sensor to create a cat doorbell

eye 1301
文章创建人 Iczoom

Like many cats, Leonie loves to explore her surroundings, and after satisfying her curiosity, she likes to return home, where it's warm and dry and there’s food. Usually somebody will open the outside door for her, but entering her apartment is more difficult. There is one apartment door, however, where the doorbell magically rings whenever Leonie sits in front of it. This door is mine, so I can explain how the “magic” works.

Using the TSSP4P38 proximity sensor, I built a small device that activates the electric circuit to ring the doorbell when it senses anything staying in front of the door. Typical alarm systems would use a passive infrared (PIR) sensor, but for Leonie these devices have two disadvantages. For one, in order to avoid false alarms, they are designed to ignore pets. Secondly, they only respond to moving objects, and can’t sense a cat sitting still in front of the door. At best, they would ring the doorbell when the cat starts moving again; that is, when she leaves. With the TSSP4P38, my sensing device detects when Leonie arrives, waits a few seconds to see if she stays, and if she does it rings the bell.

Here is an infrared mid-range proximity sensor

Here is an infrared mid-range proximity sensor.

For this purpose, I placed the sensor on one side of the door frame and connected it to a microcontroller that has additional connections to a driver circuit for a VSLB3940 infrared emitter, and to an IRLD024 MOSFET that controls the doorbell. All of these are Vishay parts, with the emitter and sensor mounted in a TSSP-HA for optical isolation. The microcontroller is a Microchip PIC10F200, the very smallest member of its family. This chip can memorize 256 program instructions, which is sufficient to handle the sensor and to implement an alternate mode of operation in which the program sends the values of some significant variables to the serial interface of a PC for debugging, instead of ringing the bell.


This cat sensor rings the doorbell when something waits in front of it.

This cat sensor rings the doorbell when something waits in front of it. Click to enlarge.

A significant portion of the component count goes into the driver circuit for the emitter LED, which is a constant current source. Jumpers determine the current and thus match the sensing range to the environment. If the current is too small, the cat may not be detected when she is sitting at the opposite side of the door; if it is too high, the sensor might “see“ too much of the other side of the door frame and ring the bell when it shouldn’t.

Here is the circuit design for the cat doorbell prototype.


Here is the circuit design for the cat doorbell prototype. Click to enlarge.

Power consumption is so small that the supply current may be harvested from the doorbell transformer by using the voltage across the open switch, leading to a simple two-wire connection. To ring the doorbell, the device shorts its supply, and an electrolytic capacitor keeps the controller alive until it turns the bell off again.

The software in the microcontroller uses a timed loop to generate the 38 kHz carrier for feeding the VSLB3940 emitter and measure the duration of the TSSP4P38's output pulse. The program then computes a moving average of the most recent readings and uses it to fine-tune a threshold that classifies the next reading as either close or far. Close readings are counted, and after a predefined number of consecutive close readings, the MOSFET is switched on to ring the bell.

For details on how to operate the sensor, I found the application note “Vishay’s TSSP-AGC P Sensor Series for Proximity Sensing” by John Fisher and Anika Kühnle to be very helpful.

The good news for Leonie is that she does not need to know how all this works. She is just happy whenever I open the door for her. But if she knew that the TSSP4P38 creates the magic, I am sure she would purr her approval and appreciation. 


1.The content, data, charts, etc. of this article come from network reference or other public materials, and the copyright belongs to the original author and the original published source. If the copyright owner has any objection to the quotation of this article, please contact ICZOOM "marketing(at)iczoom.com" and we will deal with it in a timely manner.

2.The quotes in this article are for readers' learning exchange only, and do not involve commercial purposes.

3.The content of this paper only represents the author's point of view. ICZOOM cannot gurarante and assure the accuracy, reliability or integrity of the content. The decision or behavior made by readers after reading this article is based on their own will and independent judgment. Please clarify the relevant results before reading this article.

4.Please contact ICZOOM "marketing(at)iczoom.com" with the reason of reproducing if you want to reproduce the articles that ICZOOM owns the copyright. Without permission to reproduce, ICZOOM will reserve the right to pursue the legal liability.

5. If there is any inconsistency between the English and Chinese versions, the Chinese version shall prevail.

ICZOOM has the final right to interpret this statement.


Related Information