14
1 Independent University, Bangladesh School of Engineering & Computer Science Microcontroller based Infrared Binary Counter Course Title: Embedded System Course ID: ETE-418 Course Instructor: Khosru M. Salim Group-9 Submitted By: Mirza Atik Ahmed Mehran 0620004 Niloy Saha 0620406 Homayun Kabir 0620032 Acknowledgement The use of hardware in a course and specially using the microcontroller was a great experience for our group. We would

Report on IIR counter- Embedded systems

Embed Size (px)

Citation preview

Page 1: Report on IIR counter- Embedded systems

1

Independent University, BangladeshSchool of Engineering & Computer

Science

Microcontroller based Infrared Binary Counter

Course Title: Embedded SystemCourse ID: ETE-418Course Instructor: Khosru M. Salim

Group-9

Submitted By:Mirza Atik Ahmed Mehran 0620004Niloy Saha 0620406Homayun Kabir 0620032

Acknowledgement

The use of hardware in a course and specially using the microcontroller was a great experience for our group. We would like to express our outmost thanks to Professor Khosru Mohammad Salim, Ph.D., School of Engineering & Computer Science Independent University, Bangladesh. It was his inspiration and encouragement that helped us, execute this project.

Page 2: Report on IIR counter- Embedded systems

1

We would also like to thank Mr. Gazi Shareef and Md. Arfeen for helping us with logistic support. This was a great experience and we would like to thank everyone who supported us.

Abstract: The project we had attempted; might be labeled as a very easy project

but it is a very basic project and has a great implementation in a variety of electronic field. The Infrared sensor is very low power consuming hardware and when used with microcontroller; we can make door sensor, car sensor, aero plane etc. Our project uses the microcontroller for counting how many people come inside the door and produce a binary output at the microcontroller PORTD.

Introduction: The microchips are the most important electronic parts in the field of modern electronics. The best part about microchip is that it can be programmed to do almost any analytic task. In our project the infrared sensor is used to detect any movement in front of a door and the data from the sensor is then processed to count how many people come inside the room and go out. Our project can be given a name of Infrared Binary counter.

Objective: The objective of our project was to use Infrared sensor and count how

many people come inside and go out with microcontroller. The use of microcontroller as a counter helped us learn assembly programming with MPLAB & learn the fundamentals of the microchips. With the implementation of this project we can improvise and use the same fundamentals for higher level microchip programming.

Page 3: Report on IIR counter- Embedded systems

1

Parts used: We had to use the following parts for the project.

• Microcontroller (PIC16F877A)• Infrared (IR) transmitter• Infrared (IR) receiver• Printed Circuit Board• Resistance (1KΩ and 100KΩ)• +5V Power Supply• Connecting Wire

Working Principle: The project can be divided into Infrared sensor, microcontroller and

binary display. The working principal is like the Infrared transmitter transmits infrared signal to the infrared receiver; the receiver output is mille volt range when there is no obstruction in front of the IR sensor circuit; when there is no obstruction in front of the IR sensor the output is 5 volts.

Figure: Whole System

So, the sensor output is 0 and 1. So, we used the microcontroller digital port for the input. The counting part is done by programming the microcontroller. We used two sensors for PORTD of the microcontroller and printed circuit board.

Page 4: Report on IIR counter- Embedded systems

1

PCB (Printed Circuit Board):The printed circuit board has a DC input of 5-18 volts which is then

passed into the voltage regulator which can withstand a voltage of maximum 20 volts. It has a slot for micro chip. In the board the chip is connected to Vss and GND. There are LED as the output of the PORTB, PORTC and PORTD. We also have connection for PORTA.

Voltage Regulator 7805CV:

Figure: Voltage Regulator

The voltage regulator is used for regulating the input of minimum 5V to maximum 18V and producing an output voltage of 4.8V to 5V. it is used in

Page 5: Report on IIR counter- Embedded systems

1

our printed circuit board for our microcontroller to give it a constant voltage of 5 Volts. It is very useful because in case of a short circuit the regulator burns out. There are voltages regulator and the Ratings and block diagram.

Figure: Internal Block Diagram of Voltage regulator

Infrared Transmitter:

Figure: IR Transmitter

Page 6: Report on IIR counter- Embedded systems

1

The infrared transmitter is the part of our sensor device which continuously sends infrared rays to the receiving end. We used 1kΩ resistance in series with the Infrared LED transmitter. The IR transmitter is in the forward bias. The transmitter is connected to 5 volt power supply (DC). For our project we are using 2 Infrared LED transmitters.

So, the working principle is like when 5V is supplied to the transmitter circuit, it continuously emits infrared ray to the infrared receiver.

Figure: IR Transmitter

Infrared Detector:

Figure: IR Transmitter

Page 7: Report on IIR counter- Embedded systems

1

Figure: IR Transmitter

Here the infrared detector is in series with the 100KΩ resistance and the output is taken in parallel with the IR LED detector. Two of this same type of detector is used in conjunction with the transmitter. The detector output is sent to microcontroller input.

The characteristic of an IR detector is the Low resistance in absence of the IR ray and just opposite in presence of the ray. The infrared detector has a voltage of about 144 mille volts in absence of obstacle and in presence of obstacle we get an output of 5 volts. The microcontroller digital ports can take the digital values as the input. So the digital I/O of PORTB is used as the input pin. As we are getting the output voltage of 114 mille volts and 5 volts; so, we get a voltage of either 0 or 1 as digital of 114 mille Volts and 5 volts.

Microchip: The PIC16F877A microchip was used in our system. Our input PORT

was the microcontroller PORTB pin no RB0 and RB1. The out was sent to microcontroller port D. So, all the 8 bits of the port D was used as the output.

So the microcontroller input pin RB0 and RB1 takes input from the two IR sensors and produces 0 & 1 for corresponding obstacle or no obstacle. The data is then processed as per our algorithm of the MPLAB program. The counter value is the sent to PORTD for binary output.

Page 8: Report on IIR counter- Embedded systems

1

Figure: PIC16F877A

In the next figure the block diagram of the microchip is shown. The whole process can be very clear if we look at the diagram. The input port is port B pin 0 and pin no 1. Then through our algorithm and logical operation and the use of the file register and status register the whole process of counting is done. The counting logic will be discussed in the algorithm section.

Display: The counter value is displayed in the PCB (printed circuit board)

PORTD. The display is in binary.

Page 9: Report on IIR counter- Embedded systems

1

Figure: PIC16F877A Block Diagram

Algorithm: To program a system one needs to maintain an algorithm. And our

system is no different from that. We had the following algorithm for programming the microcontroller to count the sensor input.Logical table

Page 10: Report on IIR counter- Embedded systems

1

RB0 RB1 Counter Logical operation1 0 Someone is coming

inincrement

0 1 Someone is going out

decrement

1. Start2. Check (RB0=1)

[As we had the sensor value of 5V when we had any barrier in front of the IR detector we are checking for 1 in the RB0]If yes,Goto CheckINIf not goto next instruction

3. Check RB1=1If RB1=1Goto CheckoutIf not goto next instruction

4. Goto loop5. checkIN

check RB0=0If yes, Goto CheckINIf not ,goto next instructionCheck RB1=1If yes, goto incIf not, goto checkIN

6. increment D17. checkOUT

check RB1=0If yes, Goto CheckINIf not ,goto next instructionCheck RB0=1If yes, goto decIf not, goto checkOUT

8. decrement D19. again goto step2

Limitation: The following limitations or faults were be observed by us

implementing the project.

• The IR sensor is suitable for short distance. So, for the wide door it will not work properly.

Page 11: Report on IIR counter- Embedded systems

1

• The sunlight contains the IR. So, at the day time the system does not work properly in extreme sunlight.

• The system becomes hanging up when a decrement happens.• This system is suitable for the single door room. It can calculate

the number for the multiple doors.

Possibility: The project we were working with has great future implementation. We

can develop the same principle to develop security alarm, car distance sensor, door sensor, automatic door, home sensitive automation, robotics etc. Compared with conventional techniques, microchip based works have demonstrated advanced stages in terms of analysis speed, cost savings, and detection sensitivity. As this review has shown, there is already a rapidly growing collection of new applications based on microchip. At the same time, many pre concentration methods have been developed to improve detection sensitivity that is readily transferable to the microchip. With the introduction of highly automated, high-throughput commercial instrumentation, microchip is likely to replace many of the complex and slower analytical systems used in routine analyses. Further improvements and an increase in sample throughput along with development of new protocols and enhancement of detection sensitivity for certain analyses could make our microchip basis IR systems key instruments for any type of analysis.

Conclusion: This was a great experience for me and my group members. We learnt

the Infrared LED transmitter and receiver working principle. We learnt the programming of the microchip. This is the century of the microchip and by learning the fundamentals of the microchip; we feel like we are stepping in the right direction. I think that this course has inspired me and my fellow members to do much greater projects with microchip in future.

Experimental photograph

Page 12: Report on IIR counter- Embedded systems

1