Simple Cheap And Intelligent Pigeon Hole Information Technology Essay
Pigeon hole is a type of bookshelf which has arrays of compartments for sorting mails and documents in a smaller size. [1] It is usually being seen at office, bookstores, and so on. It is called pigeon hole because it looks like the pigeons feeding rack in the old time. Normally, each compartment of pigeon hole belongs to different users.
The pigeon hole is always located near the entrance of the office. It is because the office staff is able to receive the mails from postmen at the entrance, and distribute the mails to the different compartments of different users on the spot. Because of that, the location of pigeon hole is always set far from the staff area. The users are unable to know is there any latest incoming documents and mails immediately. They have to spend time in walking to the location of pigeon hole and check their compartments. In colleges and universities, the pigeon hole is normally located at the faculty’s office and it is very far from lecturer’s room. This is the reason why some of the lecturers seldom go to check their pigeon hole and they may miss out some of important mails or documents. Some of them even ignore the existence of pigeon hole because of its inefficiency.
(the significant of your project)
Therefore, this project is going to solve the problems, which is in the way to let the users know the latest incoming mails and documents immediately through email notifications. It can save a lot of precious time as to complete the other tasks as well, and regaining the consciousness to the users about the existence of pigeon hole.
In this project, a simple, cheap, and intelligent pigeon hole is going to be built here. When any of documents is put into the intelligent pigeon hole, it will send a notification email to inform the user that it has received some documents in which day and what time, and the user should collect them as soon as possible. If the pigeon hole is filled up with tons of documents, the pigeon hole will send a notification email to the user that it cannot receive mails and documents anymore, unless the user clears up the documents inside it. At the same time, a red LED at the top edge of pigeon hole will also light on, to show that the pigeon hole is full.
Each designs and steps taken in this project are focused to achieve the aims and objectives and meet the specifications. The design steps will be shown inside the design chart and give the clear explanations and troubleshooting results for each of design steps in the later part.
Project aims
Table shows the aims that have to be achieved in this project.
To design an intelligent pigeon hole which is able detect the presence of documents and remaining capacity inside it.
The pigeon hole is able to send a notification email to the user of pigeon hole when the presence of documents is detected.
The notification email is included the information such as received date and time, and remaining capacity of pigeon hole.
The pigeon hole is cheap, convenient, simple, efficient and stable.
To achieve the aims above, few objectives have been set to accomplish. Table shows the objectives that needed to be accomplished.
Design a sensor circuit for the detection of the presence of documents and determination of level of documents in the pigeon hole.
Design a PIC circuit for handling the signals that received from sensor circuit and send the appropriate message to email sending terminal.
Establish a suitable interface for the connection and communication between PIC circuit and email sending terminal.
Establish an email sending terminal in PC to perform the email sending function.
Project Overview
This project carries 50% of software configuration and 50% of hardware configuration. It consists of three parts as the following:
Sensor circuit part
PIC circuit part
Email sending terminal (PC) part
In the sensor part, an infrared LED and a phototransistor receiver work as transmitter and receiver respectively. These two components are combined into a set of IR sensor pair. One IR sensor pair is set on the bottom of the pigeon hole to detect the presence of documents, while another two sets of IR sensor pairs are set at the side of pigeon hole, to detect the level of documents now. The signal (or in other words, voltage difference) from photodiode will be forwarded to comparator and compare the voltage with the reference voltage in the comparator. If the IR sensor pair senses something, the output of comparator will go high and the signal will be sent to PIC circuit part.
In the PIC circuit part, the signal comes from sensor circuit part goes to the input pin of PIC. According to the received signal, the PIC will send the different messages to email sending terminal. This mechanism will be done by programming the PIC with C language.
In the email sending terminal part, the terminal emulating program will depend on the messages received from serial communication, and sending the different notification mails to the user. The overall process is done automatically and no external process required, besides of initialisation while starting the terminal emulating program in PC.
Here is the basic flow about how the intelligent pigeon hole operates:
This basic flow also implies to the designing concept of PIC programming part and Windows application design part later.
LITERATURE REVIEW
Introduction
Before a project is getting started, particular studies on the ways or methods to achieve the aims are required. To specify and solve a particular question encountered during the design period, the strengths and weaknesses of the particular method have to be carried out to justify what terms are actually needed in the project, and decide the methods that will be adopted. In this chapter, few methods will be reviewed as the references, such as encoded IR transmission, Universal Serial Bus (USB), Universal Synchronous Asynchronous Receiver Transmitter (USART) and so on. In the last part of this chapter, the comparison of strengths and weaknesses between each method will be briefly described, and decide which method will be adopted in this project.
Encoded IR transmission [9]
Encoded IR transmission is a kind of IR application which is used for detecting the further obstacles comparing to normal IR transmission. Normal IR emissions will be easily influenced by the lights and other environmental effects, but encoded IR transmission is still able to receive the IR signal. It is because only coded IR signal will be received in the receiver part. There are several of methods in signal coding, and one of the methods is using encoder and decoder chip to achieve the signal coding.
HT12A and HT12D are the encoder and decoder chips respectively. In HT12A, pin 1 to pin 8 (A0 to A7) are the code setting pins, and the pin 17 (Dout) is the coded signal output pin. The coded signal superimposes with a 38kHz carrier signal, and amplified by a Darlington transistor, operates the IR emitting in IR LED. This part forms the transmitter part of the whole system.
In the receiver part, a piece of IR receiver PIC26043S receives the coded IR signal from the transmitter. PIC26043S is a special receiver which has 3 pins configurations. The first and the third pin are Vcc and ground respectively, and the second pin is the signal output pin. The PIC26043S will only receive the 38kHz signal and discard all other frequencies of signal. When PIC26043S receives the correct signal, the signal output pin goes high and the signal is amplified and preceded to HT12D decoder chip. If the signal is encoded successfully, the pin 17 (VT) on HT12D will goes high and triggering the input of IC4001 NOR gate. After a series of triggering inside IC4001, the final output goes high and the LED will light on, to show the whole transmitting and receiving process is successful.
The advantage of encoded IR transmission is the detection distance is far enough in any of applications. The disadvantages are difficult in construction and the cost is high.
Universal Synchronous Asynchronous Receiver Transmitter [2][3]
Universal Synchronous Asynchronous Receiver Transmitter (USART), or called Serial Communication Interface (SCI), is the most common communication method with PC. There are two working modes in USART, one is synchronous mode and another one is asynchronous mode. Synchronous mode requires a clock and a data pin for transmission. Asynchronous transmission does not need the clock, so one of the pin can be used as transmitter and another pin can be used as receiver, and becoming a full duplex operation. It means that the transmission and reception are independent to each other, and both are able to work at the same time. However, when USART is used as serial port communication, only either transmitter or receiver can be worked at the same time.
USART is normally used in asynchronous mode. The most common use in asynchronous mode is communication to PC via serial port under RS-232 protocol. In serial port communication, only two pins (USART transmitter TX and receiver RX) and a signal ground cable are required to transmit the data. [3] In USART transmission, logic level signal is used. However, under RS-232 protocol, the logic level used in transmission is ±12V, i.e. -12V represents logic HIGH and +12V represents logic LOW. [3] In PIC, logic LOW is represented by 0V and logic high is represented by 5V. The logic level representation between PIC and RS232 signals are totally different. Therefore, the pins of PIC should not directly connected to the RS-232 signals, but using a voltage level converter chip to convert the voltage level, such as MAX232 manufactured by MAXIM Inc. [3]
When the serial communication is connected, the TX pin will be logic 1, or called MARK. When the data is ready to be sent, the TX pin will become logic 0, or called SPACE. The first bit sent will be in logic 0, or called start bit. And then the data bits will be sent from least significant bit first. In 8-bits data transmission, after the data is being transmitted, the following bit comes with parity bit first, and then is stop bit, which is at logic 1. However, in default serial communication configuration, no parity bit is sent, therefore the data is sent in a 10-bit frame: one bit of start bit, 8 bits of data, one bit of stop bit and no parity bits. For example, the binary bit of character ‘C’ in ASCII is 01000011, and the FIG shows that how the character ‘C’ is sent through serial communication. The first bit come with start bit, and then is data bit 01000011 (sending sequence is 11000010 because it starts from LSB), finally comes with stop bit.
The advantages of serial communication are easy configuration in both circuit and C program, and it is cheap. The disadvantages are the maximum baud rate is considered slow compared to USB, and modern computer does not equip with serial port. However, the later problem can be solved by using USB-RS232 converter.
Universal Serial Bus [3]
Universal Serial Bus (USB) is the most common interfaces in this world now. All kinds of electronic devices such as printer, mobile phone, mouse, MP3 player support the USB connection with computer. The appearance of USB has caused the fading of conventional communication interface such as serial and parallel communication. [5] Besides of transferring data, USB can be also treated as a power supply with +5V supply voltage. USB technology is originated from Compaq, Microsoft, Intel and NEX, and these companies formed a non-profit organisation, which is called USB Implementers Forum Inc. This organisation focuses on development of the various standards, applications and publications for USB standardization.
USB is a kind of high speed transmission interface. It has variety of specifications, such as USB 1.1 which is supporting up to 11Mbps; USB2.0, which is supporting up to 480Mbps; and the latest specification USB3.0, which supports up to 5Gbps transferring speed.[4] USB can support up to 127 devices connected under the same host controller. [5] In USB, there are 2 types of connector and 4 pins available. These 4 pins are coated by cable with special colour configurations. The following table shows the configuration of the connectors and pins in USB:
USB transmission uses packet data transmission. [5] The data packet will be sent through all the devices that connected to the same host controller. All devices will receive the data, but only the device that matches with the address stated in the packet is able to accept the data packet. In other words, only one device can send the data packet to the host at the same time, and the data packet will travel through all the devices and arrive at the host in the end. USB signal uses NRZI (non-return to zero inverted) data encryption method in transmitting. For logic ‘0’, the signal level is inverted meanwhile for logic ‘1’, the signal level is not changed. After six consequences logic ‘1’ in data stream is available, a bit ‘0’ will be filled in to make the data stream become dynamic. [3]
The advantages of USB are fast in transmitting data and less energy consumed. The disadvantages of USB are the configurations and program writing in C for the connection between USB communication and PIC are too complicated, and lesser model of PIC supporting the USB configuration.
Simple Mail Transfer Protocol [6] [7]
Simple Mail Transfer Protocol, is an electronic mail (e-mail) transmission protocol defined by RFC2821, which states the standard process of sending an e-mail from a standard user client to a server. It is specified as an outgoing mail sending protocol, or other words, it defines the transport of mail but not contents of mail. It stands on ASCII text-based so it is not so compatible with binary codings.
TCP port 25 is the specified listening port in SMTP. Firstly, user client (MUA, message user agent) connects to TCP port 25 from the terminal and sends the SMTP related instructions to MTA (message transfer agent) first. MTA will search the corresponding destination in the list of DNS (domain name system). Once found, the message will be sent to MDA (message delivery agent) and finally reach SMTP mail server terminal (MSA, message submission agent). After the readings and analysis, the SMTP server will respond the corresponding results to user client in certain message commands. At the end, the email will be forwarded from server to receiver by using IMAP (internet message access protocol). FIG shows how the message commands become the way of communication between MUA and MSA.
When user client is trying to connect mail server, client will send the command ‘OPEN’ to the user client, to connect to targeted mail server. If the connection is established, the mail server will response 220 to user client. Response code 220 means that the mailing service is ready between user client and server.[8] When user client would like to confirm the connection, the command ‘HELO’ is sent out to server. If the connection is successful, the mail server will response 250 to user client. Response code 250 means that requested mail action is ok and completed. [8] And then the user client can start to send the mail by now. During the sending process, different message command and response code are being used. When the user disconnect from the server, the message command ‘QUIT’ is sent out and the server will reply the code 221 to user client, and the connection between server and user client is disconnected.
The advantages of SMTP are supported by C# and Visual Basic .NET and most of the email servers are SMTP server. The disadvantages are difficult to implement and configure because too many of professional techniques required in settings, and difficult in maintenance.
Summary
In the previous sections, several of technologies that may be up to the project have been revised. To achieve the aims of the project, the decision making in applying which technologies into the project is the key to lead to success. The following table shows the brief factors on those visited technologies:
FactorsTechniques
Encoded IR Transmission
USB
RS232 serial communication
SMTP
Design Complexity
High
High
Low
Medium
Cost
High
Low
Low
Low
Reliability
Low
High
Low
Medium
Maintenance needed
High
Low
Low
Low
Efficiency
High
High
Medium
Medium
Encoded IR transmission has higher efficiency, but its circuit design is complicated and the cost is high compared with the others. USB has low cost advantage and high in reliability and efficiency, but the coding in MikroC is complex and only one or two models of PIC supports USB function. SMTP is the only way to imply the email sending function, and most of the email is based on SMTP technology nowadays. RS232 is the simplest and the cheapest way of communication with PC.
In conclusion, RS232 and SMTP technologies are adopted in this project, which is based on the aims of the project.
METHODOLOGY
In the previous two chapters, the aims, objectives, outlook and technical perspectives of this project have been introduced and revised. In this chapter, how to use all kinds of materials, circuits and programs to imply the design and achieve the aims and objectives of the project will be introduced. This chapter has two sections: hardware configuration and software configuration. Hardware configuration section introduces the materials and circuit design in the sensor circuit, PIC circuit and RS232 circuit. Software configuration section introduces the C programming in PIC and program design logic, and the design layout and programming code in email sending application by using Visual Basic 2008. This chapter draws out the whole design in this project.
Hardware Configuration
In this section, two parts will be divided. The first part is hardware overview; all physical materials used in the project are introduced in this part. The second part is circuit overview; the designed circuit in sensor circuit, PIC and RS232 circuit will be shown and explained in this part.
Hardware Overview
The following are the materials that will be used in the circuits. They are;
PIC microcontroller [3]
Programmable Interface Controller (PIC) microcontroller is a small integrated processor system chip which contains data, program memory, timers, input/output pins, internal interrupts and many other functions. It always can be seen in different kinds of electronic devices such as rice cookers, washing machine, MP3 player, mobile phone and more. All microcontrollers are operated by a set of instructions stored in the program memory. The microcontroller loads the instruction from the program memory one by one, decodes and then operates the instructions. Microcontroller can be programmed by assembly language and high-level language. However, assembly programming is difficult in writing and program maintaining, and different microcontroller manufacturers come with different assembly languages and syntaxes. Therefore, the high-level language such as BASIC, C and PASCAL are developed for easier construction of PIC programming. The large and complex programs can be developed and maintained easily by using high-level language.
There are two major microcontroller manufacturers in the market now. One is Microchip Inc., which has PIC microcontroller series, and another one is ATMEL Inc., which has ATC microcontroller series. In this project, PIC18F452 chip is adopted.
PIC18F452
PIC18F452 is a 40 pins 8-bit PIC microcontroller in DIL package manufactured by Microchip Inc. It comes from PIC18F series and consists of all PIC18F microcontroller specifications such as 77 instructions, compatibility with PIC16 instructions set, fast 10-bit analog-to-digital converter, contains at least two 8-bits timers and two 16-bits timers, USART function and many more. It has 3232Kbytes of program memory and 256 bytes of EEPROM.
In PIC18F452, it has five sets of parallel ports PORTA, PORTB, PORTC, PORTD and PORTE. Here is the pins configuration of PIC18F452 and the major functions list in each parallel port.
Ports
Major Functions
PORTA
Digital I/O
Analog inputs
10 bits A/D converter
PORTB
Digital I/O
External interrupt
In-circuit debugger and ICSP programming pin
PORTC
Digital I/O
Timer 1 oscillator I/O
I2C data I/O
SPI data I/O
USART TX/RX pins
PORTD
Digital I/O
Parallel slave I/O
PORTE
Digital I/O
Analog input
Parallel slave port READ/WRITE pin
The advantages of this chip are many pins are available in this model, and larger capacity in program memory. It also consumes lesser power compared to the previous model. The PIC flash memory in the program memory can be written and erased in around 100,000 times.
For connections of PIC in the PIC circuit, the pins in PORTA, PORTB and PORTC are used. PORTA receives the signals from sensor circuit, with the digital I/O configuration. PORTB is used to connect with LED indicators in front of the pigeon hole. PORTC is used for USART transmitter and receiver pins. A button switch and 10k ohms resistor are series connected with MCLR pin for the PIC reset function. The detail circuit connection is shown in the software configuration part later.
IR sensor [10]
Infrared (IR) sensor is the LED pair which formed by one IR-LED and one phototransistor. IR-LED emits the infrared light and phototransistor received the infrared light. The bias direction of IR LED and phototransistor must be set in opposite bias. When emitted IR light hits the obstacle, the infrared will be reflected under Law of Reflection. When the phototransistor receives the reflected IR light, it will bias some voltage to the anode and leads to the voltage difference in it.
Different from the encoded IR sensor in Chapter 2, this IR sensor does not contain any of carrier signals and the IR signal is easily influenced by the environmental factors. Hence, the detection distance of this IR sensor is only around 8 to 10cm. However, the distance is long enough for detection of documents because the location of the documents is near to the location of the IR sensors.
LM324 Operational Amplifier [11]
LM324 is a low power quad operational amplifier. It has 14 pins in DIP package. It has four sets of independent op-amp inside a single chip. It needs only 375μA of current input supply, input bias current as low as 20nA, and input offset voltage as low as 3mV.
LM324 is used for voltage comparator here. It has two inputs, which are inverting and non-inverting inputs, and one output in an op-amp. When the voltage in non-inverting input is higher than the voltage in inverting input, the output pin goes high. Conversely, the output pin goes low if the voltage in non-inverting input is lower than inverting input. The voltage in inverting input is called reference voltage and it can be adjusted freely by connecting with a 20kohm variable resistor. The output of op-amp will be connected to the digital inputs of the PIC in PIC circuit.
MAX232, RS232 serial communication connector and terminal emulating software [3]
In the last chapter, USART function has been introduced. USART is mainly used in RS232 serial communication. Serial communication is the easiest way to connect any external devices to PC. Although it is not as flexible and convenient as USB, it has the simplest configuration in circuit and no any extra complex codes in C program. RS232 has two types of connectors, which are DB9 connectors and DB25 connectors. Both of the connectors are inter exchangeable. Here are the pins configurations in DB9 connectors and DB25 connectors [13]:
As previously said, the signal of RS232 is ±12V, therefore the level conversion between PIC voltage level and RS232 signal level is required. MAX232 is a dual driver/receiver which coupled with capacitive voltage generator, manufactured by Maxim Inc. It is used to convert the voltage from TTL compatible digital logic level to RS232 signal level. [12] It converts logic ‘0’ in TTL to +12V and logic ‘1’ to -12V. [14] It only needs +5V supply to operate the chip and four pieces of 1µF capacitor as the charge-pump capacitors. Two sets of drivers and receivers are equipped in a single chip and the baud rate can reach up to 120kbit/s. [12]
To monitor the signal received in the PC side, a terminal emulating software is required. Terminal v1.9 is a freeware developed by . It is used to monitor the incoming message sent from any devices that connected to PC with serial port. Here is the windows appearance when running the software:
In the upmost of the window, many configurations of serial communication can be done at there. Firstly, choose which COM ports that would like to connect at the moment, on the COM port . Next, choose the baud rate, data bits, parity, stop bits and handshaking on the same row. When all the settings are done, click the ‘CONNECT’ button to start the communication. It is very useful in monitoring the incoming message and able to give the clues on troubleshooting the circuit.
LM7805
USB to RS232 converter
Circuit Overview
This part will introduce the circuits designed for this project. There are two sets of circuits in this project. The first one is sensor circuit, and the second one is PIC and RS232 circuit.
Sensor Circuit
As previously said in Project Overview, there are three sets of IR sensor used in this project. Two sets will become the document level detection and another set is document existing detection. As those three sets of IR sensor are using the basic IR sensor pairs mentioned in the previous section, the different locations of the IR sensors can be designed in a single circuit diagram, and all of the IR sensors are connected to the same LM324 chip. Here is the circuit diagram in the sensor circuit part:
From the circuit diagram above, although the three sets of IR sensor are allocated at different places, they are connected to the same LM324 chip. The numbers around the op-amp symbol show the pin configuration on the LM324. And only one 20kohm variable resistor is connected to the three inverting inputs of the different sets of op-amp on the LM324 chip. The non-inverting input is connected to the node between 10kohm resistor and phototransistor. When the IR sensor senses the documents, the output of op-amp goes high and the signal will be sent to PIC circuit.
PIC and RS232 circuit
This circuit is combined with signal processing center and USART message transmitting center. It is the intermediate interface between sensor circuit and PC. Here is the whole design of PIC and RS232 circuit:
In the left hand side, the outputs from the sensor circuit are connected to the PORTA pin 1, pin 2 and pin 3 respectively. PORTA pin 0 is not adopted because it has ‘read-modify-write’ effect and it will interrupt the signal reading from sensor circuit. A 10kohm resistor and a button switch are connected to MCLR pin for PIC reset purpose. PORTB is configured as output port for LED indicator connection. Three different colours of LED are connected to PORTB pin 0, pin 1, and pin 2 respectively. When the PIC receives the particular signal from the sensor circuit, the corresponding LED will light on, to indicate the different capacity condition inside pigeon hole.
The pin 25 and pin 26 of PIC18F452 are the USART transmitter and receiver respectively. TX is connected to the T1in on MAX232 and RX is connected to R1out. At the other side, T1out is connected to pin 2 of DB9 connectors and R1in is connected to pin 3. There are two pairs of drivers/receivers, and DB9 connectors and PIC have to connect to the same pair of drivers/receivers. As there is no any handshaking setting in default mode, except TX pin, RX pin and signal ground pin, no connection is needed on the other pins of DB9 connector.
The detail configuration in C programming for PIC will be shown in the software configuration part later.
Software Configuration
In this section, two parts will be separated. The first part is coding explanation of PIC C programming, while the second part is the design layout and coding in Visual Basic 2008 for email sending terminal application. This section draws out the configuration of functionality in this project.
PIC C Programming
MikroC Compiler [15]
MikroC is a powerful and feature rich programming tools in PIC C programming. It is a type of high level descriptive language and it has many of useful libraries embedded in the tools. MikroC is compatible with IDE and ANSI compliant compiler, and it can support the assembly language and C language appears at the same time under the same program. The following picture is the print screen of MikroC windows interface:
The panels at the left hand side display the code explorer and device clock setting tabs. The center black area is the code editing area. All the codes are typed at there. The upmost row is the menu bar and tools bar of MikroC. The MikroC is a shareware and
BIBOLOGRAPHY AND REFERENCE
[1] http://en.wiktionary.org/wiki/pigeonhole
[2]http://ww1.microchip.com/downloads/en/DeviceDoc/usart.pdf
[3] advance ….. (red book)
[4] http://www.usb.org/developers/ssusb
[5] http://en.wikipedia.org/wiki/Universal_Serial_Bus
[6] .NET internet and I/O technique handbook
[7] http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
[8] http://www.greenend.org.uk/rjk/2000/05/21/smtp-replies.html
[9] http://www.epemag3.com/index.php?option=com_docman&task=doc_download&gid=143&Itemid=38
[10] http://www.ikalogic.com/ir_prox_sensors.php
[11] LM324 datasheets
[12] max232 datasheets
[13] http://www.lammertbies.nl/comm/cable/RS-232.html
[14] http://en.wikipedia.org/wiki/MAX232
[15] http://backoffice.inware.it/files/prodotti/download/mikroelektronica/mikroc_manual.pdf
http://www.ip-extreme.com/IP/usart.html
http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter
http://www.crazyengineers.com/forum/electrical-electronics-engineering/28924-problem-ir-sensor-circuit.html
Order Now