Smart doorbell System
On request I have built a microcontroller-based doorbell system which is being used in an industrial environment. This is the basic function: When you push the bell-button, a horn will sound for about 10 seconds. At the same time a light, which keeps burning until someone pushes a reset-button, will be activated.
- There are 2 different lamp outputs: these can be used to control a LED lamp with two different decks of LEDs.
- Possibility to enter a ‘secret’ code: push the bell button 3 times to activate a secret code (the light will now flash).
- Possibility to enter an ’emergency’ code: push the bell button 10 times to activate a secret code (the light will now flash very rapid and the horn will sound for 1 minute).
- Possibility to enable a temporary mute-mode by pressing the reset-button for 5 seconds: now the horn won’t be activated unless someone pushes the secret/emergency code.
- The temporary mute-mode is automatically turned off after 45 minutes. It can also be disabled manually: push the reset button again for 5 seconds.
- During the mute-mode the light flashes once per minute to indicate the mute-mode is active.
- Jumper selection: choose the horn-sounding time (5 seconds/10 seconds).
- The light is turned off after 15 minutes as some sort of overheat protection.
- The PIC is placed into a low-power sleep mode after 15 minutes.
Here you can find the schematics for this circuit. I didn’t create a PCB design because it was soldered on a prototype PCB. You can also download the PDF version of this circuit.
This circuit uses a PIC16F84A microprocessor whose frequency is regulated by a 14 MHz crystal. The circuit itself should be powered by a 12VDC voltage. Attention: I didn’t add a protection against reversing the polarity of the inputs.
- By setting jumper SJ1 you can make the pin RB1 of the microprocessor HIGH: this will shorten the duration of the horn sounding time from 10 seconds to 5 seconds.
- The push-buttons are connected to the ground: pushing them will make the inputs of the microcontroller low. I did not foresee any circuitry to avoid contact bounce: this is done in the software of the microcontroller.
The software for the PIC is written in High-Tech C (the freeware version that is shipped with Microchip MPLab). You can download it at the bottom of this webpage.
The software is written in a way a certain task doesn’t block the other tasks. Every large delay is split up into tiny delays.
A push on any of the push buttons will cause an interrupt (PortB portchange interrupt). During the execution of the interrupt handler an internal counter is increased. This counter holds the number of times the button was pressed. If you take a look at the source code you will probably notice there is a delay function inside the interrupt handler. I realize this is a big NO-NO as an interrupt handler should finish its task as quickly as possible. But in this particular case I don’t see any harm in delaying the handler.
The microprocessor works with a 14.31818 MHz crystal. This is a little bit high for this kind of application but I had no other crystals at my disposal during the development of the circuit.
You can download the C source for this project here:
|Developed in:||High-Tech C (Microchip)|
|Download type:||Doorbell Source (.C Source)|
Source: Smart doorbell System
Current Project / Post can also be found using:
- smart doorbell systemproject synopsis