Door Chime Privacy Sentry using Attiny12

An ATtiny12 controller as a timer and some switching circuitry turns the doorbell off for 10 hours at the same time each day. The string of resistors across the top of the board are series connected to make a 728 Ohm 2 watt resistor. The slide switch is used to switch the circuit between the test and operate modes and the large round component to the left of the switch is the 0.033 farad capacitor.



The assembly language source file is on this page.


This is a resettable timer and the to circuitry connect it to an 18V to 24V doorbell circuit.

My home is in a nice neighborhood. The front yards are well kept, it is quiet, and people wave when you go down the street. The park nearby is kept clean and green and children there play nicely with each other. Behind this idillic appearance the neighborhood harbors a dark side. Door-to-door solicitors, who ring the doorbell several times a week selling everything from insurance to religion. This isn’t a real big problem for me, but because of my wife’s schedule, she frequently sleeps until late in the morning.

After being startled awake by a doorbell, she can’t go back to sleep and suffers because of it the rest of the day. Our first solution was a politely worded note on the door asking people to kindly go away, but that didn’t work at all.  Disconnecting the door bell wire at the transformer helped some, but that meant that we didn’t know when someone we wanted to see was at the door, or when the UPS delivery person dropped something off, leaving switching the bell circuit on and off as the only practical solution.
Mounting a toggle switch on the doorbell would be a simple enough solution, but with the availability of suitable microcontrollers, why not automate the switching? That would eliminate the problems associated with forgetting to switch the bell off before going to bed or back on after waking up.
After a couple of days of turning the problem over in my mind, I decided to modify the ATtiny12 real time clock-calendar firmware I had written previously, to make a resettable timer that would switch the doorbell off on a 24 hour cycle. The device described here does just that. The circuit connects to the doorbell circuit – taking power from the 18 VAC from the doorbell transformer and switching power to the doorbell circuit most of the day. The user interface is a pushbutton, a toggle switch, and two LEDs. One LED – the green one -blinks at 1 Hz, just to give me some comfort that the circuit is working. The amber LED glows whenever the doorbell is disabled.
To set the timer, you just push the button momentarily, and when its released, the amber LED will come on and the doorbell circuit is disabled  (the door bell button doesn’t work) for a 10 hour period. At the end of the 10 hour period, the amber LED goes off and the doorbell is enabled. 24 Hours after the button was last pushed, the amber LED comes back on and the door chime circuit is disabled again. this cycle repeats every 24 hours, and because its timing is set by a crystal oscillator, it should be able to go for months or years without needing to be reset.
The toggle switch allows the timer to be bypassed in case we want to have the doorbell operating 24 hours a day or in the unlikely event of a circuit failure.
Simple as it is, I have to say that this is one of the more useful projects for the home that I’ve built.

The Circuit

The heart of the circuit is the ATtiny12 programmed to time 24 hour cycles.
 The circuit consists of a power supply, a capacitor back-up circuit, a Atmel ATtiny12 microcontroller as a timer, and solid state realy circuit to switch the AC voltage in the doorbell circuit. The simple user interface is comprised of a resync button to synchronize the timer, a bypass switch to bypass the timer if desired, and two status indicator LEDs. It is designed to be used by people who are not technically inclined.
The bell transformer, the doorbell button, and the doorbell are not in the enclosure - they are built into the house. The bypass switch and resync (or reset) button are mounted on the enclosure.
Power for the circuit is derived from a half wave rectifier. One end of the bell transformer (the one with the orange wire, marked “ORN” connected to it) connects to circuit common each half cycle through one of the diodes in the diode bridge. During the same half cycle, the 1N4002 conducts, charging the 330 uf capacitor up to a maximum of 11 volts.  The filtered voltage powers the 78L05 5 volt regulator.
The current is limited with the 728 Ohm dropping resistor to a maximum of 30 milliamps in order to minimize the maximum load on the bell transformer, and to limit the amount of power that could be dissipated by any component on the board in the event of a component failure. The use of eight 1/4 watt resistors connected in series makes me feel a little more comfortable than using a single 750 Ohm 2 Watt resistor since the power dissipated will be spread over a large area of the phenolic circuit -pheonlic tends to discolor from heat more easily than fiberglass board, and even if a few of the resistors shorted, the others would be able to handle the increased dissipation -giving a little extra safety.  As a rule, I don’t use resistors beyond 50% of their rated power. In this case, the resistor string runs at 35% of rated power.
A .033 farad (not microfarad) capacitor is connected to the 2SA1020Y and the 2N4401 to provide backup power to keep  the timer running in the event of a power failure. The 2N4401 is there to connect the output of the 5 volt regulator to the ATtiny12 microcontroller when AC voltage is present, and more importantly, to disconnect the controller’s power supply from the LEDs when AC voltage is not present. Disconnecting the ATtiny12 from the LEDs keeps the LEDs from discharging the .033 farad capacitor. The 2N4401 is there to turn on the 2SA1020Y when power is first applied to the circuit, then to quickly disconnect itself from the circuit when the +5 volts starts to dip. The .033 farad capacitor supplies voltage to the ATtiny12 through the 1k resistor. By the way, you can use an 2N2907 in place of the 2SA1020Y.
I figure the .033 farad (not microfarad) capacitor should hold keep the controller running for nearly two hours. If the capacitor charges up to 4.6 volts (allowing for some drop across the 2SA1020Y and the 78L05 regulator being on the low end of its voltage tolerance)  and the microcontroller runs down to 2.7 volts, that is a voltage change of 2 volts. According to the Atmel data sheet, the average current over the range of 2.7 volts to 4.7 volts is 10 microamps. The time it takes the capacitor to discharge will be (2 volts x .033 farads )/10 microamps = 6600 seconds = 1 hour and 50 minutes; long enough to sustain operation over most small power outages. This analysis ignores leakage of the capacitor and the reverse leakage of the 2SA1020Y.
The controller is an Atmel ATtiny12 using a 32768 Hz crystal for its clock source. Its ideal for this project because it can run directly from a 32768 Hz crystal without the need for other components, takes very little power, and is inexpensive.
The reset pin on the microcontroller is pulled low by the “resync” button.  The button reset line is pulled up to + volts with a 100k resistor and the button is isolated from the reset pin with a 10k resistor to limit the energy absorbed by the ATtiny12 in case of an ESD discharge to the reset button. When the microcontroller comes out of reset, the timing cycle begins.  The reset pin is decoupled with a .001 uf capacitor.
Without this capacitor, noise from arcing in the doorbell button contacts (The doorbell itself is inductive.) would reset the microcontroller the first time the button was pressed after the end of the “off” part of the timing cycle. The 1 cycle per minute test signal was a great help while discovering and debugging this. Even with the 1 cycle per minute signal, it took dozens for trips between the doorbell button and inside the garage where the timer is connected to work out what was happening and test the solution.
There are three outputs from the ATtny12: A 1 Hz square wave that drives an LED to show that the controller is running, the timing pulse that is logic low for the first 10 hours of each 24 hour period, and a test signal that is logic low for the first 30 seconds of each minute. A SPDT slide switch on the board selects between the two signals. The 1 cycle per minute signal was very useful while testing and debugging the circuit.
The output selected by the SPDT switch drives both the amber LED and the gate of the AC switch MOSFET. When the output is low, the output sinks current thorough the amber LED and its associated dropping resistor, and it also holds the MOSFET in the off state. The gate of the MOSFET has a 1k resistor in series with it so that if any high frequency signals are capacitively coupled from the drain of the FET to the gate, the current resulting from these signals would be limited.
AC power connection between the bell transformer and the  doorbell is interrupted by a diode bridge, made with four 1N4007 diodes. If this were to be a production design, I would have used a molded bridge rectifier rather than four separate rectifiers. The AC connections on the bridge connect to the doorbell transformer and to the doorbell itself. The negative output of the bridge connects to circuit common and the positive output of the bridge connects the drain of the MOSFET, which in turn has its source connected to circuit common. When the MOSFET is driven into conduction, it basically shorts the output of the bridge, allowing AC current to flow through the AC circuit. While the MOSFET conducts, the doorbell can be rung by pressing the doorbell button. While the MOSFET is not in conduction, the doorbell cannot be rung.
A .015 uf capacitor reduces the rate of voltage change across the FET’s drain and sorce so as to reduce the chances of damage from what is sometimes referred to as “dv/dt turn-on” in which a fast edge on the drain capacitively couples into the gate circuit and cause the FET to conduct. The possibility of dv/dt turn-on is increased by the presence of the 1k resistor in series with the gate. My concern here is voltages induced in the bell circuit by nearby lightning strikes. Also to protect against transients, are a pair of 14 volt metal oxide varistors (MOVs). A single 28 volt MOV would offer slightly better protection because it would have a lower impedance and it would also be less expensive. I used two 14 volt MOVs because I have thousands of them and not 28 volt MOVs at all.
A bypass switch shorts the AC input terminals of the diode bridge together, allowing the doorbell to operate regarless of the state of the ATtiny12 timer, when we want to disable the timer function.
I am out of town 75% of the time for months on end, and the last thing I want to receive is an overseas telephone call telling me that this thing is acting up. For that reason, and my desire to not have to repair this once built and installed, I designed for relaibility, and this need is reflected throughout the design. Thats’ one reason the ATtiny12’s low current consumption is important, and why  the current through the LEDs is only about 2 milliamps, and a MOSFET that does not require drive current like a bipolar does -I wanted to keep power requirements low. That made it easier to make a series dropping resistor that would run at under 50% of its rated power under the worst expected combination of input line voltage and load.
The power supply filter capacitor is a mamoth 330 uf rated at 40 volts so that it would be operated will below its voltage and ripple current ratings, and can even loose a large percentage of its inital capacitance because of aging without affecting circuit operation. This desire for reliability is also seen in the transient voltage protection in the solid state relay section of circuit and in the wiring of the board directly to the off-board switch and pushbutton rather than using connectors. I suspect the IC socket is the weakest point in the design as far as reliabilty is concerned, and a socket was only used because this was a hand-wired prototype and changing the chip if it had been soldered directly into the board would have been a nightmare, and posed some electrostatic discharge challenges. While on the subject of electrostatic discharge and reliability, this is a good point to mention that the BUZ-73 MOSFFET needs to be handled carefully in order to avoid damaging it or reducing its reliability through electrostatic discharge. I dealt with this by shorting the gate, drain, and source leads with a small copper wire that remained in place until the part was completely mounted on the board.


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top