Automatic Lighting and Visitor Counter

Only available on StudyMode
  • Topic: Light-emitting diode, Seven-segment display, Infrared
  • Pages : 8 (1487 words )
  • Download(s) : 133
  • Published : April 14, 2013
Open Document
Text Preview
8051 Project:
Automatic Lighting and Visitor Counter

Andrew Herzog
Richard Baker
December 13, 2007
CMPET 211

Executive Summary
The objective of the project was to create a circuit with an 8051 microcontroller that sensed when an object passed through an infrared receiver’s receive path to automatically turn on lights and count how many times the receive path was blocked. Discussion

To complete the project several smaller circuits were needed to be designed and constructed. The project needed a circuit to pulse an infrared LED at 38 kHz, a circuit to receive the infrared signal, a seven segment LED display circuit, an auto-lighting circuit, and a programming circuit. The project also required code to be written to the 8051 microcontroller to combine all the smaller circuits into an operational system. The 38 kHz generator, Fig. 1-1, was major factor in getting the infrared receiver to operate correctly. A 555 timing chip was used to output a squarewave at 38 kHz for an infrared LED. The generator needed to be completely isolated from the rest of the circuit because it was found that the infrared receiver’s output was similar to Fig. 1-2 at a frequency of 38 kHz. The receiver needed to output a high until an object blocked the infrared signal when it would output a low.

Fig. 1-1, 38 kHz Generator

Fig. 1-2, Infrared Receiver Output

The infrared receiver, Fig 1-3, was a
very basic component of the project. 5 V was
connected to pin three, ground connected to
pin two, and the output was on pin one which
was connected to pin twelve of the 8051. The
receiver output a high as long as nothing was
blocking the 38 kHz infrared signal. When an
object blocked the signal, the receiver output a
low, while being monitored by the 8051.

Fig. 1-3, Infrared Receiver Connections

Fig. 1-4, Infrared Transmitter and Receiver

The seven segment LED display was very similar to the “Interfacing the DS89C430 with a 7-Segment LED Display” lab that was done in the past. A couple problems occurred involving brightness and segments dropping out, those problems will be explained further in “Problems Encountered.”

Fig. 1-5, 7 Segment LED Display Connections

The auto-lighting portion of the project, Fig. 1-6, required knowledge learned in EET 210, the use of a transistor, LEDs, and a relay. The transistor had to be used as a switch, so using the rated values from the relay, coil pick-up voltage = 9 V and coil current = 30 mA, and the transistor’s hfe of 250, the base resistor of the circuit was found using EQ. 1 and EQ. 2, where hard saturation equals 2 IB.

IB =

I C 30mA
=
= .12mA
h fe
250
EQ. 1, IB

RB =

VB − .7V 5V − .7V
=
= 17.9kΩ
2I B
2 * .24mA
EQ. 2, RB

A resistor value was also calculated to limit the current in the LEDs. Using the LEDs’ current rating, 20 mA, and voltage drop, 1.6 V, the resistance value was calculated to be around 80 using Ohm’s Law.

Fig. 1-6, Auto-Lighting Connections

The programming part of the circuit, Fig. 1-7, was the same circuit used all semester to program the 8051.

Fig. 1-7, 8051 Programming

Fig. 1-8, Whole Schematic

Assembly code was written to the 8051 microcontroller so that all the circuits could be combined into one complete system. The code written for the 8051 can be seen in Fig. 1-9. Fig. 1-9, Project Code

ORG 0
TOP:

AGAIN0:

AGAIN1:

AGAIN2:

AGAIN3:

AGAIN4:

AGAIN5:

AGAIN6:

AGAIN7:

AGAIN8:

AGAIN9:

CLR P1.1
CLR P1.3
ACALL DELAY
JB P3.2, AGAIN0
MOV P1, #00001010B
MOV P2, #01011111B
CLR P2.6
SETB P2.6
ACALL DELAY
JB P3.2, AGAIN1
MOV P1, #00001010B
MOV P2, #01010000B
ACALL DELAY
JB P3.2, AGAIN2
MOV P1, #00001010B
MOV P2, #01101101B
ACALL DELAY
JB P3.2, AGAIN3
MOV P1, #00001010B
MOV P2, #01111001B
ACALL DELAY
JB P3.2, AGAIN4
MOV P1, #00001010B
MOV P2, #01110010B
CLR P2.6
SETB P2.6
ACALL DELAY
JB P3.2, AGAIN5
MOV P1, #00001010B
MOV P2, #01011111B
ACALL DELAY
JB P3.2, AGAIN6...
tracking img