[Dan Kouba’s] parents replaced their doorbell button with one that lights up and found that the chime wouldn’t stop sounding after the button was pushed. These lighted buttons use an incandescent bulb in parallel with the button (a piece of hardware we’ve hacked in the past). It draws a small amount of current which isn’t enough to trigger the chime, but it is just enough that the chime unit reacts as if the button press never stopped. His parents asked what he could do about this and after some investigation he build a replacement board for the chime unit based around an ATtiny26L. The board monitors the voltage drop across a resistor in the doorbell circuit. When the comparator on the AVR detects a rise in the voltage drop across the resistor it rings the chimes, actuating the solenoids with a set of PNP transistors. [Dan] sent us all of the details which you can check out after the break.
My parents have this really old door mechanical chime that they got as a housewarming gift 25 years ago, and recently when they replaced the doorbell button with a newer lighted one, the bell wouldn’t stop chiming. Apparently the light in the button passes enough current through it while its on (and the button is unpressed) that it triggers the bell over and over again. They didn’t want to get rid of the doorbell, as the newer electronic ones just aren’t the same, so I was asked to see what I could do about it. My solution was this project.
The old chime system consisted of a motor, which would be set into motion by pressing the button, and a set of contacts which the motor would revolve around and trigger the four solenoids that ring the chimes. Once I disassembled it, the cause of the infinite cycle was obvious. The motor’s start current was higher than the light in the bell would permit, but once it was triggered once by pressing the button, the bulb current was enough for it to remain in motion. There wasn’t a whole lot I could do to fix the old system, so I designed a microcontroller based replacement.
I used an Attiny26L (admittedly overkill, but it was all I had on hand) for the brains of the operation, a button press detector made out of a comparator and a resistor (more about that in a second), and four transistors for triggering the solenoids. Those parts along with the power supply (there was 20VAC available at the wall) fit onto a radioshack PCB which happened to fit perfectly where the old system had sat. The old system had the option to either chime a sequence or only a single chime when the button was pressed, and I replicated this feature in software using the large blue DIP switch shown in the pictures.
My detector circuit is simply an 82 ohm 5W resistor inline with the button/light combo. The button and the light are in parallel, so there is always some current passing through the line, causing a small voltage drop across the resistor. When the button is pressed, the light is shorted out and the current becomes much higher, thus causing a higher voltage drop across the resistor. I used a comparator attached to a voltage divider reference (half the supply) and to the resistor. That in turn is connected to the AVR which monitors for the button press and triggers the chime accordingly.
One of the problems I ran into was that the solenoids are high side switched. One lead of each solenoid is attached to the case, so unless I wanted to run 4 more wires, I had to use PNP transistors to switch them (I would have used MOSFETs, but I had the transistors in my parts box). I used an NPN transistor to pull their bases low so switching from my 5V AVR was easier.
The code is really simple; it’s just an infinite loop watching the comparator output for a trigger, and after that it triggers either the chime sequence or the single chime based on the switch input. I was originally going to use interrupts, but I had issued with multiple triggers. The interrupt flag was cleared as soon as the ISR was being processed, so if the bell was pressed twice before the chime sequence was finished, the interrupt would trigger a second time once the ISR finished its first run. A simple if…then statement fixed the problem.
Download [Dan’s] code and schematic package.