Mechatronics Interfaces Electrical/Electronic Relays Relays have a wide range of applications in industry. Even with the advent of electronic controls such as programmable logic controllers and other solid state devices such as thyristors (solid state relays), the electromechanical relay still retains a high level of acceptance. One reason for this is that for simple types of control, relays offer a cost effective solution. They are available in a large range of configurations from small relays of only 10 mm in length with multiple contact pairs for data communications, to large relays called contactors for carrying heavy current loads in applications such as switching 3 phase motors. A relay has certain characteristics: Low maintenance Able to switch a number of independent circuit paths Easily adaptable to various operating voltages High operating speed, i.e. short switching times A small amount of energy applied on the relay coil can control a larger energy flow through the relay contacts. In the electropneumatic circuit, relays are generally used as signal processors. Rather than switch solenoids directly via limit switches and potentially overloading contacts, the relay contacts act as a buffer, carrying the larger amount of current. Another important function of the relay in circuitry is as a logic or interlocking device. Relay construction In practice there are many types of construction for the relay but the functional principle is the same. Fig. 1 Principle of relay operation Festo Didactic Mechatronics v1.0 4.2 Page 1 Mechatronics Interfaces Electrical/Electronic Operation Fig. 2 Relay When voltage is applied to the coil (5), an electric current flows through the winding; a magnetic field builds up and pulls the armature (3) against the core (7) of the coil. The armature is mechanically joined to a contact 1 and is pulled against the contact 4. This switching position is maintained as long as the voltage is applied. When the voltage is removed the armature is restored to its original position by a spring (6). In the initial position the contact 2 is active. In practice, symbols are used to represent relays in circuit drawing (refer Fig.3). K1 relay in this case operates four NO contacts. Fig. 3 Festo Didactic Mechatronics v1.0 Relay contact configuration 4.2 Page 2 Mechatronics Interfaces Electrical/Electronic contactor coil Symbol for a contactor large voltage small voltage K Motor, etc Fig. 4 Relays and contactors can allow a small control signal to switch a much larger power Relays/contactor switching a different circuit circuit. Electrical Interface Signals Because all interface devices either convert a physical signal or parameter into an electrical signal or convert an electrical signal into a physical signal or quantity, it is important to understand the different types of electrical & electronic signals that are used in control systems. These signal types are binary, digital & analogue. Generation of binary signals Computers and PLC's operate using binary or digital signals. By a binary signal, we understand a signal which recognises only two defined values or distinguishes between only two types of data. Festo Didactic Mechatronics v1.0 4.2 Page 3 Mechatronics Interfaces Electrical/Electronic Fig. 5 Binary signal These values are termed “0” or “1”, the terms “low” and “high” or “off” and “on” are also used. Binary signals can be generated simply and reliably. An example is signals that are output from contacting components. An actuated normally open contact corresponds to a logic 1-signal and an unactuated one to a logic 0-signal. When working with contactless components, this can give rise to certain tolerance bands. For this reason, certain voltage ranges have been defined as logic 0 or logic 1 ranges. Fig. 6 Festo Didactic Mechatronics v1.0 Voltage ranges 4.2 Page 4 Mechatronics Interfaces Electrical/Electronic IEC 1131-2 defines a value range of -3 V to 5 V as logic 0-signal, and 11 V to 30 V as logic 1-signal (for contactless sensors). This is binding for PLC's, whose device technology is to conform to IEC 1131-2. In current practice, however, other voltage ranges can often be found for logic 0- and 1-signal. Widely used are: -30 V to +5 V as logic 0, 13 V to 30 V as logic 1. Analogue signals An analogue signal is a signal generated by physical variables which change over a continuum. It is a continuous signal which varies in level. It is a type of signal where a specific signal is assigned to each value within a range of values. The signal always has a definite value. Fig. 7 Analogue signal Digital signals In the case of the analogue signal, a specific signal is allocated to each value in a range of values. This is not the case with the digital signal which can assume only a finite number of values. Every possible value is a whole number multiple of a specific basic unit. The precision of the display is, therefore, dependent on the value of the basic unit. Example: digital clock (clock with digital display): If this clock were designed for the display of hours only, the number of possible values would be 1 to 12 (24) and the basic unit 1 hour. All intermediate positions between two full hours would not be displayed. Festo Didactic Mechatronics v1.0 4.2 Page 5 Mechatronics Interfaces Electrical/Electronic Fig. 8 Digital signal All analogue signals need to be converted into digital quantities so that they may be understood by a CPU. Provided care is taken over matching voltage and power levels, digital sensors or transducers are connected directly to input ports of a controller as either current sourcing (PNP) or sinking (NPN) devices. Interfacing Analogue and Digital devices PLC’s are digital devices. To handle analogue signals special interfaces based on analogue to digital (A/D) converters, digital to analog (D/A) converters, multiplexers and de-multiplexers are required. Digital to Analogue converter The digital to analogue converter (DAC) produces an analogue output from a digital input. In all types of DAC, the analogue voltage is produced from a reference voltage (Vref). Binary code is input into the DAC and determines what fraction of Vref is presented at the output. (NB: Binary coded decimal is explained at end of chapter) The output from a DAC is not truly continuous but rather a series of discrete voltage levels. Festo Didactic Mechatronics v1.0 4.2 Page 6 Mechatronics Interfaces Electrical/Electronic Fig. 9 Eight bit digital-analogue converter (DAC) The output from a DAC is not truly continuous but rather a series of discrete voltage levels. Fig. 10 Digital to analogue conversion For example, the 8-bit DAC shown in Fig. 5 has an output given as B 7 B 6 B5 B 4 B 3 B 2 B1 B 0 Vout = Vref 2 4 8 16 32 64 128 256 Eqn. 1 where the bits B7 to B0 can take values 0 or 1 and are the binary inputs. B7 is the most significant bit (MSB) and B0 the least significant bit (LSB). Festo Didactic Mechatronics v1.0 4.2 Page 7 Mechatronics Interfaces Electrical/Electronic Consider an 8-bit DAC with a reference voltage Vref of 10 V. The binary input of 00000001 generates the smallest discrete output, i.e. 10/256 volts. The next discrete output is 10/128 volts, generated from the binary code 00000010. Clearly 256 discrete analogue levels (referred to as quantisation levels) can be produced from the binary input. The voltage resolution of an N-bit DAC is calculated by dividing the maximum operating voltage by 2N-1. The factor 2N-1 represents the number of steps between quantisation levels. An 8-bit DAC with a reference voltage of 10 V has a resolution of 10/255. The speed of a DAC is determined by how long it takes to settle to a stable value after a change in input. This is specified as the settling time. The other main parameters of a DAC are linearity and accuracy. Linearity is a measure of the deviation from a straight line of output voltage plotted against binary input. Accuracy is the variation between voltage plotted against binary input. Accuracy is the variation between the DAC’s actual output and the intended one. The operating principle of a DAC is illustrated in Fig. 11. DACs use a set of binary weighted resistors switched by the binary input to generate an analogue output from Vref. The highest weighted resistor generates the smallest discrete value at the analogue output. Fig. 11 Festo Didactic Mechatronics v1.0 Operating principle of a digital to analogue converter 4.2 Page 8 Mechatronics Interfaces Electrical/Electronic Analogue to digital converter The analogue to digital converter (ADC) produces a digital output from an analogue input (see Fig. 12). ADCs incorporate start convert (SC) and end of convert (EOC) connections. When the start convert signal is pulsed the ADC converts the analogue input at that time into an equivalent digital value. The ADC then produces an end of convert signal to indicate that the conversion has finished. Fig. 12 Eight-bit analogue to digital converter The simplest type of ADC makes use of a DAC and a comparator as shown in Fig. 13. Digital data from a counter is fed into the DAC and generates an analogue voltage which is compared with the incoming analogue voltage which is to be converted. When both signals match, the comparator amplifier generates a logic 1 to indicate that conversion has finished (i.e. the end of convert signal). The digital value input to the DAC at that time represents the analogue input. Fig. 13 Operating principle of a comparator type ADC Festo Didactic Mechatronics v1.0 4.2 Page 9 Mechatronics Interfaces Electrical/Electronic The main parameters of ADCs are again resolution, accuracy, linearity and speed. The comments already made concerning resolution, accuracy and linearity of DACs apply to ADCs. Note that for an 8-bit ADC equation (Eqn. 1) works in reverse. Concerning operating speed, ADCs are generally slower than DACs because the process involves comparing one signal with another. Successive approximation of the input value rather than ramping the DAC from a counter speeds up the conversion process. For high speed, so called ‘flash’ converters are used. Multiplexer A multiplexer allows several signal carrying channels to share a single line. A block diagram of a multiplexer is illustrated in Fig. 14. This shows that each input channel may be connected to the output line when one of a bank of switches inside the multiplexer is turned on. In practice the bank of switches shown in Fig. 14 is a bank of transistors. Fig. 14 Multiplexer Switches controlled by the lines A, B and C. A binary code placed on the lines labelled A, B and C determines which of the channels is switched through to the output. De-multiplexers are multiplexers that work in reverse. Festo Didactic Mechatronics v1.0 4.2 Page 10 Mechatronics Interfaces Electrical/Electronic Interfacing The general rule when interfacing analogue signals is to match voltage levels and ensure that the impedance of the sourcing circuit is less than or equal to that of its load circuit. Impedance matching is essential for the optimum power transfer to the load circuit. To match voltage levels you may have to reduce or amplify a voltage level. When doing so, it is important to ensure that the signal amplifier amplifies the signal in a reliable manner, i.e. that it does not deform or distort the signal. Fig. 15 shows a signal amplified by a factor of 1000. Fig. 15 Amplification of a signal Analogue Transducers Physical (analogue) quantities such as : displacement velocity acceleration force pressure temperature flow strain Festo Didactic Mechatronics v1.0 4.2 Page 11 Mechatronics Interfaces Electrical/Electronic are converted into analogue voltage or current by transducers. Some common types of transducers are: potentiometer LVDT strain gauges displacement capacitors tachometers accelerometers encoders flow meters thermocouples RTD (resistance temperature detector) Piezo - electric transducers Potentiometer The simplest way of producing an analogue input to an ADC is to use a potentiometer circuit such as that shown in Fig. 16. The position of the wiper terminal of the potentiometer is converted into a voltage signal. Linear and rotary potentiometers may be used as low-cost position transducers. Fig. 16 Festo Didactic Mechatronics v1.0 Principle of Potentiometers 4.2 Page 12 Mechatronics Interfaces Electrical/Electronic Linear relationship between shaft position and signal output. e.g. (input voltage at AB) and if wiper contact is at the centre - half applied voltage at output AC at extreme left - zero voltage at output AC at extreme right - full voltage at output AC Same principle apply to the angular displacement potentiometer but in terms of varying angle of displacement. LVDT (Linear Variable Differential Transformer) The linear variable differential transformer of LVDT is a displacement transducer. It consists of nickel-iron rod which is free to move through primary and secondary coils. The basic arrangement is illustrated in Fig. 17. Fig. 17 Basic arrangement of linear variable differential transformer (LVDT) Festo Didactic Mechatronics v1.0 4.2 Page 13 Mechatronics Interfaces Electrical/Electronic The primary coil is fed alternating current so that voltages are induced in the two halves of the secondary coil. Moving the rod back and forth changes the phase and voltage in the secondary windings. The output voltage versus core displacement characteristic in Fig. 18 shows that the phase of the output (secondary winding) relative to the input (primary winding) changes by 180 degrees as the core is moved through the central position. Consequently, a phase detector is used if a unique output is required for each core position. Fig. 18 Linear variable differential transformer (LVDT) output phase and voltage core position LVDT's have higher potentiometers. Festo Didactic Mechatronics v1.0 accuracy and reliability compared 4.2 Page 14 to Mechatronics Interfaces Electrical/Electronic Thermocouples A thermocouple consists of two dissimilar wires which are arranged as shown in Fig. 15. Voltage is produced by thermoelectric effects as the hot junction is heated. Thermocouple types which conform to British standards are designated letters. These letters determine the metals used in the thermocouple junction (see Fig. 19). Fig 19 Type E J K T Fig. 20 Diagrammatic representation of a thermocouple Metal A/Metal B Chromel/constantan Iron/constantan Chromel/alumel Copper/constantan Thermocouple and designation Thermocouples are non-linear devices which means that their output voltage is not proportional to temperature. Indeed, a thermocouple will by supplied with a calibration table which must always be referred to when converting an output voltage into temperature. The voltage produced by a thermocouple needs to be amplified before it can be fed into an ADC unit. Festo Didactic Mechatronics v1.0 4.2 Page 15 Mechatronics Interfaces Electrical/Electronic Strain gauge A strain gauge is a device which changes resistance when stretched or compressed. The relationship between the change in resistance (R/R) and corresponding change in strain (i.e. length change (L/L) is given as G R / R L / L Eqn. 2 where G is called the gauge factor. The gauge factor G is about 2 for metal alloy strain gauges and about 100 for semiconductor strain gauges. Although it is possible to measure the strain directly using equation (Eqn. 2), it is normal practice to use a balancing bridge circuit of the type shown in Fig. 21. The analogue output of the bridge is nulled using the variable resistance RV when no strain is applied to the gauge. When the gauge is strained a voltage in the bridge circuit is observed because the bridge is no longer balanced. This voltage is usually amplified and fed back into an ADC so that it may be compared with a calibrated value. Because of their large gauge factor, semiconductor strain gauges produce much larger signals compared with metal types. However, they are more sensitive to temperature variation. Fig. 21 Festo Didactic Mechatronics v1.0 Strain gauge bridge 4.2 Page 16 Mechatronics Interfaces Electrical/Electronic The decimal number system Characteristic of the decimal number system used in general is the linear array of digits and their significant place. The number 4344, for instance, can be represented as follows: 4344 = 4 x 1000 + 3 x 100 + 4 x 10 + 4 x 1 Number 4 on the far left is of differing significance to that of number 4 on the far right. The basis of the decimal number system is the availability of 10 different digits (decimal: originating from the Latin ‘decem’ = 10). These 10 different digits permit counting from 0 to 9. If counting is to exceed the number 9, this constitutes a carry over to the next place digit. The significance of this place is 10, and the next carry over takes place when 99 is reached. The number 71,718,711 is to be used as an example: 107 106 105 104 103 102 101 100 7 1 7 1 8 7 1 1 As can be seen from the above, the significance of the “7” on the far left is 70,000,000 = 70 million, whereas the significance of the “7” in the third place from the right is 700. The digit on the far right is referred to as the least significant digit, and the digit on the far left as the most significant digit. Any number system can be configured on the basis of this example, the fundamental structure can be applied to number systems of any number of digits. Consequently, any computing operations and computing methods which use the decimal number system can be applied with other number systems. The binary number system We are indebted to Leibnitz, who applied the structures of the decimal number system to two-digit calculation. As long ago as 1679, this created the premises essential for the development of the computer, since electrical voltage or electrical current only permits a calculation using just two values: e.g. “current on”, “current off”. These two values are represented in the form of digits: “1” and “0”. If one were to be limited to exactly 2 digits per place of a number, then a number system would be configured as follows: Festo Didactic Mechatronics v1.0 4.2 Page 17 Mechatronics Interfaces Electrical/Electronic 27=128 26=64 1 0 25=32 24=16 1 1 23=8 22=4 21=2 20=0 0 0 0 1 The principle is exactly the same as that of the method used to create a decimal number. However, only two digits are available, which is why the significant place is not calculated to the base 10x, but to the base 2x. Hence the lowest significant number on the far right is 20 = 1, and of the next place 21 = 2 etc. Because of the exclusive use of two digits, this number system is known as the binary or also the dual number system. Up to a maximum of 28 - 1 = 256 - 1 = 255 can be calculated with eight places, which would be the number 1111 11112. The individual places of the binary number system can adopt one of the two digits 0 or 1. This smallest possible unit of the binary system is termed 1 bit. In the above example, a number consisting of 8 bits, i.e. one byte, has been configured (in a computer using 8 electrical signals representing either “voltage available “ or “voltage not available” or “current on” or “current off”.) The number considered, 1011 00012, assumes the decimal value 17710. 1 x 27 = 128 0 x 26 1 x 25 + 32 1 x 24 + 16 0 x 23 0 x 22 0 x 21 1 x 20 +1 = 177 Example The BCD code For people used to dealing with the decimal system, binary numbers are difficult to read. For this reason, a more easily readable numeral representation was introduced, i.e. the binary coded decimal notation, the so-called BCD code (binary coded decimal). With this BCD code, each individual digit of the decimal number system is represented by a corresponding binary number: Festo Didactic Mechatronics v1.0 4.2 Page 18 Mechatronics Interfaces Electrical/Electronic Table 1 010 0000BCD 110 0001BCD 210 0010BCD 310 0011BCD 410 0100BCD 510 0101BCD 610 0110BCD 710 0111BCD 810 1000BCD 910 1001BCD Representation of decimal numbers in BCD code 4 digits in binary notation are therefore required for the 10 digits in the decimal system. The discarded place (in binary notation, the numbers 0 to 15 may be represented with 4 digits) is accepted for the sake of clarity. The decimal number 7133 is thus represented as follows in the BCD code: 0111 0001 0011 0011BCD 16 bits are therefore required to represent a four digit decimal number in the BCD code. BCD coded numbers are often used for seven segment displays and coding switches. The hexadecimal number system The use of binary numbers is often difficult for the uninitiated and the use of the BCD code takes up a lot of space. This is why the octal and the hexadecimal system were developed. Three digits are always combined in the case of the octal number system. This permits counting from 0 to 7, i.e. counting in “eights”. Alternatively, 4 bits are combined with the hexadecimal number system. 4 bits permit the representation of the number 0 to 15, i.e. counting in “sixteens”. The digits 0 to 9 are used to represent these numbers in digits, followed by the letters A, B, C, D, E and F where A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. The significant place of the individual digits is to the base 16. Festo Didactic Mechatronics v1.0 4.2 Page 19 Mechatronics Interfaces Electrical/Electronic 163=4096 162=256 161=16 160=1 8 7 B C Example The number 87BC16 given as an example therefore reads as follows: 8 x 163 + 7 x 162 + 11 x 161 + 12 x 160 + 34 74810 Signed binary number Up to now, we have dealt solely with whole positive numbers, not taking into account negative numbers. To enable working with these negative numbers, it was decided that the most significant bit on the far left of a binary number is to be used to represent the preceding sign: “0” thus corresponds to “+” and “1” corresponds to “-“. Hence 1111 11112 = -12710 and 0111 11112 = +12810 Since the most significant bit has been used, one bit less is available for the representation of a signed number. The following range of values is obtained for the representation of a 16 digit binary number: Table 2 Integer Range of values unsigned 0 to 65535 signed -32768 to +32767 Range of values for binary numbers Real number Although it is now possible for whole positive and whole signed numbers to be represented with 0 or 1, there is still the need for points or real numbers. In order to represent a real number in computer binary notation, the number is split into two groups, a power of ten and a multiplication factor. This is also known as the scientific representation of digits. The number 27.3341 is thus converted into 273 342 x 10-4. Two whole signed numbers are therefore required for a real number to be represented in a computer. Festo Didactic Mechatronics v1.0 4.2 Page 20