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.
Download
The assembly language source file is on this page.
Overview
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
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.
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.