Theory for LCD & Key Pad

download Theory for LCD & Key Pad

of 8

Transcript of Theory for LCD & Key Pad

  • 7/31/2019 Theory for LCD & Key Pad

    1/8

    LCD display

    One of the best solutions for devices that require visualizing the data is the "smart" LCD display. Printing

    the data on this type of display is performed on the dot segments arranged to form a row. Segment

    dimensions are 7x5 dots and one row can consist of 8, 16, 20 or 40 segments. LCD display can have 1, 2 or

    4 rows. LCD can be connected to a microcontroller via 8-bit or 4-bit bus (4 or 8 lines).

    Besides these, there are control lines E (enable), R/W (read/write) and RS (register select) for a total of 7lines. R/W signal is on the ground, because there is one-way communication toward the LCD display.

    Some displays feature built-in back-light that can be turned on with RD1 pin via PNP transistor BC557.

    Microcontroller

  • 7/31/2019 Theory for LCD & Key Pad

    2/8

    Keyboard

    In more demanding applications that require greater number of buttons, it is possible to use buttons

    connected in matrix to keep microcontroller I/O lines free. The following sample includes scheme of

    connecting the keyboard and accompanying program which reads keyboard keys and prints the read value

    on LED diodes of port D.

    The keys are connected into shared rows and columns. 10K resistors between input pins and the grounddetermine the state of input pins when the key is not pressed. It means that the logical zero is on input pins

    when the keys are not pressed. In order to avoid short-circuits between two pressed keys, 1K resistor is

    added to each row.

    Reading the keyboard is done by subroutine "ScanKeys". The keyboard is connected to port B, it's pinsbeing designated as input for rows (RB7, RB6, RB5 and RB4) and output for columns (RB3, RB2 and

    RB1).

    Microcontrol

    ler

  • 7/31/2019 Theory for LCD & Key Pad

    3/8

    The program sets value of the last read key on port D. If none of the keys is pressed all diodes of port D are

    on. "*" and "#" are represented with values 10 and 11.

    The greatest task is on the subroutine ScanKey. It sets logical one on keyboard columns and then calls thesubroutineRow which checks if any of the 4 keys in that columns is pressed (which is signalized by

    variableFlag).

    In case that one of the keys from the column is pressed, variableKeyPress takes value from 0 to 3 (zero for

    the first row of that column, one for the second row of that column, etc.). By calling the appropriateLookup

    table, real value of the key is stored into variableResultand then to variable OldResultwhere from it is

    displayed on port D.In case that no key is pressed value of variable is 12.

    Microcontroller

  • 7/31/2019 Theory for LCD & Key Pad

    4/8

    Pulse generated circuit

    LM324-(Used as comparator)

    LM324 is a 14pin IC consisting of four independent operational amplifiers (op-amps) compensated in a single package. Op-amps are high gain electronicvoltage amplifier with differential input and, usually, a single-ended output. Theoutput voltage is many times higher than the voltage difference between inputterminals of an op-amp.

  • 7/31/2019 Theory for LCD & Key Pad

    5/8

    These op-amps are operated by a single power supply LM324 and need for adual supply is eliminated. They can be used as amplifiers, comparators,oscillators, rectifiers etc. The conventional op-amp applications can be moreeasily implemented with LM324.

    LDR Sensor

    The Photoconductive Cell

    A Photoconductive light sensor does not produce electricity but simply changes its physical properties

    when subjected to light energy. The most common type of photoconductive device is the Photoresistor

    which changes its electrical resistance in response to changes in the light intensity. Photoresistors are

    Semiconductordevices that use light energy to control the flow of electrons, and hence the current

    flowing through them. The commonly used Photoconductive Cellis called the Light Dependant Resistoror

    LDR.

    The Light Dependant Resistor

    Typical LDR

    As its name implies, the Light Dependant Resistor(LDR) is made from a piece of exposed semiconductor

    material such as cadmium sulphide that changes its electrical resistance from several thousand Ohms in the

    dark to only a few hundred Ohms when light falls upon it by creating hole-electron pairs in the material. The

    net effect is an improvement in its conductivity with a decrease in resistance for an increase in illumination.

    Also, photoresistive cells have a long response time requiring many seconds to respond to a change in the

    light intensity.

    Materials used as the semiconductor substrate include, lead sulphide (PbS), lead selenide (PbSe), indium

    antimonide (InSb) which detect light in the infra-red range with the most commonly used of all photoresistive

    light sensors being Cadmium Sulphide (Cds). Cadmium sulphide is used in the manufacture of

    photoconductive cells because its spectral response curve closely matches that of the human eye and can

    http://www.electronics-tutorials.ws/diode/diode_1.htmlhttp://www.electronics-tutorials.ws/diode/diode_1.htmlhttp://www.electronics-tutorials.ws/diode/diode_1.html
  • 7/31/2019 Theory for LCD & Key Pad

    6/8

    even be controlled using a simple torch as a light source. Typically then, it has a peak sensitivity wavelength

    (p) of about 560nm to 600nm in the visible spectral range.

    The Light Dependant Resistor Cell

    The most commonly used photoresistive light sensors is the ORP12 Cadmium Sulphide photoconductive

    cell. This light depedant resistor has a spectral response of about 610nm in the yellow to orange region of

    light. The resistance of the cell when unilluminated (dark resistance) is very high at about 10M's which falls

    to about 100's when fully illuminated (lit resistance). To increase the dark resistance and therefore reduce

    the dark current, the resistive path forms a zigzag pattern across the ceramic substrate. The CdS photocell

    is a very low cost device often used in auto dimming, darkness or twilight detection for turning the street

    lights "ON" and "OFF", and for photographic exposure meter type applications.

    One simple use of a Light Dependant Resistor, is as a light sensitive switch as shown below.

  • 7/31/2019 Theory for LCD & Key Pad

    7/8

    LDR Switch

    This basic light sensor circuit is of a relay output light activated switch. A potential divider circuit is formed

    between the photoresistor, LDR and the resistorR1. When no light is present ie in darkness, the resistance

    of the LDR is very high in the Megaohms range so zero base bias is applied to the transistorTR1 and the

    relay is de-energised or "OFF".

    As the light level increases the resistance of the LDR starts to decrease causing the base bias voltage at V1to rise. At some point determined by the potential divider network formed with resistorR1, the base biasvoltage is high enough to turn the transistorTR1 "ON" and thus activate the relay which inturn is used tocontrol some external circuitry. As the light level falls back to darkness again the resistance of the LDRincreases causing the base voltage of the transistor to decrease, turning the transistor and relay "OFF" at afixed light level determined again by the potential divider network.

    By replacing the fixed resistorR1 with a potentiometerVR1, the point at which the relay turns "ON" or"OFF" can be pre-set to a particular light level. This type of simple circuit shown above has a fairly lowsensitivity and its switching point may not be consistent due to variations in either temperature or the supplyvoltage. A more sensitive precision light activated circuit can be easily made by incorporating the LDR into a

    "Wheatstone Bridge" arrangement and replacing the transistor with an Operational Amplifieras shown.

    Light Level Sensing Circuit

    In this basic circuit the light dependant resistor, LDR1 and the potentiometerVR1 form one arm of a simple

    Wheatstone bridge network and the two fixed resistors R1 and R2 forming the other arm. Both sides of the

    http://www.electronics-tutorials.ws/opamp/opamp_1.htmlhttp://www.electronics-tutorials.ws/opamp/opamp_1.htmlhttp://www.electronics-tutorials.ws/opamp/opamp_1.html
  • 7/31/2019 Theory for LCD & Key Pad

    8/8

    bridge form potential divider networks whose outputs V1 and V2 are both connected to the inverting and

    non-inverting voltage inputs respectively of the operational amplifier. The configuration of the operational

    amplifier is as a Differential Amplifieralso known as a voltage comparator with its output signal being the

    difference between the two input signals or voltages, V2 - V1. The feedback resistorRfcan be chosen to

    give a suitable amplifier voltage gain if required.

    The resistor combination R1 and R2 form a fixed reference voltage input V2, set by the ratio of the two

    resistors and the LDR - VR1 combination a variable voltage input V1. As with the previous circuit the output

    from the operational amplifier is used to control a relay, which is protected by a free wheel diode, D1. When

    the light level sensed by the LDR and its output voltage falls below the reference voltage at V2 the output

    from the op-amp changes activating the relay and switching the connected load. Likewise as the light level

    increases the output will switch back turning "OFF" the relay.

    The operation of this type of light sensor circuit can also be reversed to switch the relay "ON" when the light

    level exceeds the reference voltage level and vice versa by reversing the positions of the light sensorLDR

    and the potentiometerVR1. The potentiometer can be used to "pre-set" the switching point of the differentialamplifier to any particular light level making it ideal as a light sensor circuit.

    Bulb sequence circuit

    http://www.electronics-tutorials.ws/opamp/opamp_5.htmlhttp://www.electronics-tutorials.ws/opamp/opamp_5.htmlhttp://www.electronics-tutorials.ws/opamp/opamp_5.html