Summary

This document provides an overview of input devices, focusing on barcode scanners. It explains how barcodes work and are used. This is a learning resource for educational purposes.

Full Transcript

3 Hardware 3.2 Input and output devices 3.2.1 Input devices Barcode scanners (readers) A barcode is a ser...

3 Hardware 3.2 Input and output devices 3.2.1 Input devices Barcode scanners (readers) A barcode is a series of dark and light parallel lines of varying thickness. The numbers 0 to 9 are each represented by a unique series of lines. Various barcode methods for representing these digits exist. The example we shall use adopts different codes for digits appearing on the left and for digits appearing on the right of the barcode: left right Left-hand Right-hand left right side of side of barcode barcode 12345 67890 12345 67890 This shows the use of the guard bars separating the left from the right. Guard bars This shows Guardthe bars Guardbars use of the guard barsseparating the left from the right. ▲ Figure 3.13 Diagram of guard bars ▲ Figure 3.14 Sample barcode Each digit in the barcode is represented by bars of 1 to 4 blocks thick as shown in Figure 3.15. Note there are different patterns for digits on the left-hand side and for digits on the right-hand side. 0 1 2 3 4 5 6 7 8 9 Left-hand side Right-hand side ▲ Figure 3.15 Barcode digit patterns The section of barcode to represent the number 5 4 3 0 5 2 would therefore be: 5 4 3 0 5 2 ▲ Figure 3.16 Sample barcode section using patterns from Figure 3.15 88 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 88 25/02/21 11:34 AM 3.2 Input and output devices Each digit is made up of 2 dark lines and two light lines. The width representing each digit is the same. The digits on the left have an odd number of dark elements and always begin with a light bar; the digits on the right have an even number of dark elements and always begin with a dark bar. This arrangement allows a barcode to be scanned in any direction. So what happens when a barcode is scanned? » the barcode is first of all read by a red laser or red LED (light emitting diode) » light is reflected back off the barcode; the dark areas reflect little or no light, which allows the bars to be read » the reflected light is read by sensors (photoelectric cells) » as the laser or LED light is scanned across the barcode, a pattern is generated, which is converted into digital data – this allows the computer to understand the barcode » for example: the digit ‘3’ on the left generates the pattern: L D D D D L D (where L = light and D = dark), this has the binary equivalent of: 0 1 1 1 1 0 1 (where L = 0 and D = 1). Barcodes are most commonly found at the checkout in supermarkets. There are several other input and output devices at the checkout: ▼ Table 3.4 Input and output devices at a checkout Input/output device How it is used keypad to key in the number of same items bought; to key in a weight, to key in the number under the barcode if it cannot be read by the barcode reader/scanner screen/monitor to show the cost of an item and other information speaker to make a beeping sound every time a barcode is read correctly; but also to make another sound if there is an error when reading the barcode printer to print out a receipt/itemised list card reader/chip and PIN to read the customer’s credit/debit card (either using PIN or contactless) to select items by touching an icon (such as fresh fruit which touchscreen may be sold loose without packaging) So the barcode has been read, then what happens? » the barcode number is looked up in the stock database (the barcode is known as the key field in the stock item record); this key field uniquely identifies each stock item » when the barcode number is found, the stock item record is looked up » the price and other stock item details are sent back to the checkout (or point of sale terminal (POS)) » the number of stock items in the record is reduced by 1 each time the barcode is read » this new value for number of stock is written back to the stock item record » the number of stock items is compared to the re-order level; if it is less than or equal to this value, more stock items are automatically ordered 89 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 89 18/02/21 3:50 PM 3 Hardware » once an order for more stock items is generated, a flag is added to the record to stop re-ordering every time the stock item barcode is read » when new stock items arrive, the stock levels are updated in the database. Advantages to the management of using barcodes » much easier and faster to change prices on stock items » much better, more up-to-date sales information/sales trends » no need to price every stock item on the shelves (this reduces time and cost to the management) » allows for automatic stock control » possible to check customer buying habits more easily by linking barcodes to, for example, customer loyalty cards. Advantages to the customers of using barcodes » faster checkout queues (staff don’t need to remember/look up prices of items) » errors in charging customers is reduced » the customer is given an itemised bill » cost savings can be passed on to the customer » better track of ‘sell by dates’ so food should be fresher. The barcode system is used in many other areas. For example, barcodes can be utilised in libraries where they are used in books and on the borrower’s library card. Every time a book is taken out, the borrower is linked to the book automatically. This allows automatic checking of when the book is due to be returned. Quick response (QR) codes Another type of barcode is the quick response (QR) code. This is made up of a matrix of filled-in dark squares on a light background. For example, the QR code in Figure 3.17 is a website advertising rock music merchandise. It includes a web address in the code. QR codes can hold considerably more information than the more conventional ▲ Figure 3.17 Sample barcodes described earlier. QR code Description of QR codes » A QR code consists of a block of small squares (light and dark) known as pixels. It can presently hold up to 4296 characters (or up to 7089 digits) and also allows internet addresses to be encoded within the QR code. This compares to the 30 digits that is the maximum for a barcode. However, as more and more data is added, the structure of the QR code becomes more complex. » The three large squares at the corners of the code function as a form of alignment; the remaining small corner square is used to ensure the correct size and correct angle of the camera shot when the QR code is read. Because of modern smartphones and tablets, which allow internet access on the move, QR codes can be scanned anywhere. This gives rise to a number of uses: » advertising products (for example, the QR code in Figure 3.17) » giving automatic access to a website or contact telephone number » storing boarding passes electronically at airports and train stations (Figure 3.18). 90 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 90 18/02/21 3:50 PM 3.2 Input and output devices By using the built-in camera on a mobile smartphone or tablet and by Boarding Pass downloading a QR app (application), it is possible to read QR codes on the move BX 885 Watson D using the following method: » point the phone or tablet camera at the QR code » the app will now process the image taken by the camera, converting the squares into readable data LHR to BUH » the browser software on the mobile phone or tablet automatically reads the March 15 2021 data generated by the app; it will also decode any web addresses contained Please be at the boarding gate by within the QR code 14:25 » the user will then be sent to a website automatically (or if a telephone number was embedded in the code, the user will be sent to the phone ▲ Figure 3.18 Sample app ) boarding pass » if the QR code contained a boarding pass, this will be automatically sent to the phone/tablet. Advantages of QR codes compared to traditional barcodes » They can hold much more information » There will be fewer errors; the higher capacity of the QR code allows the use of built-in error-checking systems – normal barcodes contain almost no data redundancy (data which is duplicated) therefore it isn’t possible to guard against badly printed or damaged barcodes » QR codes are easier to read; they don’t need expensive laser or LED (light emitting diode) scanners like barcodes – they can be read by the cameras on smartphones or tablets » It is easy to transmit QR codes either as text messages or images » It is also possible to encrypt QR codes which gives them greater protection than traditional barcodes. Disadvantages of QR codes compared to traditional barcodes » More than one QR format is available » QR codes can be used to transmit malicious codes – known as attagging. Since there are a large number of free apps available to a user for generating QR codes, that means anyone can do this. It is relatively easy to write malicious code and embed this within the QR code. When the code is scanned, it is possible the creator of the malicious code could gain access to everything on the user’s phone (for example, photographs, address book, stored passwords, and so on). The user could also be sent to a fake website or it is even possible for a virus to be downloaded. New developments Newer QR codes (called frame QR codes) are now being used because of the increased ability to add advertising logos (see Figure 3.19). Frame QR codes come ▲ Figure 3.19 Frame QR with a ‘canvas area’ where it is possible to include graphics or images inside the code code itself. Unlike normal QR codes, software to do this isn’t usually free. 91 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 91 2/18/21 6:28 PM 3 Hardware Activity 3.3 1 Using the data in Figure 3.14, design the barcodes for: a 900 340 (3 digits on the left; 3 digits on the right) b 1257 6648 (4 digits on the left; 4 digits on the right) c 05889 02918 (5 digits on the left; 5 digits on the right) 2 a Describe one advantage of using QR codes rather than traditional bar codes. Explain how barcodes bring the advantage you have described. b A square QR code contains 40 × 40 tiny squares (pixels) where each tiny square represents a 0 or a 1. Calculate how many bytes of data can be stored on the QR code. c Describe the purpose of the three large squares at the corners of the QR code. d Describe one disadvantage of using QR codes. Digital cameras Digital cameras have essentially replaced the more traditional camera that used film to capture the images. The film required developing and then printing before the photographer could see the result of their work. This made these cameras expensive to operate since it wasn’t possible to delete unwanted photographs. Modern digital cameras simply link to a computer system via a USB port or by using Bluetooth (which enables wireless transfer of ▲ Figure 3.20 Digital camera photographic files). These cameras are controlled by an embedded system which can automatically carry out the following tasks: » adjust the shutter speed » focus the image automatically » operate the flash gun automatically » adjust the aperture size » adjust the size of the image » remove ‘red eye’ when the flash gun has been used » and so on. What happens when a photograph is taken » the image is captured when light passes through the lens onto a light-sensitive cell; this cell is made up of millions of tiny sensors which are acting as photodiodes (i.e. charge couple devices (CCD) which convert light into electricity) » each of the sensors are often referred to as pixels (picture elements) since they are tiny components that make up the image » the image is converted into tiny electric charges which are then passed through an analogue to digital converter (ADC) to form a digital image array » the ADC converts the electric charges from each pixel into levels of brightness (now in a digital format); for example, an 8-bit ADC gives 28 (256) possible brightness levels per pixel (for example, brightness level 01110011) 92 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 92 18/02/21 3:50 PM 3.2 Input and output devices » apart from brightness, the sensors also measure colour which produces another binary pattern; most cameras use a 24-bit RGB system (each pixel has 8 bits representing each of the 3 primary colours), which means each pixel has a red value (0 to 255 in denary), a green value (0 to 255) and a blue value (0 to 255); for example, a shade of orange could be 215 (red), 165 (green) and 40 (blue) giving a binary pattern of 1101 0111 1010 0101 0010 1000 (or D7A528 written in hex) The orange pixel has brightness value of 115 (73 in hex or 0111 0011 in binary) Charge coupling device The pixel has three (RGB) components: (matrix array of sensors) red = 215 (D7 in hex) green = 165 (A5 in hex) and blue = 40 (28 in hex) ▲ Figure 3.21 Typical pixel brightness and colour values » the number of pixels determines the size of the file used to store the photograph » the quality of the image depends on the recording device (how good the camera lens is and how good the sensor array is), the number of pixels used (the more pixels used, the better the image), the levels of light and how the image is stored (JPEG, raw file, and so on). Mobile phones have caught up with digital cameras as regards number of pixels. Link But the drawback is often inferior lens quality and limited memory for the storage For an explanation of of photos. But this is fast changing and, at the time of writing, many smartphones how pixels affect file now have very sophisticated optics and photography software as standard. size see Chapter 1. CCD ADC 0111001111010111 digitial representation image lens of image the timing device allows timing different shutter speeds, device delayed action, and so on ▲ Figure 3.22 Diagram of how a digital camera works Keyboards Keyboards are by far the most common method used for data entry. They are used as the input devices on computers, tablets, mobile phones and many other electronic items. The keyboard is connected to the computer either by using a USB connection or by wireless connection. In the case of tablets and mobile phones, the keyboard is often virtual or a type of touch screen technology. 93 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 93 18/02/21 3:50 PM 3 Hardware As shown in Chapter 1, each character on a keyboard has an ASCII value. Each character pressed is converted into a digital signal, which the computer interprets. ▲ Figure 3.23 Keyboard They are a relatively slow method of data entry and are also prone to errors, however keyboards are probably still the easiest way to enter text into a computer. Unfortunately, frequent use of these devices can lead to injuries, such as repetitive strain injury (RSI) in the hands and wrists. Ergonomic keyboards can help to overcome this problem – these have the keys arranged differently as shown in Figure 3.24. They are also designed to give more support to the wrists and hands when doing a lot of typing. ▲ Figure 3.24 Ergonomic The following diagram (Figure 3.25) and description summarises how the computer keyboard recognises a letter pressed on the keyboard: » T here is a membrane or circuit board at the base of the keys » In Figure 3.25, the ‘H’ key is pressed and this completes a circuit as shown » The CPU in the computer can then determine which key has been pressed » The CPU refers to an index file to identify which character the key press represents » Each character on a keyboard has a corresponding ASCII value (see Chapter 1). Letter ‘H’ has been GG J pressed and now makes contact with bottom H conductive laver Letter ‘H’ Conductive interpreted layers by computer Insulating layer ▲ Figure 3.25 Diagram of a keyboard Microphones Microphones are either built into the computer or are external devices connected through the USB port or using Bluetooth connectivity. Figure 3.26 shows how a microphone can convert sound waves into an electric current. The current produced is converted to a digital format so that a computer can process it or store it (on, for example, a CD). coil of wire wrapped cone around the cone sound waves output from permanent the microphone magnet diaphragm ▲ Figure 3.26 Diagram of how a microphone works 94 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 94 18/02/21 3:50 PM 3.2 Input and output devices » When sound is created, it causes the air to vibrate. » When a diaphragm in the microphone picks up the air vibrations, the diaphragm also begins to vibrate. » A copper coil is wrapped around the cone which is connected to the diaphragm. As the diaphragm vibrates, the cone moves in and out causing the copper coil to move backwards and forwards. » This forwards and backwards motion causes the coil to cut through the magnetic field around the permanent magnet, inducing an electric current. » The electric current is then either amplified or sent to a recording device. The electric current is analogue in nature. The electric current output from the microphone can also be sent to a computer where a sound card converts the current into a digital signal which can then be stored in the computer. The following diagram shows what happens when the word ‘hut’ is picked up by a microphone and is converted into digital values: 1000 0001 0001 1110 1000 1110 0001 1100 1100 1100 1101 1110 Sound wave for ‘HUT’ Digital value after conversion ▲ Figure 3.27 Analogue to digital conversion Look at Figure 3.27. The word ‘hut’ (in the form of a sound wave) has been picked up by the microphone; this is then converted using an analogue to digital converter (ADC) into digital values which can then be stored in a computer or manipulated as required using appropriate software. Optical mouse An optical mouse is an example of a pointing device. It uses tiny cameras to take 1500 images per second. Unlike an older mechanical mouse, the optical mouse can work on virtually any surface. A red LED is used in the base of the mouse and the red light is bounced off the surface and the reflection is picked up by a complementary metal oxide semiconductor (CMOS). The CMOS generates electric pulses to represent the reflected red light and these pulses are sent to a digital signal processor (DSP). The processor can now work out the coordinates of the mouse based on the changing image patterns as it is moved about on the surface. The computer can then move the on-screen cursor to the coordinates sent by the mouse. mouse body red light source CMOS (LED) lens lens surface ▲ Figure 3.28 Diagram of an optical mouse 95 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 95 18/02/21 3:50 PM 3 Hardware Benefits of an optical mouse over a mechanical mouse » There are no moving parts, therefore it is more reliable. » Dirt can’t get trapped in any of the mechanical components. » There is no need to have any special surfaces. Most optical mice use Bluetooth connectivity rather than using a USB wired connection. While this makes the mouse more versatile, a wired mouse has the following advantages: » no signal loss since there is a constant signal pathway (wire) » cheaper to operate (no need to buy new batteries or charge batteries) » fewer environmental issues (no need to dispose of old batteries). 2D and 3D scanners Scanners are either two dimensional (2D) or three dimensional (3D). 2D scanners These types of scanner are the most common form and are generally used to input hard copy (paper) documents. The image is converted into an electronic form that can be stored in a computer. A number of stages occur when scanning a document: The cover is first raised … then the document is placed on a glass panel … … and then the cover is closed. A bright light then illuminates the document – modern scanners use a type of xenon lamp or LED that produces a very bright white light. A scan head moves across the document until the whole page has been scanned. An image of the document is produced, which is then sent to a lens using a series of mirrors. The lens focuses the document image. The focused image now falls onto a charge couple device (CCD), which converts light into an electric current. Essentially the CCD is made up of thousands of light-sensitive elements (or pixels). Each element creates an electric charge when light falls on it. This means that the scanned image is now turned into an electronic form. Software produces a digital image from the electronic form. ▲ Figure 3.29 How a 2D scanner works 96 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 96 25/02/21 11:37 AM 3.2 Input and output devices Computers equipped with optical character recognition (OCR) software allow the scanned text from the document to be converted into a text file format. This means the scanned image can now be edited and manipulated by importing it into a word processor. If the original document was a photograph or image, then the scanned image forms an image file such as JPEG. 3D scanners 3D scanners scan solid objects and produce a three-dimensional image. Since solid objects have x, y and z coordinates, these scanners take images at several points along these three coordinates. A digital image which represents the solid object is formed. The scanned images can be used in computer aided design (CAD) or, more recently, sent to a 3D printer (see Section 3.2.2) to produce a working model of the scanned image. There are numerous technologies used in 3D scanners – lasers, magnetic resonance, white light, and so on. It is beyond the scope of this book to look at these in any great depth; however, the second application that follows describes the technology behind one form of 3D scanning. Application of 2D scanners at an airport 2D scanners are used at airports to read passports. They make use of OCR technology to produce digital images which represent the passport pages. Because of the OCR technology, these digital images can be manipulated in a number of ways. For example, the OCR software is able to review these images, select the text Link part, and then automatically put the text into the correct fields of an existing For more on ASCII, database. It is possible for the text to be stored in an ASCII format – it all please see Chapter 1. depends on how the data is to be used. At many airports the two-dimensional photograph in the passport is scanned and stored as a JPEG image. The passenger’s face is also photographed using a digital camera (a 2D image is taken so it can be matched to the image taken from the passport). The two digital images are compared using face recognition/detection software. Key parts of the face are compared. The face in Figure 3.30 shows several of the positions used by the face recognition software. Each position is checked when the software tries to compare two facial images. Data, such as: » distance between the eyes » width of the nose » shape of the cheek bones » length of the jaw line » shape of the eyebrows, are all used to uniquely identify a given face. When the image from the passport and the image taken by the camera are ▲ Figure 3.30 Face compared, these key positions on the face determine whether or not the two recognition images represent the same face. 97 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 97 18/02/21 3:50 PM 3 Hardware Application of 3D scanning – computed tomographic (CT) scanners Computed tomographic (CT) scanners are used to create a 3D image of a solid object. This is based on tomography technology, which basically builds up an image of the solid object through a series of very thin ‘slices’. Each of these 2D ‘slices’ make up a representation of the 3D solid object. Each slice is built up by use of X-rays, radio frequencies or gamma imaging; although a number of other methods exist. Each ‘slice’ is then stored as a digital image in the computer memory. The whole of the solid object is represented digitally in the computer memory. Depending on how the image is formed, this type of tomographic scanner can have different names. For example: Name CT Scanner MRI SPECT Stands for computerised magnetic resonance single photon emission tomography images computer tomography Uses X-rays radio frequencies gamma rays Here is a simple example of how tomography works: X-ray source solid object now shown as a series of solid ‘slices’ – each object ‘slice’ is stored as a digital image in the computer ▲ Figure 3.31 Tomography Touch screens Touch screens are now a very common form of input device. They allow simple touch selection from a menu to launch an application (app). Touch screens allow the user to carry out the same functions as they would with a pointing device, such as a mouse. There are three common types of touch screen technologies currently being used by mobile phone and tablet manufacturers. Similar technologies are used in other touch screen applications (for example, food selection at a fast food restaurant): » capacitive » infrared » resistive (most common method at the moment). Capacitive touch screens Capacitive touch screens are composed of a layer of glass (protective layer), a transparent electrode (conductive) layer and a glass substrate (see Figure 3.32). Since human skin is a conductor of electricity, when bare fingers (or a special stylus) touch the screen, the electrostatic field of the conductive layer is 98 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 98 18/02/21 3:50 PM 3.2 Input and output devices changed. The installed microcontroller is able to calculate where this change took place and hence determine the coordinates of the point of touching. protective layer conductive layer glass substrate ▲ Figure 3.32 Capacitive touch screen There are presently two main types of capacitive touch screens: » surface » projective. The two methods work in a slightly different way but they both have the same general structure as shown in Figure 3.32. With surface capacitive screens, sensors are placed at the corners of a screen. Small voltages are also applied at the corners of the screen creating an electric field. A finger touching the screen surface will draw current from each corner reducing the capacitance. A microcontroller measures the decrease in capacitance and hence determines the point where the finger touched the screen. This system only works with a bare finger or stylus. Projective capacitive screens work slightly differently to surface capacitive screens. The transparent conductive layer is now in the form of an X-Y matrix pattern. This creates a three dimensional (3D) electrostatic field. When a finger touches the screen, it disturbs the 3D electrostatic field allowing a microcontroller to determine the coordinates of the point of contact. This system works with bare fingers, stylus and thin surgical or cotton gloves. It also allows multi-touch facility (for example, pinching or sliding). Advantages compared to the other two technologies » Better image clarity than resistive screens, especially in strong sunlight » Very durable screens that have high scratch resistance » Projective capacitive screens allow multi-touch. Disadvantages compared to the other two technologies » Surface capacitive screens only work with bare fingers or a special stylus » They are sensitive to electromagnetic radiation (such as magnetic fields or microwaves). Infrared touch screens Infrared touch screens use a glass screen with an array of sensors and infrared transmitters. 99 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 99 18/02/21 3:50 PM 3 Hardware infrared infrared sensors transmitters are placed around cover the the edge of the screen in a screen to detect matrix pattern the infrared rays nfrared sensors are placed around the edge of the ▲ Figure 3.33 Array of infrared transmitters and sensors surrounding the screen screen to detect the infrared rays The sensors detect the infrared radiation. If any of the infrared beams are broken (for example, with a finger touching the screen), the infrared radiation reaching the sensors is reduced. The sensor readings are sent to a microcontroller that calculates where the screen was touched: Figure 3.34 Infrared screen ▲ touched causing sensors (shown in red) to show a reduction in infrared radiation – thus the exact position where the screen was touched can be calculated    Advantages compared to the other two technologies » Allows multi-touch facilities » Has good screen durability » The operability isn’t affected by a scratched or cracked screen. Disadvantages compared to the other two technologies » The screen can be sensitive to water or moisture » It is possible for accidental activation to take place if the infrared beams are disturbed in some way » Sometimes sensitive to light interference. Resistive touch screens Resistive touch screens are made up of two layers of electrically resistive material with a voltage applied across them. The upper layer is made of flexible polyethylene (a type of polymer) with a resistive coating on one side (see Figure 3.35). The bottom layer is made of glass also with a resistive coating (usually indium tin oxide) on one side. These two layers are separated by air or an inert gas (such as argon). When the top polyethylene surface is touched, the two layers make contact. Since both layers are coated in a resistive material a circuit is now completed which results in a flow of electricity. The point of contact is detected where there was a change in voltage. 100 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 100 18/02/21 3:50 PM 3.2 Input and output devices screen touched – two polyethylene layers come into contact layer (flexible) resistive coating spacers on top layer glass layer (bottom layer) resistive coating on bottom layer 'bumps' to stop insulation layer the plastic from sagging (air filled or inert gas) ▲ Figure 3.35 Resistive touch screen A microcontroller converts the voltage (created when the two resistive layers touch) to digital data, which it then sends to the microprocessor. Advantages compared to the other two technologies » Good resistance to dust and water » Can be used with bare fingers, stylus and gloved hand. Disadvantages compared to the other two technologies » Low touch sensitivity (sometimes have to press down harder) » Doesn’t support multi-touch facility » Poor visibility in strong sunlight » Vulnerable to scratches on the screen (made of polymer). 101 318281_C03_CAM_IGCSE CO_SCI_075_146.indd 101 18/02/21 3:50 PM

Use Quizgecko on...
Browser
Browser