Short Course on Electronic Project Design and Fabrication

Lecture 2: LED, Seven Segment display, LCD, Dot matrix, Opto-coupler, Laser, Photo Diode, LDR
Editor: Md. Mahbub Hasan, EEE-061017, Tanvir Hussain, EEE-061049.

LED
LED is acronym of Light Emitting Diode. It is a basic electronic component mainly used as lighting device in many applications such as torch light, traffic light, cars head light, cards back light, as indicators in TV, Keyboard, Cassette Players etc.

Now a days, LED is also used in Mobile as back light, in LCD as back light, LED Screen etc. Here we will not go into the details of construction but we will only show you the application of LED. If you are interested in learning the construction of LED then please see the Reference section for Books name and article citation at the end of this section. Physical appearance of LED: LED is tow terminal electronic component. If you look closely then you will see that one lead is longer than another led. The longer lead is known as anode or positive lead and the shorter lead is cathode (denoted by K) or negative Electrical Sysmbol: In the Figure the electrical symbol of LED is shown. The Color emitted by a LED depends on which material has been used to make that LED not on the casing color of the LED. Basic Circuit to Drive LED: Here is a circuit to drive LED. Never connect a LED directly across a voltage source (e.g. A battery). Always design a circuit so that maximum 20mA current flows through the LED. But it can be (10mA to 20mA). More than 25 mA current for General LED will burn out the LED. LED in Series: Two or more LED can be connected in series a shown in the following circuit schematic. Here set the value of the resistor in such that current does not exceed maximum value of the LED. 1 Jointly Organized by: Dept. of EEE and IEEE RUET Student Branch

Short Course on Electronic Project Design and Fabrication
LED in parallel: LED’s can be connected as shown in the figure. There are various colors LED are available in the market. All kind of colors LED are available. Red, Green, Blue, Yellow etc. Di color LED is a three leaded LED. Both common anode and common cathode are available. RGB LED used for color Display.

LCD
There are various types of LCD. Here we only talk about character LCD. Character LCD are those where only characters can be shown (some calculator) not the graphics (mobile screen, TV).

These LCDs are the standard LCDs used everywhere. They come in many sizes and one size that's used a lot is 16x2 characters, so we'll use one of that size for our examples. They're very easy to use in 8 bit mode (4 bit is a little tricky). The LCD Connector The LCD Connector has 16 pins and is usually located at the top of the LCD. It offers pins for power, contrast, control lines, data lines and the LED backlight (if installed): Pin 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 Gnd 5V Vee RS R/W E D0 D1 D2 D3 D4 D5 D6 D7 LED+ LEDGnd and 5V shouldn't need any explanation. Vee is the LCDs contrast voltage and should be connected to a pot (voltage divider). The voltage should be between 0 and 1.5V (this may vary for different manufacturers) and the pin *can* also be tied to ground. RS is the register select pin. To write display data to the LCD (characters), this pin has to be high. For commands (during the init sequence for example) this pin needs to be low. R/W is the data direction pin. For WRITING data to the LCD it has to be low, for READING data FROM the LCD it has to be high. If you only want to write to the LCD you can tie it to ground. The disadvantage of this is that you then can't read the LCDs busy flag. This in turn requires wait loops for letting the LCD finish the current operation, which also means wasting CPU time. 2 Jointly Organized by: Dept. of EEE and IEEE RUET Student Branch

Short Course on Electronic Project Design and Fabrication
E is the Enable pin. When writing data to the LCD, the LCD will read the data on the falling edge of E. One possible sequence for writing is: - Take RW low - RS as needed for the operation - Take E high - put data on bus - take E low The LCD Command Set Most of the LCD commands don't need more time fore the LCD to execute them than writing a character. The datasheet of the LCD used for writing this code stated 40µs for a simple command. Clear Display: 0x01 This command clears the display and returns the cursor to the home position (line 0, column 0). This command takes 1.64 ms to complete! Cursor Home: 0b0000001x This commands also sets the cursor position to zero, but the display data remains unchanged. It also takes 1.64 ms for execution, but it also shifts the display to its original position (later!). Entry Mode: 0 0 0 0 0 1 I/D S I/D: Increment/Decrement Cursor bit. If set, the cursor will be post-incremented after any read data or write data operation. If cleared, the cursor will be post-decremented. S: If set, the whole display will be shifted, depeding on I/D: If I/D and S are set, the display will be shifted to the left, if I/D is cleared (S set), the display will be shifted to the right. Usually I/D = 1, S = 0 is used (increment cursor, don't shift display). Display On/Off: 0 0 0 0 1 D C B D: Display On/Off. If set, the display is turned on. When the display is turned off, character data remains unchanged! C: Cursor On/Off. If set, the cursor is visible in the way set by B. B: Cursor blinks on/off. If this bit is set, the cursor will blink as a black block. Otherwise the cursor is shown as an underscore _. Shift Cursor/Display: 0 0 0 1 S/C R/L x x S/C: If set, the display is shifted. If cleared, the cursor is shifted. The direction depends on R/L. R/L: If set, the display/cursor is shifted to the right. If cleared, it's shifted to the left. Function Set: 0 0 1 DL N F x x DL: Interface length. If set, 8-bit mode is selected (as in this example). If cleared, 4 bit mode is selected. N: Number of display lines. If cleared, the LCD is a one line display. If set, the display is in 2/4 line mode. F: Font size. If cleared, 5x7 Font is selected. If set, 5x10 font is selected. The last two features might lead to the question "Why doesn't my display know what it is?" Well the controller (HD44780) is always the same, but it works with many different display types (1 to 4 lines, 8 to 40 characters per line) and the displays also come with different character sizes (5x7 or 5x10). CG Ram Address Set: 0 1 ACG ACG is the Address to be set for Character Generator Ram access. The CG can be used to configure and show custom characters. DD Ram Address Set: 1 ADD 3 Jointly Organized by: Dept. of EEE and IEEE RUET Student Branch

Short Course on Electronic Project Design and Fabrication
ADD is the address to be set for Display Data Ram access. The display data ram holds the data displayed (the characters). See below for DD Ram organisation. Busy Flag/DD Ram Address READ: BF ADD If the command register is read, the value actually returned by the LCD is the DD Ram Address (bits 0..6) and the busy flag (bit 7). THe busy flag should be read after every command to achieve max speed. If the busy flag is set, the controller is still busy executing a command/writig data. Display Data Addressing The display controller has to offer a way of addressing all display characters which works for ALL kinds of displays (remember: 1 to 4 rows, 8 to 40 characters). That's why the rows don't follow each other. The rows start at fixed addresses: Display size 1st row 2nd row 3rd row 4th row Nx8 $00 - $07 $40 - $47 x x N x 16 $00 - $0F $40 - $4F $10 - $1F $50 - $5F N x 20 $00 - $13 $40 - $53 $14 - $27 $54 - $67 Of course this list is not complete, but it shows some mean details about using a 16 x 4 display: The first address of the second row is bigger than the first address of the third row! Example: For setting the cursor to the 3rd character of the second row in a 16 x 2 display, write 0x42 | 0b10000000 to the display command register.

Seven Segment Display
Seven Segment displays are used in many places, such as ours wrist watch, calculator, digital clock, etc. There are mainly two kinds of seven segment display. i. Common anode ii. Common cathode. In a seven segment display there are seven LEDs arranged in the way shown in the figure. There is an extra LED for dot point. In common anode all the anode of the eight LED are connected together and all the cathode are open. In common cathode all the cathode are connected together at single point and all the anode are open. One seven segment display can display one of all hexadecimal numbers. So any numbers of multiple digits can be displayed using multiple seven segment display.

4 Jointly Organized by: Dept. of EEE and IEEE RUET Student Branch

Short Course on Electronic Project Design and Fabrication

Dot matrix

Dot matrix is nothing but a group of LED arranged in rows and columns just shown above in the schematic. A dot matrix display is a display device used to display information on machines, clocks, railway departure indicators and many and other devices requiring a simple display device of limited resolution. A common size for a character is 5×7 pixels, 3×5 pixels, 8×8 pixels etc. There are also Di color Dot matrix as well as RGB Dot matrix. Normally the pins of the Dot matrix are arranged randomly.

Laser
Light Amplification by Stimulated Emission of Radiation (LASER or laser) is a mechanism for emitting electromagnetic radiation, typically light or visible light, via the process of stimulated emission. Some of the other applications include: • Medicine: Bloodless surgery, laser healing, surgical treatment, kidney stone treatment, eye treatment, dentistry. • Industry: Cutting, welding, material heat treatment, marking parts, non-contact measurement of parts. • Defense: Marking targets, guiding munitions, missile defense, electro-optical countermeasures (EOCM), alternative to radar, blinding enemy troops. • Law enforcement: used for latent fingerprint detection in the forensic identification field. • Research: Spectroscopy, laser ablation, laser annealing, laser scattering, laser interferometer, LIDAR, laser capture micro dissection, fluorescence microscopy. 5 Jointly Organized by: Dept. of EEE and IEEE RUET Student Branch

Short Course on Electronic Project Design and Fabrication
• • •

Product development/commercial: laser printers, CDs, barcode scanners, thermometers, laser pointers, holograms, bubble grams. Laser lighting displays: Laser light shows Cosmetic skin treatments: acne treatment, cellulite and striate reduction, and hair removal.

Classification of Laser: Class 1: Safe under reasonably foreseeable conditions of operations. Note that it doesn’t say ‘safe under any conditions’. Class 2: Visible lasers with light output within the visible spectrum of 400–700 nm. There is an assumption here that the blink reflex will close the eyes within a fraction of a second and hence provide protection. Prolonged exposure will cause damage. Class 3a: Safe for viewing by the unaided eye either visible or infrared light but possibly unsafe when viewed with instruments. Class 3b: Direct viewing is hazardous but reflected light is normally OK. Note the normally. Not to be viewed with instruments. Class 4: Horribly dangerous. Even reflections are hazardous and the direct beam can cause fires and skin injury. Not normally used for communications.

Photo Diode
A photodiode is a type of photo detector capable of converting light into either current or voltage, depending upon the mode of operation. Application of Photo Diode:

P-N photodiodes are used in similar applications to other photo detectors, such as photoconductors, charge-coupled devices, and photomultiplier tubes. Photodiodes are used in consumer electronics devices such as compact disc players, smoke detectors, and the receivers for remote controls in VCRs and televisions. In other consumer items such as camera light meters, clock radios (the ones that dim the display when it's dark) and street lights, photoconductors are often used rather than photodiodes, although in principle either could be used. Photodiodes are often used for accurate measurement of light intensity in science and industry. They generally have a better, more linear response than photoconductors. 741 They are also widely used in various medical applications, such as detectors for computed tomography (coupled with scintillators) or instruments to analyze samples (immunoassay). They are also used in pulse oximeters. PIN diodes are much faster and more sensitive than ordinary p-n junction diodes, and hence are often used for optical communications and in lighting regulation. P-N photodiodes are not used to measure extremely low light intensities. Instead, if high sensitivity is needed, avalanche photodiodes, intensified charge-coupled devices or photomultiplier tubes are used for applications such as astronomy, spectroscopy, night vision equipment and laser rangefinding.
6 Jointly Organized by: Dept. of EEE and IEEE RUET Student Branch

Short Course on Electronic Project Design and Fabrication

LDR
Photoconductive cells or photocells are two-terminal transducers which have a resistance determined by the amount of light falling on the cell. Most In the dark, the resistance of the LDR is very high, typically around 1M ohm. In bright light it is low, typically 1K ohm. An example of the peak spectral response of the LDR (VT936G from EG&G) is 550nm. The continuous power dissipation is 80mW and the maximum voltage which can be applied to it is 100V. The snake like track on the face of the LDR is a cadmium sulphide (CdS) film. On each side is a metal film which is connected to the terminal leads. Use a multimeter to measure its resistance when light is shine on it and when it is placed in a dark place.

Application of LDR: • Photocells may be used to measure light intensity and/or to control lighting. • They are typically used as part of a security system.

References: [1]. http://en.wikipedia.org/wiki/Laser

7 Jointly Organized by: Dept. of EEE and IEEE RUET Student Branch

Short Course on Electronic Project Design and Fabrication
[2]. http://en.wikipedia.org/wiki/Photodiode [3]. http://www.hioutput.com/tech/circuits/resistance.html [4]. http://www.theledlight.com/ledcircuits.html [5]. http://letsmakerobots.com/node/4948 [6]. http://electrofriends.com/articles/electronics/microcontroller-electronics-articles/8051-8951/interfacing-7segment-display-using-7447-decoder/ [7].Electronic Devices and Circuit Theory by Robert L Boyelstad [8]. Introduction To Fiber Optics By John Scrisp [9]. Introduction To Circuit Analysis By John Miller Design Challenge: Brightness control of a LED by PWM technique.

Home Work

Light Controlled Switch.

8 Jointly Organized by: Dept. of EEE and IEEE RUET Student Branch