Opto Squad

Vishay's OPTO blog site for the latest in all things OPTO ~ articles, videos, and products

“Magic” Cat Doorbell

Peace of mind: Leonie knows that she always has a safe place to stay

Peace of mind: Leonie knows that she always has a safe place to stay

Creating a “Magic” Cat Doorbell with the TSSP4P38 Proximity Sensor
By Andreas Freiherr

Leonie and her family live in a building with seven other families. 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, she just needs to wait in front of the building entrance, where somebody will open the door for her and she can get to the inside staircase. Entering her apartment, however, is more difficult. When she calls her people from outside the door, nobody can hear her, and the button for the doorbell is too high for her to reach. 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.

tssp4p38partUsing 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.

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.

nuntiator

Prototype of the “Nuntiator” that announces Leonie’s presence

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.

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.

Proximity Sensor (Rings doorbell for the cat.) Andreas Freiherr

Proximity Sensor (Rings doorbell for the cat.)  Andreas Freiherr

3 comments on ““Magic” Cat Doorbell

  1. roland
    May 17, 2016

    Great article and elegant approach… lovely cat too, how old is Leonie?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on May 16, 2016 by in Articles, Infrared Emitter, IR Receivers, on a side note....
THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000

Enter your email address to follow this blog and receive notifications of new posts by email.

%d bloggers like this: