Door messaging system

Introduction

Human attraction towards much easier, faster and modern ways of doing work has increased hugely over time since the expected workload goes higher each day. The truth is, everyone is looking for a way to do a task just by performing a simple click or a press of a button!

Door Messaging System is a system which helps the present lifestyle of people, and allows to display a message giving the status inside the room to the outside,

·         Welcome : If the room is accompanied and the person is free for a meeting.

·         Busy : If the room is accompanied and the person is not ready for a meeting.

·         Away : If the room is not accompanied.

so that the visitor can decide whether to come back later or to enter without disturbing the person inside. The person inside will have to choose a message, select it and leave it on display. There can be special situations such as the person could be on a leave for several days or the room could be permanently unaccompanied by anyone, etc. To give such messages, the user should be able to input the message and leave it selected.

Materials and Methods

The System is built based on the methods available in PIC16F877A Microcontroller.
         
VSS and VDD are supplied 0 v and 5 v and the MCLR\VPP is given the capability of changing from 0 v to 5 v. OSC1\CLKIN and OSC2\CLKOUT are used to apply an external clock and a crystal oscillator is connected with 22 pf capacitors for protection, as in Figure 2 below. The clock frequency applied is 4 MHz since it is much convenient to use a minimum frequency in order to manage minimum power consumption.
              

The other materials were selected so as to match the ability of each I/O port of the PIC and expected output of the device. When selecting the materials it is also important to concentrate on the cost and how their size could affect the final product. So other than the PIC16F877A, the following components are used for system’s main functions.

  • 6 push buttons (inside)
    • Alphanumeric 16×2 LCD – To display the message to outside once a switch is pressed from the inside. For the person inside there is an LED per switch to indicate which message has been selected.
    • 5 LEDsCorresponds to the first 5 push buttons. Each goes ON with each button.
    • Buzzer (outside) – Corresponds with the 6th message. The person inside can let a blinking message to be indicated on the display once he/she knows there is a visitor. This buzzer makes a periodic sound along with the blinking to get the visitor’s eye to the changed message.  Other than the I/O capability, Capture method and the capability to serial commuication with the computer are used in this device.
  • push button for door bell (outside)
    • Buzzer (inside) – Will sound when a switch from the outside is pressed, so as to let the person inside know there is a visitor.
  • MAX232 – An integrated circuit for serial communication with the computer.
    • DB9/Serial port(Female) – This allows to connect with the serial port(male) of the computer.
  •  Remote Controller – Allows the user to change among messages without taking trouble to go to the device.
    • IR detector – Detects that a frequency signal is received once a button of the remote controller is pressed.

Capture

RC1\CCP2 and RC2\CCP1 ports, which could allow activation of Capture/Compare/PWM (CCP) modules, CCP2 module and CCP1 module respectively, can be used in order to get use of this property. It is possible to use either one module or one after the other, depending the required functioning. For this product, Capture method is initialized for CCP1 and the CCP2 module is disabled in a much convenient manner.
These modules contain a 16 bit register in each which can operate as a Capture register, Compare register and a PWM Master/Slave Duty Cycle register. Since Capture property is adequate in order to identify that a signal is received, in this product this property is used to identify that a signal is received from a remote controller and react by changing the current message to the one following.
When a Capture is made, the interrupt request flag bit (CCP1IF/CCP2IF) is set. So it should be cleared in software right after the Capture. If there is a change of capture mode, CCP1IE bit should be kept clear to avoid false interrupts. So this system is initialized with CCP1 set to capture every falling edge and the CCP1IF flag is set as clear.

Serial Communication

MAX232 does the translation for the data exchanging between the microcontroller and the DB9 port. So it connects the microcontroller to the serial port, converting the signals given by RS232 as compatible for TTL digital logic and vice versa. RC6\Tx and RC7\Rx pins of the microcontroller connect to this IC.
  • Microcontroller to computer
 
  • Computer to microcontroller

Design

              

The circuit was designed as matched to the above methods used. So that the IR detector is connected to RC2 as an input and the MAX232 deals with RC6 and RC7 ports. All the Other components were used as simple inputs or outputs.The LCD which has 3 control bits and 8 data bits, is conneted in 4 bit mode.

(The ports and their direction are defined in the codings attatched below)

Hardware

Mother Board

The mother board was constructed including an IC base suitable for PIC16F877A, connectors for each port, push button for MCLR, RS232 unit and a 5 v regulator unit.

Daughter Card for inside

The inside daughter card consists of 5 LEDs and 6 push buttons corresponding to 5 messages and another special message that blinks along with a buzzer, which is connected in the outside daughter card, and is not indicated by an LED. There is also a buzzer which should sound when a push button of the outside daughter card is pressed. This also includes the IR detector.
            

Daughter Card for outside

The outside daughter card consists of a LCD display, a push button and a buzzer.
       

Coding

At the initialization, direction of the ports are givrn by assigning to TRIS registers and all 5 LEDs are set to blink to note an master clear (MCLR) situation. Then the LCD, capture by CCP1 and serial communication are initialized.
Then an infinite loop consisting the functions to be checked during the device is processing. Within that loop it is checked whether a button is pressed and then a corresponding LED is set to get ON while a function is called to display the corresponding message on the LCD.Then the it checks whether the outide push button for the door bell is pressed and continues checking if any infra red signal is received.

Discussion

The Door Messaging System is a device to communicate with the outside world without disturbing yourself and also anyone who comes from the outside. The system works fine with the capabilities of PIC 16F877A. From the five main ports this device uses four and several pins of port C allows the use of Capture method and serial communication. All the other ports are used for I/O purposes.These capabilities which are used in the device are activated through the program. Six switches, five LEDs and the LCD are works as the basic system. Getting inputs from the ports of the switches and outputting correspondingly to the LEDs and the LCD. The reason to choose an LCD display, even though an LED display would be much clear, is due to the power consumption. LCD consumes relatively less power, and to optimize this low power concept, a crystal oscillator of a less frequency is chosen.

When coding for the remote controller and the IR detector, the attempt was only to identify that a signal is received. Capture module can be initialized to identify any falling edge but we know that a signal consists of several falling edges.

So there was a need to set a delay, till the whole signal passes, after the first falling edge is captured. One might think that then, when a button is pressed continuously this delay could come to effect and not allow the message to change to next until that delayed period is passed. It is true that this takes place but note that the time needed for a signal to pass is much less than the time a person takes to press a button. So there is no effect and it was observed very well during testing period.

Another additional capability given to the system is serial communication. This could allow the user to display a message different from the ones initially defined until MCLR is pressed. But it is not added to the current system.

This system is advantageous since it is much cheaper and the user does not need to have a knowledge regarding embedded systems to use the device.

Even though the system works well according to the expected results, there are some limitations.

Results

Door Messaging System – Youtube video

Limitations

  • The number of messages are limited by the memory space available in PIC 16F877A.
  • There is no way to skip the special message which produces a beeping sound, using only the remote controller.

References