Wa0004

Download as pdf or txt
Download as pdf or txt
You are on page 1of 139

1.

8051 MICROCONTROLLERS
Introduction;
This is a computer implemented on a Very Large – Scale Integration (VLSI) chip. A microcontroller contains everything a
microprocessor contains and plus more.
8051 PROGRAMMING;
Definition of terms;
(i) Algorithm;
This is a step – by – step specification of a given problem. It must terminate in a finite number of steps.
(ii) Programming;
This is the conversion of algorithm into a sequence of instructions that can be understood by the micro – controller
(machine language)
(iii) Machine code language;
This is a programming language that the microcontroller can understand directly without translation.
(iv) Assembly language;
This is the programming language in which the programmer can use mnemonic instruction code (abbreviated words and
labels) to refer directly to their binary equivalent e.g., MOV A 30 H, MOV A, R 0 , MOV A, @ R 0 etc.
Assembly language is a low – level language.
(v) Assembler;
This a program that converts assembly language program into machine language i.e., it converts the mnemonics into
binary codes.
Flow – chart;
During programming process, it is sometimes necessary to formulate flow charts. A flow chart is a diagrammatic method
of solving problems.
It is a useful aid to planning the sequence of events in a microcontroller program. Unless a program is relatively simple, a
flow chart is a necessary tool to all programs.
A number of standard symbols are used in connection with flow charts.

1|Page
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Instruction syntax;
General syntax for 8051 assembly language is as follows;
𝐿𝐴𝐵𝐸𝐿 ∶ 𝑂𝑃𝐶𝑂𝐷𝐸 𝑂𝑃𝐸𝑅𝐴𝑁𝐷 ; 𝐶𝑂𝑀𝑀𝐸𝑁𝑇
(i) Label;
This is a symbolic address for the instruction. When the program is assembled, the label will be given specific address in
which that instruction is stored.
(ii) Opcode;
This is the symbolic representation of the operation (mnemonics). The assembler converts the opcode to a unique
binary code (machine language)
(iii) Operand;
It specifies where to perform the opcode action. The operand field generally contains the source and destination of
data.
In some cases, only source or destination will be available instead of both. Operand will either be address of data or the
data itself.

2|Page
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(iv) Comment.
Always comment will begin with ; or // symbol.
To improve the program quality, the programmer may always use comments in the program.
ADDRESSING MODES;
Addressing modes refers to ways in which an operand (data / address) can be given.
The following are some common addressing modes with 8051 microcontrollers
(i) Immediate Addressing;
(ii) Direct Addressing;
(iii) Register Addressing;
(iv) Register Indirect Addressing;
(v) Indexed (Base register plus indexed register) addressing.
(i) Immediate Addressing mode;
In this addressing mode, the source operand is the data (constant) i.e., data immediately follows the instruction
(opcode).

Example;

(I) MOV A, # 30 H; (A) ← (30 H)


This instruction loads the data 30 H into the Accumulator
(II) MOV R 4 , # 62 ; (R 4 ) ← (62DEC )
This instruction loads the decimal number 62 into register R 4 of the selected register bank.
(III) MOV B, # 40 H; (B) ← 40 H
This instruction loads the data 40 H into register B;
(IV) MOV DPTR , # 4521 H; (DPTR) ← (4521 H)
Though the DPTR is a 16 – bit register, it can also be accessed as two 8 – bit registers, DPH and DPL, where DPH is the
high byte and DPL is the low byte. Thus; MOV DPTR , # 4521 H; implies;
(DPL) ← (21 H)
(DPH) ← (45 H)
(II) Direct Addressing mode;
In this mode, an 8 – bit internal data memory address is specified as part of the instruction i.e., the RAM address most
often used are from 30 H to 7F H.
The mode also specifies Special Function Registers (SFRs) addresses as part of the instruction where data can be
obtained.
Example;

3|Page
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(I) MOV R 0 , 40 H; (R 0 ) ← (40 H)
The contents of memory location whose address is 40 H is copied to register R 0 of the selected register bank.
(II) MOV 7A H, A; (7A H) ← (A)
The content of the Accumulator (A) is copied to the memory location whose address is 7A H
1. DATA TRANSFER INSTRUCTIONS:
PUSH AND POP INSTRUCTIONS;
The stack refers to an area of the internal RAM that is used in conjunction with certain op – code to store and retrieve
data quickly.
The stack pointer (SP), is an 8 – bit register used by the 8051 – microcontroller to hold stack address called top of stack.
The stack pointer is set to 07 H when the 8051 microcontroller is reset.
In PUSH and POP operations, it is implied that the stack pointer (SP) holds the indirect address.
(i) PUSH Direct instruction;
The PUSH instruction increments the stack pointer by 1 and copies data from the source address (specified in the PUSH
instruction) to the internal RAM location addressed by the stack pointer (SP)
Before copy operation, since SP is incremented, the data is stored from low addresses to high addresses in the internal
RAM.
As data is pushed, the stack grows up in internal RAM.
The top of the internal RAM is at 7F H. Thus, if keep on PUSHing the data on to the stack after 7F H, the data is lost.
Example; PUSH B;
This instruction increments the stack pointer by 1 and stores the content of register B to the internal RAM location
addressed by the stack pointer (SP)
(ii) POP Direct instruction;
This instruction copies the contents of the internal RAM location addressed by the stack pointer to the destination
address (specified in the POP instruction).
The stack pointer is decremented by 1.
Example; POP ACCUMULATOR;
This instruction copies the content of the internal RAM location addressed by the stack pointer to the accumulator.
The stack pointer (SP) is decremented by 1.
Important points to remember during PUSH and POP;
(i) When the SP contents becomes FF H, for the next PUSH, the SP rolls over 00 H.
(ii) The top of the internal RAM, i.e., its end address is 7F H. Thus, next PUSH instruction after 7F H results in error.
(iii) Generally, the SP is set at above the register banks.

4|Page
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(iv) When PUSH and POP operations are used for the register from the register banks (bank 0 – bank 3), specify
direct addresses within the instruction. Do not use register name from register bank since the register name
does not specify the bank in use.
DATA EXCHANGE INSTRUCTIONS;
These instructions move data from source address to destination address and vice versa.
(i) XCH A, R n ; (A) ⇋ (R n )
Example; XCH A, R 0 ;
This instruction exchanges the content of the accumulator with the content of the specified register (R 0 ) of the selected
register bank.
(ii) XCH A, Direct ; (A) ⇋ (Direct)
Example; XCH A, 20 H;
This instruction exchanges the content of the accumulator with the content of the memory location whose address is
given within the instruction (20 H).
(iii) XCH A, @ R I ; (A) ⇋ (R i )
Example; XCH A, @ R 2;
This instruction exchanges the contents of the accumulator with the contents of memory location whose address is
given by the content of the specified register (R 2 ) of the selected register bank.
(iv) XCHD A, @ R I ; (A3−0 ) ⇋ (R i 3−0 )
Example; XCHD A, @ R 0 ;
This instruction exchanges the low – order nibble of the Accumulator (bits 3 – 0), generally representing a hexadecimal
or BCD digit with that of the internal RAM location indirectly addressed by the specified register (R 0 ).
The high – order nibbles (bits 7 – 4) of each register are not affected.
Important points to remember in Exchange Instructions;
(i) All exchanges involve the register A.
(ii) All exchanges take place internally within 8051.
(iii) When XCHD A, @ R I instruction is executed, the upper nibble of A and the upper nibble of the address in R I do
not change.
(iv) Immediate addressing mode cannot be used in the exchange instructions.
2. LOGICAL OPERATION;
The main application of 8051 microcontroller is that of machine control. A large part of machine controls, making
decisions based on the switch states, and then turning external circuits ON or OFF is based on Boolean operators. These
operations are termed as Logical operations.

5|Page
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(a) Byte Level Logical Operations;
(i) Logical AND operation; 𝐀𝐍𝐋 𝐃𝐞𝐬𝐭𝐢𝐧𝐚𝐭𝐢𝐨𝐧, 𝐒𝐨𝐮𝐫𝐜𝐞;
This instruction performs logical – AND bitwise on the two operands and place the result in destination (Normally the
destination is Accumulator).
The source operand can be a register, location in memory or immediate data. This will allow six addressing mode
combination.
Both the source and the destination values are of single byte size.
(I) ANL A, R n (A) ⟵ (A) ∧ (R n ) – Register Addressing mode (1 byte);
Example; ANL A, R 2 ;
This instruction will logically AND operation between the content of the Accumulator (A) and register R n (R 2 ) of the
selected register bank.
The result is stored in the Accumulator.
(II) ANL A, Direct (A) ⟵ (A) ∧ (Direct) – Direct Addressing mode (2 byte);
Example; ANL A, 50 H;
This instruction logically ANDs bitwise the contents of the Accumulator with the contents of the memory location
specified in the instruction (e.g., 50 H).
The result is stored in the Accumulator.
(III) ANL A, @R I (A) ⟵ (A) ∧ ((R I )) – Register Indirect Addressing mode (1 byte);
Example; ANL A, @R1
The instruction logically ANDs bitwise the contents of the Accumulator with the contents of memory location pointed by
register R I (R1 ) of the selected register bank.
(IV) ANL Direct, A (A) ⟵ (Direct) ∧ (A) – Direct Addressing mode (2 byte);
Example; ANL 30 H, A;
This instruction logically ANDs bitwise the contents of the memory location specified in the instruction (e.g., 30 H) with
the contents of the Accumulator.
The result is stored in the Accumulator.
(V) ANL A, Data (A) ⟵ (A) ∧ (Data) – Immediate Addressing mode (2 byte);
Example; ANL A, 57 H;
This instruction logically ANDs bitwise the contents of the Accumulator with the immediate data specified in the
instruction e.g., 57 H.
The result is stored in the Accumulator.
(VI) ANL Direct, Data (A) ⟵ (Direct) ∧ (Data) – Immediate/Direct Addressing mode (3 byte);

6|Page
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Example; ANL 54 H, 33 H;
This instruction logically ANDs bitwise the contents of the memory location specified in the instruction (e.g., 54 H) with
the immediate data specified in the instruction (e.g., 33 H).
The result is stored in the memory location whose address is specified in the instruction.
(ii) Logical OR Operation; ORL Destination, Source;
This instruction performs a logical OR on the two operands and place the result in the destination.
The destination is normally the Accumulator.
The source operand can be a register, any location in memory or immediate data. This will allow six addressing mode
combination.
Both the source and the destination values are of single byte size.
(I) ORL A, R n (A) ⟵ (A) ∨ (R n ) – Register Addressing mode (1 byte);
Example; ORL A, R 5 ;
This instruction will logically OR operation between the content of the Accumulator (A) and register R n (e. g. , R 5 ) of the
selected register bank.
The result is stored in the Accumulator.
(II) ORL A, Direct (A) ⟵ (A) ∨ (Direct) – Direct Addressing mode (2 byte);
Example; ORL A, 50 H;
This instruction logically ORs bitwise the contents of the Accumulator with the contents of the memory location
specified in the instruction (e.g., 50 H).
The result is stored in the Accumulator.
(III) ORL A, @R I (A) ⟵ (A) ∨ ((R I )) – Register Indirect Addressing mode (1 byte);
Example; ORL A, @R1
The instruction logically ORs bitwise the contents of the Accumulator with the contents of memory location pointed by
register R I (e. g. , R1 ) of the selected register bank.
(IV) ORL Direct, A (A) ⟵ (Direct) ∨ (A) – Direct Addressing mode (2 byte);
Example; ORL 30 H, A;
This instruction logically ORs bitwise the contents of the memory location specified in the instruction (e.g., 30 H) with
the contents of the Accumulator.
The result is stored in the Accumulator.
(V) ORL A, Data (A) ⟵ (A) ∨ (Data) – Immediate Addressing mode (2 byte);
Example; ORL A, 57 H;

7|Page
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
This instruction logically ORs bitwise the contents of the Accumulator with the immediate data specified in the
instruction e.g., 57 H.
The result is stored in the Accumulator.
(VI) ORL Direct, Data (A) ⟵ (Direct) ∨ (Data) – Immediate/Direct Addressing mode (3 byte);
Example; ORL 54 H, 33 H;
This instruction logically ORs bitwise the contents of the memory location specified in the instruction (e.g., 54 H) with
the immediate data specified in the instruction (e.g., 33 H).
The result is stored in the memory location whose address is specified in the instruction.
(iii) Logical X – OR Operation; XRL Destination, Source;
This instruction performs a logical X – OR on the two operands and place the result in the destination.
The destination is normally the Accumulator.
The source operand can be a register, any location in memory or immediate data. This will allow six addressing mode
combination.
Both the source and the destination values are of single byte size.
(I) XRL A, R n (A) ⟵ (A) ⊕ (A) – Register Addressing mode (1 byte);
Example; XRL A, R 5 ;
This instruction will logically X – OR operation between the content of the Accumulator (A) and register R n (e. g. , R 5 ) of
the selected register bank.
The result is stored in the Accumulator.
(II) XRL A, Direct (A) ⟵ (A) ⨁(Direct) – Direct Addressing mode (2 byte);
Example; XRL A, 50 H;
This instruction logically X – ORs bitwise the contents of the Accumulator with the contents of the memory location
specified in the instruction (e.g., 50 H).
The result is stored in the Accumulator.
(III) XRL A, @R I (A) ⟵ (A) ⨁((R I )) – Register Indirect Addressing mode (1 byte);
Example; XRL A, @R1
The instruction logically X – ORs bitwise the contents of the Accumulator with the contents of memory location pointed
by register R I (e. g. , R1 ) of the selected register bank.
(IV) XRL Direct, A (A) ⟵ (Direct) ⨁(A) – Direct Addressing mode (2 byte);
Example; XRL 30 H, A;
This instruction logically X – ORs bitwise the contents of the memory location specified in the instruction (e.g., 30 H) with
the contents of the Accumulator.

8|Page
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
The result is stored in the Accumulator.
(V) XRL A, Data (A) ⟵ (A) ⨁(Data) – Immediate Addressing mode (2 byte);
Example; XRL A, 57 H;
This instruction logically X – ORs bitwise the contents of the Accumulator with the immediate data specified in the
instruction e.g., 57 H.
The result is stored in the Accumulator.
(VI) XRL Direct, Data (A) ⟵ (Direct) ⨁(Data) – Immediate Addressing mode (3 byte);
Example; XRL 54 H, 33 H;
This instruction logically X – ORs bitwise the contents of the memory location specified in the instruction (e.g., 54 H) with
the immediate data specified in the instruction (e.g., 33 H).
The result is stored in the memory location whose address is specified in the instruction.
(iv) Clear Accumulator 𝐂𝐋𝐑 𝐀 - Register Addressing mode (1 byte);
This instruction clears the accumulator i.e., all bits set on zero. No flags are affected.
Example; CLR A;
Assume A = 77H after execution of the instruction CLR A, the Accumulator becomes A = 00H
(v) Complement Accumulator 𝐂𝐋𝐏 𝐀 ̅ ) – Register Addressing mode (1 byte)
(𝐀) ← (𝐀
This instruction logically complements all the bits of the Accumulator i.e., one’s complement. No flags are affected.
Example; CLP A ;
Assume A = 77H (01110111)2, after execution of the instruction CLP A, Accumulator becomes A =
80H (10001000)2.
(vi) Rotate and Swap instructions;
(I) RL A Rotate Accumulator Left – Register Addressing mode (1 byte);
The eight bits in the Accumulator are rotated one bit to the left.

(II) RLC A Rotate Accumulator Left through Carry – Register Addressing mode (1 byte)

9|Page
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
This instruction rotates the eight bits in the Accumulator and the carry flag together by one bit to the left.
(III) RR A Rotate Accumulator Right – Register Addressing mode (1 byte);
The eight bits in the Accumulator are rotated one bit to the right.

(IV) RRC A Rotate Accumulator Right through Carry – Register Addressing mode (1 byte);

This instruction rotates the eight bits in the Accumulator and the carry flag together by one bit to the right.
(V) Swap A (𝐴3−0 ) ⇋ (𝐴7−4 ) −Register Addressing Mode
This instruction interchanges the lower – order and higher – order nibbles of the Accumulator as shown;

Example;
Assume; Accumulator (A) = 5D H;

10 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
After executing Swap A;
Accumulator (A) = D5 H
(b) Bit Level Logical Operation;
3. ARITHMETIC OPERATIONS;
These instructions include increment, decrement, addition, subtraction, multiplication, division and decimal operations.
(i) Increment and Decrement Instructions;
(a) Increment Instructions; 𝐈𝐍𝐂 (𝐛𝐲𝐭𝐞)
Implies; (byte) ⟵ (byte + 1)
These instructions will increment the indicated variable by 1. If an original byte value is FF H and if it is incremented,
then the result will overflow to 00 H.
These instruction supports three addressing modes i.e., Register, Direct and Register indirect addressing modes.
(I) INC R n ; Register Addressing Mode – 1 byte;
(R n ) ⟵ (R n ) + 1
This instruction will increment by 1 the content of register (R n ) of the selected register bank.
(II) INC (Direct) ; Direct Addressing Mode – byte;
(Direct) ⟵ (Direct) + 1
This instruction increments the contents of memory location whose address is specified in the instruction by 1.
Example; INC 40 H;
Assume the content of memory location 40 H = 24 H;
After execution of INC 40 H, Memory location 40 H = 25 H
(III) INC @ R I ; Indirect Addressing Mode – 1 byte;
((R i )) ⟵ ((R i )) + 1
This instruction will increment the content of memory location pointed by register R I by 1.
Example; INC @ R1
Assume contents of R1 = 45 H and the contents of memory location 45 H = 5F H.
After execution of INC @ R1, the content of memory location pointed by R1 i.e., 45 H = 60 H
(IV) INC DPTR; Register Addressing Mode – 1 byte;
(DPTR) ⟵ (DPTR) + 1
This instruction increments the content of the Data Pointer Register by 1. A 16 – bit increment is performed an overflow
of the Data Pointer (DPL) from FF H to 00 H will increment the high order byte (DPH).
DPTR is the only 16 – bit register that is incremented.
(b) Decrement Instructions; 𝐃𝐄𝐂 (𝐛𝐲𝐭𝐞)
Implies (byte) ⟵ (byte − 1)
11 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
These instructions will decrement the indicated variable by 1. If an original byte value is 00 H and if it is decremented,
then the result will underflow to FF H.
These instruction supports three addressing modes i.e., Register, Direct and Register indirect addressing modes.
(I) DEC R n ; Register Addressing Mode – 1 byte;
(R n ) ⟵ (R n ) − 1
This instruction will decrement by 1 the content of register (R n ) of the selected register bank.
The registers can be any of the registers R 0 − R 7 of the selected register bank or the Accumulator
(II) DEC (Direct) ; Direct Addressing Mode – byte;
(Direct) ⟵ (Direct) − 1
This instruction decrements the contents of memory location whose address is specified in the instruction by 1.
Example; DEC 40 H;
Assume the content of memory location 40 H = 24 H;
After execution of DEC 40 H, Memory location 40 H = 23 H
(III) DEC @ R I ; Indirect Addressing Mode – 1 byte;
((R i )) ⟵ ((R i )) − 1
This instruction will decrement the content of memory location pointed by register R I by 1.
Example; DEC @ R1;
Assume contents of R1 = 45 H and the contents of memory location 45 H = 5F H.
After execution of DEC @ R1, the content of memory location pointed by R1 i.e., 45 H = 5E H
(c) Addition Instructions;
The 8051 supports two addition instructions: ADD and ADDC. The ADD instruction adds a byte variable with the
Accumulator, leaving the result in the Accumulator.
The carry flag is set if there is an overflow from bit 7.
The ADDC instructions adds the previous contents of the carry flag with the two – byte variables.
(i) ADD Instructions;
(I) ADD A, R n ; Register Addressing Mode – 1 byte;
(A) ⟵ (A) + (R n )
This instruction adds the 8 – bit data in register R n of the selected register bank to the content of the Accumulator. The
result is stored in the Accumulator.
▪ Carry flag is set if there is carry – out from bit 7
▪ Auxiliary carry flag is set if there is carry – out from bit 3
▪ The overflow flag is set if there is a carry out of bit 6, but not out of bit 7 or a carry out of bit 7 but not from bit
6.
12 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Example; ADD A, R 0;
(II) ADD A, Direct; Direct Addressing Mode – 2 bytes;
(A) ⟵ (A) + (Direct)
This instruction adds the contents of memory location whose address is specified in the instruction to the contents of
the Accumulator. The result stored in the Accumulator.
The flags are set as in the above instruction i.e., (I).
Example; ADD A, 20 H;
(III) ADD A, @ R I ; Register Indirect Addressing Mode – 1 byte;
(A) ⟵ (A) + ((R i ))
This instruction will add the contents of the memory location whose address is pointed by register R I of the selected
register bank to the content of the Accumulator. The result is stored in the Accumulator.
The flags are set as in the above instructions.
Example; ADD A, @ R 0 ;
(IV)

ADD A Data;
Immediate Addressing Mode – 2 bytes;
(A) ⟵ (A) + (Data)
This instruction adds the immediate 8 – bit data to the content of the Accumulator. The result is stored in the
Accumulator.
The flags are set as in the above instructions.
Example; ADD A 40 H;
(ii) ADDC Instructions;
This instruction will add the byte variable indicated, the carry flag and the Accumulator contents. The result of the
addition stored in the Accumulator.
(I) ADDC A, R n ; Register Addressing Mode – 1 byte;

(A) ⟵ (A) + (R n ) + (Cy)

This instruction adds the contents of the Accumulator with the contents of the register 𝑅𝑛 of the selected register bank
and carry flag. The result is stored in the Accumulator.

▪ Carry flag is set if there is carry out from bit 7;


▪ Auxiliary carry flag is set if there is carry out from bit 3;

13 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ The overflow flag is set if there is a carry out of bit 6, but not out of bit 7 or a carry out of bit 7 but not from bit
6.

Example; ADDC A, R1 ;

(II) ADDC A, Direct; Direct Addressing Mode – 2 bytes;

(A) ⟵ (A) + (Direct) + (Cy)

This instruction adds the contents of the memory location specified to the contents of the contents of the Accumulator
and the carry flag. The result being stored in the Accumulator.

The flags affected as in the above instruction (I).

Example; ADDC A, 50 H;

(III) ADDC A, @ R I ; Register Indirect Addressing mode – 1 byte;

(A) ⟵ (A) + ((R i )) + (Cy)

This instruction adds the contents of the memory location pointed by the by register R I of the selected register bank
with the Accumulator and carry flag. The result being stored in the Accumulator.

The flags affected as in the above instructions.

Example; ADDC A, @ R 0 ;

(IV) ADDC A, Data; Immediate Addressing mode – 2 bytes;

(A) ⟵ (A) + (Data) + (Cy)

This instruction adds the contents of the Accumulator with 8 – bit immediate data specified in the instruction along with
the carry flag. The result being stored in the Accumulator.

The flags affected as in the above instructions.

(d) Subtraction Instructions;

The 8051 supports one subtract instruction SUBB (Subtract with Borrow). This instruction subtracts the byte variable
indicated and the contents of the carry flag together from the accumulator and the result stored in the Accumulator.

The carry flag serves as a ‘Borrow flag’ during subtraction operations when a greater value is subtracted from a lesser
value requiring a borrow into the highest order bit, the carry flag is set, otherwise it is cleared.

14 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(I) SUBB A, R n ; Register Addressing Mode – 1 byte;

(A) ⟵ (A) − (R n ) − (Cy)

This instruction subtracts the contents of register R n of the current register bank and the contents of carry flag together,
from the Accumulator. The result stored in the Accumulator.

▪ Carry (Borrow) flag is set if a borrow is needed for bit 7, otherwise it is cleared.
▪ Auxiliary carry flag is set if a borrow is needed for bit 3, otherwise it is cleared.
▪ Overflow flag is set if a borrow is needed for bit 6, but not into bit 7 or if borrow is needed into bit 7, but not bit
6.

Example; SUBB A, R 7 ;

(II) SUBB A, Direct; Direct Addressing Mode – 2 bytes;


(A) ⟵ (A) − (Direct) − (Cy)
This instruction subtracts the contents of the memory location whose address is specified in the instruction and the
content of the carry flag from the content of the Accumulator. The result stored in the Accumulator.
The flags are affected as in the above instruction.
Example; SUBB A, 50 H;
(III) SUBB A @ R I Register Indirect Addressing Mode – 1 byte;
(A) ⟵ (A) − ((R n )) − (Cy)
This instruction subtracts the contents of the memory location pointed by register R I and the content of the carry flag
from the content of the Accumulator. The result stored in the Accumulator.
The flags are affected as in the above instruction.
Example; SUBB A, @ R 0 ;
(IV) SUBB A, Data; Immediate Addressing mode – 2 bytes;
This instruction subtracts the 8 – bit immediate data specified and the content of the carry flag from the content of the
Accumulator. The result stored in the Accumulator.
The flags are affected as in the above instruction.
Example; SUBB A, 4F H;
(e) Multiplication and Division Instructions;
(I) MUL AB; Register Addressing Mode – 1 byte;
(A)7−0
⟵ (A) × (B)
(B)15−8

15 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
This instruction multiplies the 8 – bit unsigned integer in the Accumulator and register B. The low – byte of the 16 – bit
product is left in the Accumulator and the high – order byte in register B.
(II) DIV AB; Register Addressing Mode – 1 byte;
(A)15−8
⟵ (A)⁄(B)
(B)7−0
This instruction divides the 8 – bit unsigned integer in the Accumulator by the unsigned 8 – bit integer in register B. The
Accumulator receives the integer part of the quotient; register B receives the integer remainder.
(e) Decimal Arithmetic; M
Mnemonic; DA A
Decimal addition is possible by using the DA instruction together with ADD and / or ADDC. The 8 – bit binary value in the
Accumulator resulting from an earlier addition of two values variables is adjusted to form two BCD digits of four bits
each.
If the contents of the Accumulator bits 3 – 0 are greater than 9 or if the AC flag had been set, 6 (0110) is added to the
Accumulator producing the proper BCD digit in the low – order nibble.
If the carry flag is set or if the four high – order bits exceed 9 these bits are incremented by 6 (0110).
4. PROGRAM AND MACHINE CONTROL INSTRUCTIONS;
(a) Jump and CALL Instructions;
These instructions change the flow of program by changing the contents of the program counter.
A jump instruction permanently changes the program flow whereas CALL temporarily changes the program flow to allow
another part of the program to run.
There are jump instructions which change the program flow if certain conditions exist.
Jump and CALL program range;
Jump and CALL instructions replace the contents of the program counter with a new program address. The new address
can be specified either by specifying the difference between the new address and the current program counter contents
or by specifying the entire new address.
The difference in bytes, of the new address from the address of the program counter is called the range of the jump or
CALL. E.g., if a jump instruction is located at program address 0200 H, and the jump causes the program counter to be
come 0230 H, then the range of the jump is 30 H bytes.
Jump and CALL instructions may have the following ranges;
(I) Relative range: + 127 to − 128 (+7F H to − 80 H)
(II) Absolute range: 0000 H to 07FF H
(III) Long range: 0000 H to FFFF H
(a) Jump Instructions;

16 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(i) Unconditional Jump Instructions;
(I) Absolute Jump; Mnemonic; AJMP addr11 −2 bytes;
This instruction unconditionally transfers the program execution to the indicated address i.e., AJMP label.
The label must be within the same 2K block of program of program memory.
Example; AJMP label;
(II) Long Jump; Mnemonic; LJMP Addr16 − 3 bytes;
This instruction causes unconditionally branch to the indicated address, by loading the high order and low order bytes of
the Program Counter (PC) with second and third instruction bytes.
The destination may therefore be anywhere in the full 64K program memory address space.
(III) Short Jump; Mnemonic; SJMP rel − 2 bytes;
This program control branches unconditionally to the address indicated. The branch destination is computed by adding
the signed displacement in the second instruction byte to the PC, after incrementing the PC twice.
The Jump range is limited from −128 to + 127 bytes
(IV) Jump Indirect Mnemonic; JMP @ A + DPTR − 1 byte;
(PC) ⟵ (A) + (DPTR);
This instruction adds the 8 – bit unsigned contents of the Accumulator with the contents of the 16 – bit Data pointer.
The result of the addition is loaded into the program counter. This is the address where the microcontroller begins its
program execution.
(ii) Conditional Jump Instructions;
(I) Jump if Accumulator zero; Mnemonic; JZ rel − 2 bytes;
This instruction will branch i.e., jump to the address indicated if all the bits of the Accumulator are zero otherwise it will
continue with the next instruction.
(II) Jump if Accumulator Not zero; Mnemonic; JNZ rel − 2 bytes;
This instruction will branch i.e., jump to the address indicated if all the bits of the Accumulator are none zero otherwise
it will continue with the next instruction.
(III) Jump if carry is set; Mnemonic; JC rel − 2 bytes;
This instruction will branch i.e., jump to the address indicated if the carry flag is set otherwise it will continue with the
next instruction.
(IV) Jump if carry not set; Mnemonic; JNC rel − 2 bytes;
This instruction will branch i.e., jump to the address indicated if the carry flag is zero (cleared) otherwise it will continue
with the next instruction.
(V) Jump if Bit set; Mnemonic; JB bit, rel − 3 bytes;

17 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
This instruction will jump to the address indicated, if the indicated bit in the instruction is 1 otherwise program will
continue with the next instruction.
(VI) Jump if Bit Not set; Mnemonic; JNB bit, rel − 3 bytes;
This instruction will jump to the address indicated, if the indicated bit in the instruction is 0 otherwise program will
continue with the next instruction.
(VII) Jump if Bit is set and Clear bit; Mnemonic; JBC bit, rel − 3 bytes;
This instruction will jump to the address indicated, if the indicated bit in the instruction is 1 otherwise program will
continue with the next instruction.
The bit will not be cleared if it is already a zero.
(b) Compare and Jump if Not Equal instructions;
This instruction compares the magnitudes of the source and destination byte. If their values are unequal, then it jumps
to the address indicated otherwise program execution continues from the next instruction. Neither source byte nor
destination byte is altered.
The carry is set if the destination byte is less than the source byte, otherwise it is cleared.
(I) CJNE A, direct, rel − 3 bytes;
This instruction compares the magnitude of the accumulator and the magnitude of the memory location whose address
is specified in the instruction and jumps to the indicated address if the magnitudes are unequal.
The carry flag is set if the contents of the Accumulator are smaller than the contents of the memory location whose
address is specified otherwise it is cleared.
Example; CJNE A, 60 H, Loop;
(II) CJNE A, data, rel − 3 bytes
This instruction compares the magnitude of the accumulator with the 8 – bit immediate data available specified in the
instruction and jumps to the indicated address if the magnitudes are unequal.
The carry flag is set if the contents of the Accumulator are smaller than the immediate data specified, otherwise it is
cleared.
Example; CJNE A, 60 H, Loop;
(III) CJNE R n , data, rel − 3 bytes;
This instruction compares the magnitude of register R n of the selected register bank with the 8 – bit immediate data
available specified in the instruction and jumps to the indicated address if the magnitudes are unequal.
The carry flag is set if the contents of register R n are smaller than the immediate data specified, otherwise it is cleared.
Example; CJNE 𝑅𝑛 , 60 H, Loop;
(IV) CJNE @ R I , data, rel − 3 bytes;

18 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
This instruction compares the magnitudes of the pointed register R I of the selected register bank with the 8 – bit
immediate data available specified in the instruction and jumps to the indicated address if the magnitudes are unequal.
The carry flag is set if the contents of the pointed register R I are smaller than the immediate data specified, otherwise it
is cleared.
Example; CJNE @ R1 , 70 H, Loop;
(c) Decrement specified memory location/register by 1;
Mnemonic; DJNZ 〈byte〉 , 〈rel〉
This instruction decrements the indicated location by 1 and branches to the address indicated by the second operand if
the result value is not zero. No flags are affected.
It supports two addressing modes;
(I) Register Addressing mode – 2bytes;
(II) Direct Addressing mode – 3 bytes;
Example; DJZN R 2 , LOOP;
(d) Call and Subroutine Instructions;
(I) Absolute Call; Mnemonic; ACALL addr11 −2 bytes;
This instruction unconditionally calls a subroutine at the indicated address. At the end of the subroutine, the program
will resume operation at the opcode address following the call instruction.
The return address of the next instruction after the call instruction is in the program counter.
Example; ACALL label;
(II) Long Call; Mnemonic; LCALL addr 16 − 3 bytes;
This instruction calls a subroutine located at the indicated address. The following steps are followed;
▪ The program counter (PC) is indicated thrice in order to generate the address of the next instruction.
▪ The 16 – bit result is then pushed onto the stack (low byte first), incrementing the stack pointer by two.
▪ The PC is loaded with the second and third bytes of the LCALL instruction.
Program execution continues with the instruction at this address.
(III) Return from Subroutine; Mnemonic; RET − 1 byte;
When this instruction is executed, it informs the microcontroller to return back to the program, from where subroutine
was called.
This instruction pops the high and low – order bytes of the PC successively from the stack, decrementing the stack
pointer by two.
Program execution continues at the resulting address, generally the instruction immediately following an ACALL or
LCALL.

19 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(IV) Return from Interrupt; Mnemonic; RETI − 1 byte;
When this instruction is executed, it informs the microcontroller that it is returning from an Interrupt Service Routine
(ISR).
This instruction pops the high and low – order bytes of the PC successively from the stack, and restores the interrupt
logic to accept additional interrupts at the same priority level as the one just processed.
The stack pointer is decremented by two.
The program execution resumes from the instruction that follows the point at which the interrupt request was detected.
If an interrupt of the same level is pending then is processed.
(V) No Operation; Mnemonic; NOP − 1 byte;
(PC) ⟵ (PC) + 1
No operation is performed, only the PC content is affected. The PC contents are incremented by 1.
NOP instruction is used to insert time delays in a program.
EXAMINATION QUESTIONS:

1. (a) With the aid of a memory map, describe the intel 8051 microcontroller register banks. (7 marks)

(b) Write an 8051 – assembly language to compute, 1 + 2 + 3 + − − − − +15, and store the sum at
memory location 70H (7 marks)

MOV A,

MOV R 2 ,

LOOP; ADD A,

DJNZ R 2 ; LOOP

MOV 70 H , A

END

(c) Explain each of the following Intel 8051 microcontroller instructions, stating the addressing mode in
each case:

(i) MOV A, 60 H

(ii) MOVC A, @A + PC

(iii) ADD A @ R1 (6 marks)

2. (a) Describe each of the following microcontroller addressing modes citing one example in each case.
20 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(i) Direct

(ii) Indexed

(iii) Register (6 marks)

(b) Table below shows intel microcontrollers. Complete the table indicating the features of each.
(6 marks)

Features 8051 8052 8032


ROM (Bytes) 4K − 2K
RAM (Bytes) − 256 K 128 K
Timers 2 − −
I/O pins − 32 −

(c) Distinguish between the following 8051 microcontroller instructions:

(i) MOV A, 45 H and MOV A, 45 H;

(ii) MOV A, R7 and MOV A, @ R7; (4 marks)

(d) Write an 8051 – assembly language program starting at 0000 H to compute the series
1 + 2 + 3 + ⋯ … … … + 15 and store the sum at address 70 H. (4 marks)

3. (a) Explain the function of each of the following registers in 8051 microcontrollers:

(i) Data Pointer Registers (DPTR);

(ii) Accumulator;

(iii) Processor Status Word (PSW);

(iv) Stack pointer (8 marks)

(b) Write an Intel 8051 microcontroller assembly language subroutine program to perform the following:

▪ (17)10 × (9)10 ;
▪ Store result in memory location 05 H;
▪ Add data in external RAM locations 8000 H and 8001 H and store the result into memory
location 8002 H;

21 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ Return. (6 marks)
(c) Explain each of the following 8051 microcontroller instructions:
(i) JMP @ A + DPTR;
(ii) MOV A, @ RX;
(iii) ANL A, @ R i . (6 marks)
4. (a) State;
(i) The three types of buses in Intel 8051 microcontroller;
(ii) Any three different types of Intel 8051 interrupts in their order of priority. (6 marks)
(b) The table below an Intel 8051 ‘DELAY’ subroutine. The crystal frequency is 12 MHz. Assuming one
1
execution clock cycle = of crystals frequency, determine the total time delay of the subroutine.
12

(8 marks)
LABEL INSTRUCTION
DELAY: MOV R 0 , 20
LOOP 1: MOV R1 , 200
LOOP: DJNZ R1 LOOP
DJNZ R 0 LOOP 1

RET

5. (a) Figure (a) below shows an Intel 8051 microcontroller block diagram and its pin assignment is shown in
figure (b)

22 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
23 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(i) State the size of on – chip:
(I) RAM;
(II) ROM.
(ii) Match the pin names (or pin numbers) to the functions listed in the table below; (9 marks)
Function Pin Name (or Pin Number)
External interrupts
Counter inputs in timers
External oscillator
Hardware reset

24 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
6. (a) State two microcontroller on – chip components that are not found on a general – purpose
microprocessor. (2 marks)
(b) The table below shows an Intel 8051 microcontroller assembly language program segment.

MOV A, 03H
MOV R1 , A
CONT: INC A
CJNE A, 07 , CONT

(i) State the addressing mode of each instruction.


(ii) Draw a trace table of the program execution.
(iii) State the content of register A at the end of the program execution. (8 marks)
7. (a) State four microcontroller on – chip components that are not found in a general – purpose
microprocessor. (4 marks)
(b) Table below shows an 8051 – microcontroller assembly language program listing.

MOV 66 H, 20 H
MOV A, 66 H
MOV R 0
MOV A, @ R 0

(i) State the addressing mode of each instruction;


(ii) Draw a trace table for the program;
(iii) State the contents of register A at the end of the program execution. (9 marks)
8. (a) (i) Distinguish between internal and external interrupts with respect to microcontrollers.
(ii) The table below shows Intel 8051 interrupts. Complete the table by stating whether the
interrupt in external or internal

Interrupt Type (Internal / External)


Interrupt 0
Timer 0 interrupt
Interrupt 1

25 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Timer 1 interrupt
Serial interrupt

(b) Describe the operation of a watchdog timer in microcontrollers (4 marks)


(c) The table below shows an Intel 8051 program.

MOV R 5 , 30 H
MOV R 7 , 24 H
MOV A , 00 H
ADDA , R 5
MOV 40 H , A
ADDA , 40 H
ADDA , 40 H
END

(i) Draw the trace table of the program;


(ii) Explain what the program accomplishes. (9 marks)
2. PROCESS CONTROL
Process control is concerned with maintaining desired condition in a physical system, such conditions are temperature,
pressure, flow, liquid level, density and other physical quantities.
Control is achieved by performing the following three steps;
(i) Measuring the controlled variable.
(ii) Comparing the measured value with the desired value (set point) and applying the drift to the controller.
(iii) Correcting the error by manipulating some variables with the final control element in response to the output of
the controller.
A controller is that part of a process control system that decides how much adjustment the system needs to maintain
the desired output. The final control element implements the adjustments.
The block diagram of a process control system is shown below;

26 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ The measuring means is used to accomplish step (I) i.e., measurement. The output of measuring means is a
signal which is used as measured control variable (Cm ).This signal may be an electric current, voltage, pressure
or any other convenient signal.
▪ The error detector accomplishes step (II) i.e., comparison of the Set point (Sp ) with measured controlled
variable (Cm ).
▪ The controller accomplishes step (III) i.e., correction: it acts on the error signal to produce the controller output
signal. This output signal is applied to some type of final control element which regulates the manipulated
variable.
Process Characteristics;
The selection of what controller modes to use in a process is a function of the characteristics of the process,
(I) Process load;
This is the amount of control agent required to keep the system in a balanced condition. This keeps the controlled
variable constant.
It is usually determined by the settings of the final control element.
(II) Process lag;
This is the time it takes the control variable to reach a new value after the process load changes.

27 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
This time lag is the function of the process and not the control system which has time lag of its own.
Process lag can be caused by three properties;
(a) Capacitance;
This is the ability of a system to store a quantity of energy.
A large capacitance in the process means it will take more time for process load to occur.
(b) Resistance;
This is the opposition to flow; large resistance increases the process lag.
Often capacitance and resistance of the system are combined into a factor called R C delay or time constant (τ);
(c) Transportation / Dead – time;
This is the time it takes for a change to move from one stage to another in a process. OR;
This is the time taken between the application of a disturbance and the changing of the process.
(III) Stability;
A process control system is said to be stable if it can retain a controlled variable to a steady state.
Typically, an unstable system will cause the controlled variable to oscillate above and below the desired variable.
Control System Parameters;
A process control system has a reference command (set point), controller, final control element, feedback system and
error detector as shown below;

Inputs to the controller are a measured indication of both controlled variable and set point (representing the desired
value of the variable fixed at a point). These gives actuating signal (error signal e(t)) which is given to the controller
which transforms it into manipulated variable x(t).

28 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
When manipulated variable x(t) is applied to final control element, it gives the output (controlled variable c(t))
The feedback element measures – controlled variable c(t) and converts it to feedback signal b(t) which is compared
with the reference command r(t) and actuating (error) signal e(t) is generated.
This process is continued until the desired output or controlled variable c(t) is achieved.
(i) Error;
This is the difference between controlled variable and the reference signal (set point)
e=r−b … … (1)
Where e − error or actuating signal
B − measured variable
R − reference (set point)
The error can be expressed as a percentage of measured variable span by the following equations;
C−Cmin
Cp = C − Cmin
× 100
max

Where Cp − measured value as percent of measurement range


C − actual measured value
Cmax − maximum value of the measured variable
Cmin − minimum value of the measured variable
Similarly, error can be expressed as a percent of span;
r−b
Ep = b – bmin
× 100
max

Where ep − error expressed as percent of span


A positive value of % error indicates that the measured variable is below the set point and a negative value of % error
indicates that the measured variable is above the set point.
Example;
Temperature range is 200 °K to 400 °K for the stirred tank heat exchanger. The set point is 370 °K. Determine the
percent of span error when the temperature is 365 °K.
Solution;
r−b
Ep = × 100
bmax – bmin
370−365 5
= × 100 = × 100
400−200 200

=2∙5%
(ii) Variable range;
This is a range from a minimum value to the maximum value of the parameter variable.
(iii) Control parameter range;

29 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
u − umin
p= × 100
umax − umin
Example;
A controller output a 4 mA − 20 mA signal to control motor speed from 140 rpm to 600 rpm with a linear dependence.
Determine the;
(i) Current corresponding to 310 rpm;
(ii) the value of current expressed as the percent of control output.
Solution;
(i) Linear relationship between current I and speed Sp is;
Sp = mI + S0
Where Sp − speed of the motor in rpm
I − current in mA
S0 − minimum speed in rpm
rpm
M − slope in
mA

600 = 20m + S0 (1)


140 = 4m + S0 (2)
Subtracting eq (2) from eq (1) gives;
460 = 16m ⇒ m = 28 ∙ 75 rpm⁄mA
From eq (1);
S0 = 600 − 20(28 ∙ 75) = 25 rpm
Current corresponding to Sp = 310 rpm
310 = 28 ∙ 75I + 25
310−25
I= = 9.91 mA
28∙75

(II) Expressed as a percentage of the 4 𝑚𝐴 − 20 𝑚𝐴 range, this controller output is;


𝑢−𝑢𝑚𝑖𝑛 9.91−4
𝑝=𝑢 × 100 = [ 20−4 ] × 100
𝑚𝑎𝑥 −𝑢𝑚𝑖𝑛

= 36 ∙ 9 %
(iv) Control lag;
Whenever a controlled variable faces a sudden change, the feedback control loop of the process responds by giving
command to the final control element to adopt a new value to bring back the controlled variable to its nominal value.
Thus;

30 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Control lag; is the time for the process control loop to make necessary adjustment to the final control element.
(v) Dead Time;
This is the time duration between the moment a deviation (error) occurs and when first corrective action occurs.
(vi) Cycling;
This is when the controlled variable deviates from its nominal value and the corrective action makes the controlled
variable oscillate up and down from the nominal value.
CONTROLLER MODES;
The controller signal to the final element can be ON/OFF type or continuous type. This is known as controller mode.
Whenever an increasing value of controlled variable causes an increasing value of the controller output, it is known as
direct action e.g., in a liquid level control, if the level rises with the valve opening.
If the increasing value of controlled variable causes decrease in controller output, it is known as reverse action e.g., in
temperature control using heater, if the temperature increases, the heating rate needs to be decreased.
DISCONTINUOUS CONTROLLER MODES;
(I) Two – position mode;
The simplest two – position controller mode is the ON/OFF type.
0% 𝑒𝑝 < 0
𝑝={
100% 𝑒𝑝 > 0
When the measured value is less than the set point value, full controller output is given.
When it is more than the setpoint value, the controller output is zero.
e.g., in a room heater, if the temperature drops below a set point value, the heater is turned ON, and if the temperature
rises above a set point value, it turns OFF.
Neutral zone:
Two – position controller should be put ON/OFF above or below some deviation, such a range is known as neutral zone
as shown below.

31 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
When an increasing error △ ep , changes by above zero, the controller output will not change state. In decreasing, it
must fall below zero before the controller changes to the 0% rating.
The range, which is referred to as the neutral zone or differential gap, is often purposely designed above a certain
minimum quantity to prevent excessive cycling.
Disadvantage; two – position controller is slow.
Examples include;
▪ Room heater
▪ Liquid bath temperature control
▪ Level control in large tanks.
Example 1;
A controller outputs 4 mA to 20 mA signal to control motor speed from 150 rpm to 750 rpm with linear relationship.
Calculate the;
(i) Current corresponding to 300 rpm.
(ii) The value of the current as a percentage of the control output.
Solution;
(i) Linear relationship between current I and speed Sp is;
Sp = mI + S0
750 = 20m + S0 (1)
150 = 4m + S0 (2)
Subtracting eq (2) from eq (1) gives;
600 = 16m ⇒ m = 37 ∙ 5 rpm⁄mA
32 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
From eq (1);
S0 = 750 − 20(37 ∙ 5) = 0 rpm
Current corresponding to Sp = 300 rpm
300 = 37 ∙ 5I
300
I= = 8 mA
37∙5

(II) Expressed as a percentage of the 4 𝑚𝐴 − 20 𝑚𝐴 range, this controller output is;


𝑢−𝑢𝑚𝑖𝑛 8−4
𝑝=𝑢 × 100 = [20−4] × 100
𝑚𝑎𝑥 −𝑢𝑚𝑖𝑛

= 25 %
Example 2;
A water level control system linearly converts a displacement of 4 m to 6 m into a 4 mA to 20 mA control signal. A relay
serves as a two – position controller to open and close an inlet valve. The relay closes at 10 mA and opens at 8 mA.
Determine the;
(i) Relationship between displacement level and current;
(ii) Neutral zone or displacement gap in meters.
Solution;
(i) Consider the linear relationship in the level and currents;
H = mI + H0
Where H − water level in m;
M − Slope in m⁄mA;
H0 − minimum level in m.
Now;
4 = 4m + H0 … … (1)
6 = 20m + H0 … … (2)
Subtracting eq (1) from eq (2) gives;
1
m
8
16m = 2 ⇒ m = mA

Substituting the value of m in eq (1) gives;


1 1 7
4 = 4 (8) + H0 ⇒ H0 = 4 − 2 = 3 ∙ 5 m = 2

Thus, the relation becomes;


1 7
H = 8I + 2

(ii) The relay closes at 10 mA, hence it gives high level.


Thus;

33 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
1
HH = (8 × 10) + 3 ∙ 5 = 4 ∙ 75 m

The relay opens at 8 mA, hence it gives low level.


Thus;
1
HL = (8 × 8) + 3 ∙ 5 = 4 ∙ 5 m

Thus;
The neutral zone = (HH − HL ) = (4 ∙ 75 − 4 ∙ 5) m
= 0 ∙ 25 m
Example 3;
The temperature drops by 3 °K per minute in a water if it loses heat. It gains temperature at 5 °K per minute if a heater
is ON. A two – position mode controller has a 0 ∙ 6 minute control lag and a neutral zone of ± 5 % of the set point nearly
of 300 °K.
(i) Plot heater versus time curve;
(ii) Determine the oscillation period.
Solution;
Initially the temperature of the tank is at a set point value and subsequently the temperature drops linearly as per he
formular;
Tdrop (t) = T(t s ) − 3(t − t s ) … … (i)
Where; t s − time when observation starts
5
The heater will start at; 300°K − ( 100 × 300) °K = (300 − 15)°K

= 285°K
and thereafter the temperature will rise at the rate of 5°K as the heater is put ON. The temperature rise shall be as per
the following formular;
Trise (t) = T(t h ) + 5(t − t h ) … … (ii)
Where; t h − time when heater is ON
5
The temperature will rise until it reaches; 300°K + ( × 300) °K = (300 + 15)°K
100

= 315°K
Plotting equations (I) and (ii) gives;

34 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(II) Multi – position mode;
This is an extension of two – position mode controller which gives several intermediate rather than only two settings of
the controller output. This discontinuous control mode is used to reduce the cycling behavior and overshoot and
undershoot inherent in the two-position mode.
The figure below shows a three – position controller action. This type of control mode needs a final control element with
at least two settings.

35 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Three – position controller action;
The multi – position mode controller can be represented as follows;
P = Pi eP > |ei | i = 1,2,3 − − − −n
As the error exceeds certain set limits by ± eI, the controller output is adjusted to preset values, Pi .
The most common example is the three – position mode controller. This controller can be represented as follows;
100 for eP > e2
P={ 50 −e1 < eP < e2
0 eP < −e1
The controller output remains at 50% as long as the error is between −e1 and e2 . If the error exceeds e2 , the output of
the controller is preset to 100%, and if the error is lower than −e1, the controller output is preset to zero.
The relationship between error and three position controller action including the effects of lag is shown below.

36 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(III) Floating control mode;
In this type of control action, the specific controller output is not uniquely determined by the magnitude of the error
e.g., when the error is zero, the output of the controller will not change but reman float at whatever setting it was when
the error went to zero. When the error moves off the zero mark, the controller output begins to change.
As with the two – step control, there is typically a neutral zone about the zero error where no change in controller
position occurs e.g.,
(a) Single speed floating control mode;
The controller output changes at a fixed rate when the error exceeds neutral zone. An equation for this mode of control
is;

dP
= ±K f ; |eP | > ∆eP − − − − − (1)
dt
Where;
dP
− rate of change of controller output with time;
dt

37 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
K f − rate constant (%⁄s);
∆eP − half the neutral zone.
Equation (1) is integrated for the actual controller output. Thus;
P = ±K f t + P(0) |eP | > ∆eP − − − − − (2)
Where;
P(0) − is the controller output at time t = 0; which shows that the presence position depends on the time
history of errors that have previously occurred.
Because such history is usually unknown, the actual value of P floats at an undetermined value. If the deviation persists,
then Eq (1) shows that the controller saturates at either 100% or 0% and remains there until an error drive it toward
the opposite extreme.
A graph of a single – speed floating control is shown below.

38 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
The plot above shows controller output versus time. The controller is considered to be reverse acting i.e., controller
output decreases if the error exceeds the neutral zone with corresponding K f .
When error exceeds at time t1 , the controller output reduces at constant rate until t 2 when the error again falls below
the neutral zone limit. At t 3 , the error falls below the lower limit of the neutral zone causing controller output to change
until the error again moves within the allowable band.
(b) Multi – speed control mode;

39 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
In this mode, several possible speeds (rates) are changed by the controller output. Usually, the rate increases as the
deviation exceeds certain limits. Thus, if certain speed change points epi depending on the error, then each has its
corresponding output rate change K i .
Thus;
dP
= ±K fi |ep | > epi
dt
If the error exceeds epi , then the speed is K fi. If the error rises to exceedep2 , the speed is increased to K f2 and so on.

CONTINOUS CONTROLLER MODES;


In these modes, the output of the controller changes smoothly in response to the error or rate of change of error.
(I) Proportional Control mode;
The proportional controller gives a smooth and linear relationship between the controller output and the error. Thus,
over some range of errors about the set point, each value of error has a unique value of controller output in one – to
one correspondence.
The range of error to cover the 0% to 100% controller output is called proportional band.
This mode can be expressed by;

40 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
P = K p ep + P0 − − − − − (1)
Where;
K P − Proportional constant between error and controller output (% per %)
P0 − Controller output with no error (%)
Direct and Reverse action;
The error in Equation (1) is expressed using the difference between setpoint and the measurement i.e., e = r − b .
This means that as the measured value increases above the setpoint, the error will be negative and the output will
decrease. That is, the term will subtract from. Thus, Equation (1) represents reverse action.
Direct action would be provided by putting a negative sign in front of the correction term.
A plot of the proportional mode output versus error for Equation (1) is shown in the figure below for direct action.

N/B;
The proportionality constant determines the proportional band. The value of 𝑃0 is often designed to be 50% to give
equal controller swing as error occurs above and below the set point.
The proportional band is defined by the equation;

41 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
100
PB = − − − − − − − (2)
KP
Characteristics of the proportional mode are;
(I) If the error is zero, the output is constant equal to P0
(II) If there is error, for every 1% of error a correction of K P percent is added to or subtracted from P0 depending
on the reverse or direct action of the controller.
(III) There is a band of error about zero of magnitude PB within which the output is not saturated at 0% or 100%
Offset;
This is a permanent residual error produced by proportional control mode in the operating point of the controlled
variable when a change in load occurs.
It can be minimized by a larger constant, K P , which also reduces the proportional band.

Consider the system above under nominal load with the controller output at 50% and the error zero.
If a transient error occurs, the system responds by changing controller output in correspondence with the transient to
effect a return – to – zero error.

42 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Suppose however, a load change occurs that requires a permanent change in controller output to produce the zero –
error state. Because a one – to – one correspondence exists between controller output and error, a new zero – error
controller output can never be obtained. Instead, the system produces a small permanent offset in reaching a
compromise position of controller output under new loads.
Example;
A proportional mode level control system is shown in the figure below. A linear valve A with flow scale factor of
10 m3 ⁄hr per percent controller output occurs. The nominal output is 50% with a constant of K P = 10% per%. If a
load change occurs when flow through valve B changes from 500 m3 ⁄hr to 600 m3 ⁄hr. Determine the;
(I) New controller output;
(II) Offset.

Solution;
(I) Valve A needs to move to a new flow rate of 600 m3 ⁄hr or else the tank will be emptied. Thus, flow rate
through valve A is;

10 m3 ⁄hr
QA = [ ] × (P%)
%

43 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
But;
600 m3 ⁄hr
P% = = 60%
10 m3⁄hr⁄%
Thus;
10 m3 ⁄hr
QA = [ ] × 60% = 600 m3 ⁄hr
%
(II) The proportional rate equation is;
P = K P eP + P0 ;
With nominal condition P0 = 50%

P − P0 60 − 50
eP = ( )=( ) × 100
KP 10
= 1%
Thus, 1% offset error occurred due to load change.
(II) Integral Control mode;
This mode represents an extension of the principle of floating control mode. Instead of single speed or even multiple
speeds, there is continuous change in speeds depending on error.
This mode is often referred to as reset action.
Mathematically;
dP
= K i ep − − − − − −(1)
dt
Where;
dP
− rate of controller output change (%⁄s)
dt
K i − constant relating the rate to the error [(%⁄s)⁄%]
1
The inverse of K i , called the integral time Ti = K in seconds (minutes)
i

Integrating equation (1) gives;


t
P(t) = K i ∫0 eP (t)dt + P(0) − − − − − − (2)
Thus, from equation (2), the presence of controller output depends on the history of errors from when the observation
started at time t = 0.
The constant K i expresses the scaling between the error and the controller output.
Characteristics of the integral mode;
(I) If the error is zero, the output stays fixed at a value equal to what it was when the error went to zero.

44 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(II) If the error is not zero, the output begins to increase or decrease at a rate of K i % per second for every 1% of
the error.
(III) For direct action, a positive error over time produces an increase in the integral mode output.
Example;
An integral controller is used for speed control with a set point of 12 rpm within a range of 10 − 15 rpm the controller
output is 22% initially. The constant K i = − 0 ∙ 15% controller output per second per percentage error. If the speed
jumps to 13 ∙ 5 rpm, calculate the controller output after 2 secs for a constant eP
Solution;
r−b 12 − 13 ∙ 5
eP = × 100 = × 100
bmax − bmin 15 − 10
= −30%
The rate of controller output change;
dP
= K i eP = (−0 ∙ 15)(−30) %⁄s = 4 ∙ 5 %⁄s
dt
The controller output for a constant error will be;
t
P(t) = K i ∫ eP (t)dt + P(0)
0

Since eP is constant, thus;


P(t) = K i eP t + P(0)
After 2 seconds;
P(t) = (−0 ∙ 15)(−30)(2) + 22 = 31%
(III) Derivative Control mode;
In this mod, the controller output depends on the rate of change of error. This mode is also known as rate or
anticipatory control.
The mode cannot be used alone because when the error is zero or constant, the controller has no output.
Mathematically;
deP
P(t) = K D − − − − − −(1)
dt
Where;
K D − Derivative gain constant
deP
− rate of change of error (%⁄s)
dt
The figure below shows how the derivative controller changes its output for various rates of change of error.

45 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
For a given rate of change of error, there is a unique value of controller output.
It is assumed that the controller output with no error or rate of change of error is 50%.
When the error changes very rapidly with a positive slope, the output jumps to a large value, and when the error is not
changing, the output returns back to 50%. When the error is decreasing i.e., has a negative slope, the output
discontinuously changes to a lower value.
Thus, derivative control with small gain is safe to use, if the gain is very large, the output of the controller changes
suddenly which can cause very large change of output which may lead to instability.
Characteristics of the derivative mode are;
(I) If the error is zero, the mode provides no output.
(II) If the error is constant, the mode provides no output.
(III) If the error is changing in time, the mode contributes an output of K D percent per every 1% per second rate of
change of error.
(IV) For direct action, a positive rate of change of error produces a positive derivative mode output.
COMPOSITE CONTROL MODES;
(I) Proportional – Integral control (PI)
46 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
This is a control mode that results from a combination of the proportional mode and the integral mode. The analytical
expression for this control process is given as;
t
P = K P eP + K P K i ∫ eP dt + Pi (0) − − − − − −(1)
0

Where;
Pi (0) − Integral term value at t = 0 (initial value)
The main advantage of P – I control mode is that the one – to – one correspondence of the proportional mode and the
integral mode eliminates the inherent offset.
Characteristics of the Proportional - Integral mode are;
(I) When the error is zero, the controller output is fixed at the value that the integral term had when the error went
to zero. This output is given by Pi (0) in equation (1).
(II) If the error is not zero, the proportional term contributes a correction and the integral term begins to increase
or decrease the accumulated value [initially Pi (0)] depending on the sign of the error and the direct or reverse
action.
Application;
It can be used in systems with frequent or large load changes.
Disadvantages;
(I) P – I controllers have relatively slow changes in load due to integration time.
(II) There is a considerable overshoot of the error and output during start – up of a batch process before settling to
the operation point. Time (t)

47 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Example 1;
Given the error versus time plot of the figure below. Plot a graph of proportional – Integral controller output as a
function of time. Take K P = 5, K i = 1 ∙ 0 S −1 and Pi (0) = 20%.

48 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Solution;
t
P = K P eP + K P K i ∫ eP dt + PI (0) − − − − − −(1)
0

Controller output can be found by solving for the errors in various regions.
0 ≤ t ≤ 1 eP = t %
1 ≤ t ≤ 3 eP = 1 %
t≥3 eP = 0 %
Thus, the region 0 ≤ t ≤ 1 for eP = t %

t 𝑡
𝑡2
P1 = 5t + 5(1) ∫ t dt + 20 = 5𝑡 + 5 [ ] + 20 = 5𝑡 + 2 ∙ 5𝑡 2 + 20
0 2 0

at t = 0, P0 = 20 𝑎𝑡 𝑡 = 1, 𝑃1 = 5(1) + 2.5(1)2 + 20 = 27 ∙ 5%
This is plotted and at the end of 1 second, the integral term has accumulated a value of PI (1) = 22 ∙ 5% which forms
the initial condition for the next region.
In the region 1 ≤ t ≤ 3; for eP = 1 %
3
P2 = 5(1) + 5(1) ∫ 1 dt + 22 ∙ 5 = 5 + 5(3 − 1) + 22 ∙ 5 = 37 ∙ 5%
1

At the end of 3 seconds, the integral term shall have accumulated a value P2 (3) = 32 ∙ 5% which forms the initial
condition for the next region.
Thus, t ≥ 3 seconds 𝑒𝑃 = 0%
t
P3 = 5(0) + 5(1) ∫ (0) dt + 32 ∙ 5 = 32 ∙ 5%
t=3

49 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Example 2;
(a) An integral controller has a reset action of 2 ∙ 2 minutes, express the integral controller constant per second.
Find the output of this controller to a constant to a constant error of 2 ∙ 2%.
(b) Proportional plus integral controller has K P = 2 ∙ 0, K i = 2 ∙ 2 s −1 and P(0) = 40%. Plot the controller output
for an error given by the figure below.

50 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Solution;
(a) Reset Action TI = 2 ∙ 2 minutes = (2 ∙ 2 × 60) seconds
= 132 seconds
Error constant eP = 2 ∙ 2%
1 1
Integral controller constant K I = = = 0 ∙ 0076⁄sec
TI 132
t t
P(t) = K I ∫ eP dt + P(0) = 0 ∙ 0076 ∫ 2 ∙ 2 dt + P(0)
0 0
t

= 0 ∙ 0076 [2 ∙ 2t] + 0 = 0 ∙ 0076 × 2 ∙ 2t


0

= 0 ∙ 0167t
(b) Controller output can be found by solving for errors in various regions;
0≤t≤2 eP = t%
2≤t≤4 eP = −2 ∙ 5t + 7%
4≤t≤6 eP = 1 ∙ 5t − 9%
Now;
t
P = K P eP + K I K P ∫ eP dt + P𝑖 (0)
0

In the region 0 ≤ 𝑡 ≤ 2;
51 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
2 2
P1 = 2eP + (2 ∙ 2 × 2) ∫0 eP dt + 40 = [2t]20 + 4 ∙ 4 ∫0 t dt + 40

2
t2
= 2(2) + 4 ∙ 4 [ 2 ] + 40 = 4 + 8 ∙ 8 + 40 = 52 ∙ 8%
0

After 2 seconds, the integral term shall have accumulated a value, Pi (1) = 8 ∙ 8 + 40 = 48 ∙ 8%

Thus, in the region 2 ≤ 𝑡 ≤ 4;

4 4
P2 = 2eP + 4 ∙ 4 ∫2 eP dt + Pi (1) = 2(−2 ∙ 5t + 7) + 4 ∙ 4 ∫2 (−2 ∙ 5t + 7)dt + 48 ∙ 8

4
𝑡2
= −5𝑡|42 + 14 + 4 ∙ 4 [−2 ∙ 5 2
+ 7𝑡] + 48 ∙ 8
2

= −5(4 − 2) + 14 + 4 ∙ 4[−1 ∙ 25(4 − 2)2 + 7(4 − 2)] + 48 ∙ 8

= −10 + 14 + 4 ∙ 4[−1 ∙ 25(4) + 14] + 48 ∙ 8

= 92 ∙ 4%

After 4 seconds, the integral term shall have accumulated a value, Pi (2) = 39 ∙ 6 + 48 ∙ 8 = 88 ∙ 4%

Thus, in the region 4 ≤ t ≤ 6;

4 4
P3 = 2eP + 4 ∙ 4 ∫2 eP dt + Pi (2) = 2(1 ∙ 5t − 9) + 4 ∙ 4 ∫2 (1 ∙ 5t − 9)dt + 88 ∙ 4

6
𝑡2
= 3(2) − 18 + 4 ∙ 4 [1 ∙ 5 2
− 9𝑡] + 88 ∙ 4 = 6 − 18 − 66 + 88 ∙ 4
4

= 10 ∙ 4%

(II) Proportional – Derivative control (P – D);

The analytical equation for this control action is;

deP
P = K P eP + K P K D + P(0) − − − − − −(1)
dt

P – D cannot eliminate the offset of proportional controllers. However, it can handle fast process load changes as long as
the load change offset error is acceptable.
P(S) = K P EP (S) + SK P K D EP (S) = EP (S) K P [1 + SK D ]

Transfer function;
P(S)
= K P [1 + SK D ]
EP (S)

52 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
= K P [1 + SτD ]
Where, K D = τD
The Proportional Derivative (P – D) action showing the offset error from proportional mode (reverse) action is shown
below.

Example;
The error response curve is given in the figure below, suppose the figure is applied to a P – D controller with K P = 5,
K D = 0 ∙ 5 seconds and P(0) = 20%.
Draw a graph of resulting controller output.

53 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Solution;

P – D controller equation is;

deP
P(t) = K P eP + K D K P + P(0)
dt

From the error versus time plot;

eP = at for 0 ≤ t ≤ 1;

P1 (t) = K P at + K D K P a + P(0)

As eP = at for 0≤t≤1 a = 1% per second, K P = 5, K D = 0 ∙ 5 seconds

P1 (t) = 5t + (5 × 0 ∙ 5 × 1) + 20 = 5t + 2 ∙ 5 + 20 − − − − − −(1)

There is an instantaneous change of 2 ∙ 5% in the output of the controller due to the error.

deP
In the duration 1 ≤ t ≤ 3, eP = 1%, dt
= 0, hence;

P2 (t) = K P + P(0) = 5 + 20 = 25 − − − − − − (2)

In the duration 3 ≤ t ≤ 5, eP = −0 ∙ 5t + 2 ∙ 5, hence;

deP
P3 (t) = K P eP + K D K P + P(0)
dt

= 5(−0 ∙ 5t + 2 ∙ 5) + (0 ∙ 5 × 5)(−0 ∙ 5) + 20 = −2 ∙ 5t + 12 ∙ 5 − 1 ∙ 25 + 20

= −2 ∙ 5𝑡 + 31.25 − − − − − −(3)

The value of controller outputs at specified times are;


54 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
At t = 0 , P(0) = 20 and P(0) = 22 ∙ 5 from equation (1);

At t = 1, P(1) = 27 ∙ 5 from equation (1) and P(1) = 25 from equation (2);

At t = 3, P(3) = 25 from equation (2) and P(3) = 23 ∙ 75 from equation (3);

At t = 5, P(5) = 18 ∙ 75 from equation (3) and P(5) = P(0) = 20.

55 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
56 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(III) Proportional – Integral – Derivative (PID) control;

P – I – D controllers are combination of all three modes; proportional mode, Integral mode and derivative mode.

It contains features of all the three. Thus, it can be used for any process condition.

The P – I – D equation is as follows;

t
deP
P(t) = K P eP + K P K I ∫ eP dt + K P KD + Pi (0) − − − − − − (1)
Proportional 0 dt
Integral Derivative Initial condition

KP t deP
P(t) = K P eP + ∫ e dt + K P τD + Pi (0) − − − − − − (2)
τI 0 P dt

In Laplace transforms. (Assuming initial conditions zero)

KP 1
P(s) = K P EP (s) + EP (s) + SK P τD EP (s) = K P [1 + + SτD ] EP (s)
SτI SτI

The transfer function;


P(s) 1
G(s) = = K P [1 + + SτD ]
EP (s) SτI

This mode eliminates the offset of the proportional mode and still provides fast response.

Example;

A PID controller produces the following error.

57 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
If the PID controller has K P = 5, K I = 0 ∙ 7⁄seoconds , K D = 0 ∙ 5 seconds and PI (0) = 20%. Plot the output of the
controller.

Solution;

From the error response curve, error can be expressed as follows;

0≤t≤1 eP = t %
1≤t≤3 ep = 1 %
1
3≤t≤5 eP = − t + 2 ∙ 5 %
2

The PID controller equation is;

t
deP
P(t) = K P eP + K P K I ∫ eP dt + K P K D + P(0) − − − − − − (1)
0 dt

t
deP
= 5eP + 3 ∙ 5 ∫ eP dt + 2 ∙ 5 + 20
0 dt

From 0 ≤ t ≤ 1; eP = t %

t
P1 (t) = 5t + 3 ∙ 5 ∫ t dt + 2 ∙ 5 + 20 = 5t + 1 ∙ 75t 2 + 22 ∙ 5 − − − − − − − (2)
0

At the end of t = 1 seconds, the integral term accumulates, which gives PI (1) = 21 ∙ 75% as only integral and initial
values in equation (2).

Also ep = 1 % for 1 ≤ t ≤ 3;

t
P2 (t) = 5 + 3 ∙ 5 ∫ 1 dt + 2 ∙ 5 + 21 ∙ 75 = 5 + 3 ∙ 5(t − 1) + 21 ∙ 75
1

= 3 ∙ 5(t − 1) + 26 ∙ 75 − − − − − − (3)

At the end of t = 3 seconds, the integral term has accumulated to PI (3) = 28 ∙ 75 %. Consider only integral and initial
values in equation (3)

1
Also eP = − 2 t + 2 ∙ 5 % for 3 ≤ t ≤ 5;

t
1 1 𝑑 1
P3 (t) = 5 (− t + 2 ∙ 5) + 3 ∙ 5 ∫ (− t + 2 ∙ 5) dt + 2 ∙ 5 (− t + 2 ∙ 5) dt + 28 ∙ 75
2 3 2 𝑑𝑡 2

58 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
t
0∙5 2 2∙5
= −2 ∙ 5t + 12 ∙ 5 + 3 ∙ 5 [− t + 2 ∙ 5t] − + 28 ∙ 75
2 3 2

= −2 ∙ 5t + 12 ∙ 5 − 0 ∙ 875t 2 + 8 ∙ 75t + 7 ∙ 875 − 26 ∙ 25 − 1 ∙ 25 + 28 ∙ 75

= −0 ∙ 875t 2 + 6 ∙ 25t + 21 ∙ 625

The outputs necessary for plotting are;

At t = 0, P(0− ) = 20 given, P(0+ ) = 22 ∙ 5 from equation (2);

At t = 1, P(1− ) = 29 ∙ 25 from equation (2), P(1+ ) = 26 ∙ 75 from equation (3);

At t = 3, P(3− ) = 33 ∙ 75 from equation (3), P(3+ ) = 32 ∙ 5 from equation (4);

At t = 5, P(5− ) = 31 ∙ 0 from equation (4), P(5+ ) = 32 ∙ 5;

As the error is zero at t = 5, hence, the controller output at t = 5 will have accumulated the integral output giving a
constant value of PI (5) = 32 ∙ 25%.

Plot of controller output versus time;

59 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
PROCESS CONTROL LOOP – TUNNING;

It refers to the actual start up and adjustment of a process control loop performance. It is based on the selection of the
best controller tunning parameters K P , K I and K D that gives optimum performance.

Process control tunning methods includes:

(I) Ziegler – Nichols (Ultimate cycle) method;


60 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(II) Open loop transient response (Reaction curve) method;

(III) Frequency response method.

(I) ZIEGLER – NICHOLS (ULTIMATE CYCLE) METHOD;

It is based on adjusting the control loop until steady oscillations occur. The controller settings are then based on the
conditions that generates steady oscillations.

This method is accomplished through the following steps:

(i) Reduce any integral and derivative actions to their minimum effects

(ii) Gradually begin to increase the proportional gain while providing periodic disturbance to the process.

(iii) Note down the critical gain K C at which the controlled variable just begins to exhibits steady cycling i.e.,
oscillations about the setpoint.

(iv) Note the critical period 𝑇𝐶 of these oscillations measured in minutes.

(v) From critical gain 𝐾𝐶 and critical period 𝑇𝐶 , the settings of various controller modes as proposed by
Ziegler and Nichols are assigned as follows;

(I) Proportional;

K P = 0 ∙ 5K C

(II) Proportional – Integral;

K P = 0 ∙ 45K C

TC
Ti =
1∙2

In case of Quarter Amplitude criterion, Ti = TC and the gain is adjusted to obtain Quarter – Amplitude
criterion.

(III) Three – mode (PID);

It requires proportional gain, Integral time and derivative time.

K P = 0 ∙ 6K C

TC
Ti =
2∙0
61 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
TC
TD =
8

For adjustment to give Quarter – Amplitude criterion,


TC
Ti =
1∙5

TC
TD =
6

And the proportional gain K P is adjusted until Quarter – Amplitude response is achieved.

Example 1;

In application of Ziegler – Nichols method, a process begins oscillations with a 30% proportional band in an 11 ∙
5 minutes period. Determine the nominal three mode controller settings.

Solution;

TC = 11 ∙ 5 minP. B = 30%

100
For Proportional Band, K P =
P. B

100
= = 3 ∙ 33
30

This, is the critical gain K C = 3 ∙ 33

Thus, for PID tunning parameters as proposed by Ziegler – Nichols;

K P = 0 ∙ 6K C = 0 ∙ 6 × 3 ∙ 33

= 1 ∙ 98 ≈ 2

TC 11 ∙ 5
Ti = =
2∙0 2∙0

= 5 ∙ 75 min

TC 11 ∙ 5
TD = =
8 8

= 1 ∙ 4375 min

If Quarterly Amplitude is required, then;

62 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
TC 11 ∙ 5
Ti = = = 7 ∙ 667 min
1∙5 1∙5

TC 11 ∙ 5
TD = = = 1 ∙ 9167 min
6 6

Example 2;

1
A control system has a transfer function, GP (s) = and a PID controller with a transfer
s(s + 1)(s + 5)

1
function Gc (s) = K P [1 + + sTD ] connected in cascade as illustrated below in a unity feedback
sTi

Compute the parameters of the controller (K P , Ti and TD ) by using Ziegler – Nichols ultimate cycling tunning method.

Solution;

The transfer function of the system with proportional action only is;

KP
s(s + 1)(s + 5) KP
G(s) = =
KP s(s + 1)(s + 5) + K P
1+
s(s + 1)(s + 5)

The characteristic equation becomes;

s(s + 1)(s + 5) + K P = s 3 + 6s 2 + 5s + K P = 0

Using Routh stability criterion, critical gain K C is found as;

63 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
For stability;

30 − K P
KP > 0 or >0
6

30 − K P > 0 or K P < 30

Thus, the range for stability becomes; 0 < K P < 30

The system will be critically stable at K C = 0 or K C = 30. Taking K C = 30, the characteristic equation becomes;

S 3 + 6S 2 + 5S + 30 = 0;

In time domain;

(jω)3 + 6(jω)2 + 5(jω) + 30 = 0

−jω3 − 6ω2 + j5ω + 30 = jω(5 − ω2 ) + 6(5 − ω2 ) = (5 − ω2 )(6 + jω) = 0

ω2 = 5 or ω = √5 rad⁄sec

Hence, the period of sustained oscillation TC is given as;

1 2π 2π
TC = = = = 2 ∙ 81 seconds
f ω √5

Now K C = 30 and TC = 2 ∙ 81 seconds, For PID controller:

K P = 0 ∙ 6K C = 0 ∙ 6 × 30 = 18

TC 2 ∙ 81
TI = = = 1 ∙ 405 seconds
2∙0 2
64 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
TD = 0 ∙ 125TC = 0 ∙ 125 × 2 ∙ 81 = 0 ∙ 35125 seconds

(II) OPEN LOOP TRANSIENT RESPONSE (REACTION CURVE) METHOD;

It was developed by Ziegler and Nichols. The approach is to open the process control loop so that no control action or
feedback occurs.

It is usually done by disconnecting a controller output from the final controller element as shown below.

All other process parameters are held at their normal values.

At some time, a transient disturbance is introduced by a small manual change in the controlling variable using the final
control element.

The control variable is then measured and recorded versus time at the instant of and following the disturbance.

A typical open loop controller response is shown below where the disturbance is applied at time t 0

65 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
𝑙 − lag − time in minutes − − − − − − (1) i.e., the time from disturbance application to the tangent line
intersection.

The process reaction time T is given as;

∆CP
N= − − − − − − (2)
T

Where ∆CP − Controlled variable change in percentage

T − process reaction time in minutes

Equations (1) and (2) are used with the controlling variable change ∆P to find the controller settings.

The following gives stable definitions for various mode of control as developed by Zeigler and Nichols and corrected by
Cohen Coon for Quarter Amplitude response criterion.

A lag ratio is taken as;

66 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
N𝑙
R=
∆CP

R − lag ratio (dimensionless)

(I) Proportional mode;

∆P
KP =
N𝑙

Quarter Amplitude criterion;

∆P N𝑙
KP = (1 + )
N𝑙 3∆CP

(II) Proportional – Integral mode;

∆P
KP = 0 ∙ 9
N𝑙

1
and TI = = 3 ∙ 33𝑙
KI

Quarterly Amplitude criterion;

∆P R
KP = (0 ∙ 9 + )
N𝑙 12

30 + 3R
and TI = [ ]𝑙
9 + 20R

(III) Three mode or PID mode;

∆P
KP = 1 ∙ 2
N𝑙

TI = 2𝑙

TD = 0 ∙ 5𝑙

Quarterly Amplitude criterion;

∆P R
KP = (1 ∙ 33 + )
N𝑙 4

32 + 6R
TI = [ ]𝑙
13 + 8R

67 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
4
TD = [ ]𝑙
11 + 2R

Example;

A transient disturbance is run on a process loop. The result of a 9% controlling variable change gives a process reaction
graph as shown below. Determine the;

(I) Settings for three mode action,

(II) Three mode settings for Quarter Amplitude response.

Solution;

(I) By drawing the inflexion point tangent on the graph;

𝑙 = 2 ∙ 4 minutes , T = (7 ∙ 2 − 2 ∙ 4) minutes = 4 ∙ 8 minutes, ∆CP = 3 ∙ 9 %, ∆𝑃 = 9 %

∆CP 3 ∙ 9
Thus, N= = = 0 ∙ 8125%⁄minute
T 4∙8
68 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
The controller settings are found from the equations;

∆P 1∙2×9
KP = 1 ∙ 2 = = 5 ∙ 54
N𝑙 0 ∙ 8125 × 2 ∙ 4

100 100
Proportional Band = = = 18 %
𝐾𝑃 5 ∙ 54

TI = 2𝑙 = 2 × 2 ∙ 4 = 4 ∙ 8 minutes

TD = 0 ∙ 5𝑙 = 0 ∙ 5 × 2 ∙ 4 = 1 ∙ 2 minutes

N𝑙 (0 ∙ 8125 × 2 ∙ 4)
(II) lag ratio, R = = =0∙5
∆CP 3∙9

∆P R 9 0∙5
5K P = (1 ∙ 33 + ) = (0∙8125×2∙4) [1 ∙ 33 + ] = 6 ∙ 72
N𝑙 4 4

100 100
Proportional Band = = = 14 ∙ 9 %
KP 6 ∙ 72

32 + 6R 32 + 6(0 ∙ 5)
TI = [ ]𝑙 = [ ] × 2 ∙ 4 = 4 ∙ 94 minutes
13 + 8R 13 + 8(0 ∙ 5)

4 4
TD = [ ]𝑙 = [ ] × 2 ∙ 4 = 0 ∙ 8 minutes
11 + 2R 11 + 2(0 ∙ 5)

ANALOG CONTROLLERS;

An analog controller is a device that implements the controller modes using signals to represent the loop parameters.

The analogue signal may be in form of;

(I) An electric current,

(II) A pneumatic air pressure.

The controller accepts a measurement expressed in terms of one of these signals, calculate an output for the mode
being used and outputs an analog signal of the same type.

Because the controller does solve equations, it is an analog computer. The controller must be able to add, subtract,
multiply, integrate and find the derivative.

Electronic controllers;

In electronic methods of realizing controller modes, emphasis is on the use of Op – Amps as primary circuit element.

69 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(I) PROPORTIONAL CONTROL;

It produces a change in the controlled output in proportional to the error signal. There is a fixed relationship between
the value of the controlled variable and the position of the final control element.

If the final connecting device is a variable position valve, suppose the valve is controlling fuel to the burner. As the valve
opens, more fuel is delivered and more heat is released and vice – versa.

Suppose the temperature is 180 °F and that 40 % opening maintains that temperature. If the temperature reduces to
175 °F, the valve would open to 60 % point. If the temperature further drops to 170 °F, the valve would open to 80 %.

Therefore, the controller is responding not only to the fluid measured temperature but also to the amount of error. For
every 5 °F, the valve moves by 20 % of its full range.

In this case a measured temperature of 165 °F or less causes the valve to go to 100 % open and a measured
temperature of190 °F and above causes the valve to go to 0 % open.

The difference between these two points is called the proportional band of the controller. (25 ° F in this case). It is
usually expressed as a percentage of the full rate range of the control.

70 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Definition;

Proportional Band (PB);

(I) This is the percentage of full controller range by which the measured value must change in order to cause the
correcting device to change by 100 %, outside this band, the valve ceases to respond because it has reached its
limit.

(II) It is the reciprocal of the gain K P i.e.,

1
PB =
KP

Where PB − Is the percentage error that results in 100 % change in controller output

Example;

Taking the controller range to be between (60 − 300) °F, determine the percentage proportional band given the for the
following.

Solution;

71 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Proportional Band (PB) = (199 ∙ 2 − 151 ∙ 2) °F = 48 °F

48
Percentage PB = ( ) × 100
300 − 60

= 20 %

Disadvantage;

It cannot completely eliminate the error caused by a load change i.e., there is always an offset.

Application;

Proportional control is used when the gain can be made large enough to counter the effect of the largest load change on
the proportional offset.

An Op – Amp can be used to implement an electronic proportional controller as shown below;

Analysis;

Summing Amplifier;

72 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
e(t)
i1 (t) = ; V(t) = −i1 (t)R 2
R1

R2
Thus, V(t) = − e(t) − − − − − − (1)
R1

Inverter;

V(t)
i1 (t) = ; Vout (t) = −i1 (t)R1
R1

v(t)
Thus, Vout (t) = − × R1
R1

Vout (t) = −v(t) − − − − − − (2)

Equating equations (1) and (2) gives;

R2
Vout (t) = e(t) + v0 − − − − − − (3)
R1

Vout (t) = K P e(t) + v0 − − − − − − (4)

R2
Where Kp =
R1

Equation (4) is the time domain of proportional control.

In frequency domain, taking the Laplace transforms of equation (4)

Vout (s) = K P E(s) or

R2
Vout (s) = E(s) − − − − − − (5) frequency domain
R1

The transfer function becomes;

Vout (s) R 2
T∙F= = − − − − − − (6)
E(s) R1

Thus, by adjusting the values of R1 and R 2 , the value of the gain K P can be varied.

(II) INTEGRAL CONTROL (RESET ACTION);

73 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
The integral control mode changes the output of the controller by an amount proportional to time the integral of the
error signal i.e., the change in controller output during the interval from 0 to t seconds is proportional to the net area
under the error curve between 0 and t as illustrated below.

The rate of change of the controller output is proportional to the error signal. The rate of change is equal to the slope of
the graph.

An electronic integral controller can be implemented using the circuit diagram shown below;

74 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Analysis;

Integrator;

e(t) 1 t
i1 (t) = ; V(t) = − ∫ i1 (t) dt
R C 0

1 t e(t) 1 t
Thus, V(t) = − ∫ dt = − ∫ e (t)dt − − − − − − (1)
C 0 R RC 0

Inverter;

Vout = −V(t) − − − − − − (2)

Thus;

1 t
Vout = ∫ e (t)dt + V0 − − − − − − (3) − Time domain
RC 0

Frequency domain equations;

1 E(s) E(s)
Vout (s) = [ ]= − − − − − − (4)
RC s sRC

The transfer function becomes;

75 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Vout (s) 1 1
T∙F = = = − − − − − − (5)
E(s) sRC sTi

1
Where − Ti = = RC
Ki

Thus;

Ki
GC (s) = − − − − − − (6)
s

(III) DERIVATIVE CONTROL MODE;

The derivative control mode changes the output of the controller proportional to the rate of change of the error signal.
This change may be caused by a variation in the measured variable, setpoint or both.

The derivative mode contributes to the output of the controller only when the error is changing. For this reason, the
derivative control mode is always used in combination with the proportional or proportional plus integral mode.

The error signal e(t) is given by;

de(t)
Vout (t) − V0 (t) = K D
dt

Where V0 (t) − setpoint at t=0

de(t)
Vout (t) − Output when error is changing at the rate
dt

K D − Derivative action time constant

Response of Step and Ramp of an ideal derivative control;

76 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
At every instant, the output of the derivative control mode is proportional to the slope or rate of change of the error
signal.

The step response indicates the reason that the ideal derivative control mode is never used. The error curve has an
infinite slope when the step change occurs. The ideal derivative must respond with an infinite change in the controller
output.

In practice, the response of the derivative action to rapidly changing signals is limited. This reduces the sensitivity of the
controller to the unwanted noise spikes which frequently occurs.

The ideal and practical electronic differentiator circuits are shown below.

Ideal Differentiator;

77 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Analysis;

Differentiator;

de(t)
i1 (t) = C ; V(t) = −i1 (t)R
dt

de(t)
Thus, V(t) = −RC
dt

Inverter;

de(t)
Vout (t) = −V(t) = RC
dt

de(t)
Thus; Vout (t) = RC − − − − − − (1) OR
dt

de(t) de(t)
Vout (t) = K D = TD − − − − − − (2)
dt dt

Where K D = TD = RC

In frequency domain, equation (2) becomes;

Vout (s) = sTD E(s) − − − − − − (3)

78 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
The transfer function becomes;

Vout (s)
T ∙ F = GC (s) = = sTD − − − − − − (4)
E(s)

Practical Differentiator;

Analysis;

Differentiator;

1 t
e(t) = i1 (t)R1 + ∫ i1 (t)dt − − − − − − (1)
C 0

V(t) = −i1 R D − − − − − − (2)

Inverter;

Vout (t) = −V(t) = i1 R D

Vout (t)
i1 = − − − − − − (3)
RD

t
R1 1
Thus; e(t) = Vout (t) + ∫ Vout (t)dt + V0 (t) − − − − − − (4) Time domain equation
RD RDC 0

79 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Frequency domain equation;

Taking the Laplace transforms;

R1 1 R1 1
E(s) = Vout (s) + Vout (s) = [ + ] V (s)
RD sR D C R D sR D C out

sR1 C + 1
E(s) = [ ] Vout (s)
sR DC

Vout (s) sR D C sTD


Thus; Transfer Function (T ∙ F) = GC (s) = = = − − − − − − (5)
E(s) sR1 C + 1 sT1 + 1

The denominator term limits the response produced by rapidly changing signals.

Summary of derivative mode;

(I) If the error is zero, the mode provides no output.

(II) If the error is constant in time, the mode provides no output.

(III) If the error is changing in time, the mode contributes output K D percent for every 1% per second rate
change of error.

(IV) PROPORTIONAL PLUS INTEGRAL CONTROL;

The integral mode is frequently combined with the proportional mode to provide an automatic reset action which
eliminates the proportional offset. The combination is referred to as proportional plus integral control.

The integral mode provides the reset action by constantly changing the controller output until the error is reduced to
zero.

Step response of a proportional – plus – integral controller;

The proportional mode provides a change in the controller output which is proportional to the error signal. The integral
mode provides an additional change in the output which is proportional to the integral of the error signal.

The integral action time constant (Ti ) is the time required for the integral mode to match the change in output
produced by the proportional mode.

80 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Electronic implementation of P – I control mode;

Electronic implementation of P – I controller mode is achieved by using two resistors and a capacitor. The capacitor is
placed in series with the feedback resistor R 2 as shown below

81 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Analysis;

Integrator with gain;

e(t) 1 t
i1 (t) = ; V(t) = −i1 (t)R 2 − ∫ i1 (t)dt − V0 (t)
R1 C 0

Inverter;

1 t
Vout (t) = −V(t) = i1 (t)R 2 + ∫ i1 (t)dt + V0 (t)
C 0

t
R2 1
= e(t) + ∫ e (t)dt + V0 (t)
R1 R1 C 0

t
R2 R2 1
Vout (t) = e(t) + ( ) ( ) ∫ e(t) dt + V0 (t) − − − − − − (1); OR
R1 R1 R 2 C 0

t
= K P e(t) + K P K I ∫ e(t) dt + V0 (t) − − − − − − (2) − Time domain
0

Frequency domain equation;

Taking the Laplace transforms gives;

82 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
K P KI K P KI
Vout (s) = K P E(s) + E(s) = [K P + ] E(s) − − − − − − (3)
s s

The transfer function becomes;

Vout (s) K PKI KI


GC (s) = = KP + = K P (1 + ) − − − − − − (4)
E(s) s s

R2 1 1
Where KP = ; KI = = [∵ TI = R 2 C]
R1 R 2 C TI

Example 1;

Determine the values of R1 and R 2 for an electronic proportional – plus – Integral controller with a gain K P = 2 and an
integral action time constant (TI ) of 50 seconds. Use a 10−5 F capacitor for C. Determine also the;

(I) Time domain equation;

(II) Transfer function.

Solution;

TI = R 2 C

50 = R 2 × 10−5

R 2 = 5 MΩ

R2 𝑅2
KP = ; 𝑅1 =
R1 𝐾𝑃

5 ∙ 0 × 106
R1 = = 2 ∙ 5 × 106 Ω = 2 ∙ 5 MΩ
2

(I) Time domain equation;

t
2 t
Vout (t) = K P e(t) + K P K I ∫ e(t) dt + V0 (t) = 2e(t) + ∫ e(t) dt + V0 (t)
0 50 0

(II) Transfer function;

1
s + KI s+ 1 + 50s
GC (s) = K P [ ] = 2[ 50 ] = 2( )
s s 50s

Example 2;

83 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
The controller in example 1 has a value of V0 (t) of 32 % at time t = 0. The graph of the error signal is given below.

Determine the value of the controller output Vout at times; t = 0 secs, 10 secs, 50 secs and 100 secs.

Solution;

The controller output is given by;

t
Vout (t) = K P e(t) + K P K I ∫ e(t) dt + V0 (t)
0

But V0 (t) = 32 %, KP = 2 and TI = 50 secs

2 t
Vout (t) = 2e(t) + ∫ e(t) dt + 32
50 0

t
The term ∫ e(t) dt = net area under curve between 0 and t seconds
0

𝑡
(I) 𝑎𝑡 𝑡 = 0 𝑠𝑒𝑐𝑠, 𝑒(𝑡) = 0 𝑎𝑛𝑑 ∫0 𝑒(𝑡) 𝑑𝑡 = 0

2 t
Vout (t) = 2(0) + ∫ (0) dt + 32 = 32 %
50 0

𝑡
(II) 𝑎𝑡 𝑡 = 10 𝑠𝑒𝑐𝑠, 𝑒(𝑡) = 0 𝑎𝑛𝑑 ∫0 𝑒(𝑡) 𝑑𝑡 = 0

2 t
Vout (t) = 2(0) + ∫ (0) dt + 32 = 32 %
50 0

84 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
t
(III) at t = 50 secs, e(t) = 10 % and ∫0 e(t) dt = (10%)(50 − 20) = 300 % − seconds

2
Vout (t) = 2(10) + × 300 + 32 = 20 + 12 + 32 = 64 %
50
t
(IV) at t = 75 secs, e(t) = 0 % and ∫0 e(t) dt = (10%)(70 − 20) = 500 % − seconds

2
Vout (t) = 2(0) + × 500 + 32 = 20 + 32 = 52 %
50

(V) at t = 100 secs, e(t) = −10 % and

t
∫ e(t) dt = (−10%)(100 − 80) + (10%)(70 − 20) = (−200 + 500) % − seconds
0

= 300 % − seconds

2
Vout (t) = 2(−10) + × 300 + 32 = −20 + 12 + 32 = 24 %
50

A graph of the controller output is given below;

85 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(V) PROPORTIONAL PLUS DERIVATIVE CONTROL;

The derivative control mode is sometimes used with the proportional mode to reduce the tendency for oscillation and
allow a higher proportional gain setting.

86 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
The proportional mode provides a change in the controller output which is proportional to the rate of change of the
error signal. The derivative mode provides an additional change in the controller output which is proportional to the rate
of change of the error signal.

Proportional plus derivative control is used in processes with sudden load changes when the proportional mode alone is
not capable of keeping the error within an acceptable level.

The derivative mode provides an anticipatory action which reduces the maximum error produced by sudden load
changes. It allows a higher gain setting which helps reduce the proportional offset.

An electronic proportional – plus – derivative controller is shown below;

The equation for proportional plus derivative is given by;

dVout (t) de(t)


Vout (t) + αTD = K P e(t) + K P TD + V0 − − − − − − (1) Time domain equation;
dt dt

In Laplace transforms equation (1) becomes;

Vout (s) + αTD 𝑠Vout (s) = K P E(s) + K P TD sE(s)

Vout (s)[1 + αsTD ] = K P [1 + sTD ]E(s)

1 + sTD
Vout (s) = K P [ ] E(s) − − − − − − (2) Frequency domain equation;
1 + αsTD

Vout (s) 1 + sTD


Transfer function (T. F) = = GC (s) = K P [ ] − − − − − − (3)
E(s) 1 + αsTD

87 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Rf
Where KP = − gain
R1 + R D

R1
α= − derivative limiter co − efficient
R1 + R D

TD = R D CD − Derivative action time constant (seconds)

Example;

(a) Determine the values of R1 , R 2 and R f for an electronic proportional plus derivative controller with a gain
K P = 0 ∙ 8, a derivative action time constant TD = 1 second and a value of α = 0 ∙ 1. Use a 10−6 F capacitor for
CD. Determine the time domain equation and transfer function.

(b) If the controller in (a) above has a value of 𝑉0 (𝑡) = 40 % and the graph of the error signal is given below;

Determine the value of the controller output Vout at the following times t = 0 secs, t = 20 secs, t = 40 secs,
𝑑𝑉𝑜𝑢𝑡 (𝑠)
and t = 60 secs. Assume that the 𝛼𝑇𝐷 𝑑𝑡
term is negligible.

EXAMINATION QUESTIONS:

1. (a) Define each of the following with respect to process controllers:


(i) Tuning
(ii) Lag time (2 marks)
(b) Describe the effects of a derivative controller on a process control system (4 marks)
(c) A control system is tuned using the reaction curve method. The resulting output is shown in the figure
below

88 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Determine the:
(i) Proportional gain, K p
(ii) Integral gain, K i
(iii) Derivative gain, K D (6 marks)
2. (a) The figure below shows a digital temperature regulator/controller. Explain its principle of operation.
(6 marks)

89 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(b) (i) Define the following terms with respect to process controller:
(I) Control lag;
(II) Process lag.
(ii) Explain the function of a digital multiplexer as used in control systems. (5 marks)
3. (a) Figure below shows a diagram of a pneumatic time – delay actuator. Describe its operation.
(5 marks)

90 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(b) A data logging system monitors 15 analog loops. These loops are multiplexed into a microcomputer
through an analog – to – digital converter (ADC). The computer requires 5𝜇𝑠 to perform each
instruction. 100 instructions are required to address each multiplexer line, read in and process data in
that line. The multiplexer requires 25𝜇𝑠 to select and capture the value of an input line. The ADC
performs the conversion in 30𝜇𝑠. Determine the;
(i) Total time required to process all the 15 lines;
(ii) Sampling rate of each line. (7 marks)
4. (a) State two merits of a proportional controller. (2 marks)
(b) The figure below shows a D.C motor position control system.

91 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
The total shaft resistance due to friction and gravity is 0 ∙ 35 Nm. The motor has a torque constant of
0 ∙ 177 Nm⁄Amp and a gear ratio of 10: 1. A 350° potentiometer is connected directly to the shaft. The
shaft is to be positioned to within 5° of the set point. Determine the;
(i) Overall system gain;
(ii) Shaft torque;
(iii) Potentiometer gain;
(iv) Controller gain. (8 marks)
5. (a) With the aid of a labelled diagram, describe the operation of a single acting pneumatic cylinder.
(5 marks)
(b) A pneumatic valve is labelled 4⁄2 way;
(i) State the meaning of numbers 4 and 2;
(ii) Draw its symbol.
(c) The figure below shows a block diagram of a proportional controller. The input voltage is 10 V.
Determine the;
(i) Closed loop transfer function;
(ii) Error.

(d) Figure below shows an error signal graph. Draw the corresponding integral controller output response
to the error signal.

92 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
3. SEQUENTIAL CONTROL SYSTEMS:
Majority of industrial process control installation involves more than simply regulating a controlled variable.
Many processes in an industry does not control variable, but controls a sequence of events. These sequence of events
leads to the production of a product from raw materials.
The expression of discrete state is used to explain that each event in the sequence can be described by specification at
the condition of all operating units of the process. Such condition description might be presented by the expressions
such as valve A is open, valve B is closed, conveyor is ON, limit switch S is closed and so on.
A particular set of conditions is described as discrete of the whole system. Specification of the sequence of events in
some discrete state process is tied on the process itself. The process is specified in two parts;
Part I;
It consists of the objectives of the process
Part II;
This is the nature of the hardware assembled to achieve the objectives.
To participate in the design and development of a control system for the process, it is essential that one understands
both parts.
Process Objectives;
The objectives of the process are statements of what the process is supposed to accomplish.
These objectives are normally associated with the knowledge of the industry. Often a global objective is defined as the
end result of the plant. This is then broken down into individual mostly secondary objectives to which the actual control
is applied.
93 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Applications of Sequential Control System
(I) Liquid – Level Control using Level probes;

X 0 − High level probe sensor;


X1 − Low level probe sensor;
The level probes oscillate at resonance frequency, once they come into contact with water, their frequencies drop.
Ladder Logic diagram;

94 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
When the start button X 2 is pushed, it will hold on the memory bit M1 and when X 3 is momentarily pressed, it turns OFF
the memory bit M1 .
Now if X 2 is closed, memory bit turns ON. M1 contact closes and the tank starts filling. As soon as the water level
touches the probe X1, the normally closed contact of the PLC opens but still the inlet valve continues filling the tank
since its contact Y0 is still closed.
As soon as water level touches the probe X 0, the normally closed contact opens and inlet contact turns OFF too. The coil
Y0 stops.
When the discharge valve is opened, the water drains from the tank, when the level reaches below the X 0, its contacts
closes but the Y0 .
The water continues draining and when the level drops below the probe X1 , it closes the normally closed contact X1 and
Y0 contacts thus opening the valve and filling the tank. This cycle continues repeatedly.
EXAMINATION QUESTIONS:
1. (a) The figure below shows a diagram of PLC controlled pick and place robot that picks up parts from a
conveyor belt and places them on another belt. When a part moving on the lower conveyor belt
activates switch 1, the motor turns in anticlockwise direction to move the gripper to the pick-up
position. When the gripper reaches switch 2, the motor stops and the solenoid powered gripper clamps
on the part. After 2 seconds, the motor turns in the clockwise direction to move the gripper to the drop-

95 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
point. When the gripper reaches switch 3, the gripper's solenoid is de-energized to drop the part onto
conveyor 2. Draw a ladder diagram program for this operation (8 marks)

2. (a) State THREE advantages of programmable logic controllers (PLCs) over relays in industrial control.
(3 marks)
(b) Draw a circuit diagram for each of the following PLC interfaces:
(i) Opto – isolator input;
(ii) Darlington output;
(iii) TRIAC output. (6 marks)
(c) Figure below shows a ladder diagram for controlling a drilling machine using a PLC.

96 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(c) (i) Write down the program listing for the control.
(ii) Identify two physical contacts for each of the following:
I. inputs;
II. outputs. (11 marks)
3. (a) Describe the operation of a sequential control system. (3 marks)
(b) Describe each of the following components found in a SCADA network:
(i) Data Acquisition Server;
(ii) Human Machine Interface;
(iii) Communication Interface. (6 marks)
(c) (i) State three types of timers found in PLCs. (3 marks)
(ii) A program is used to carry out sequential switching ON of three motors A, B and C. When the
start switch is closed motor A starts, 10 seconds later, motor B starts and 30 seconds motor C
starts. Draw the ladder diagram for the control.
(iii) Explain the operation of the switching in c (ii). (8 marks)
4. (a) Draw the ladder symbols for each of the following:
(i) Normally Open (NO) input contact;
97 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(ii) Counter;
(iii) Timer. (3 marks)
(b) The figure below shows a diagram of a programmable logic controller (PLC) for controlling two lamps L1
and L2 connected to the PLC output module ports OUT0 and OUT1 respectively. Two external switches,
SW1 and SW2 are connected to the PLC via input ports IN0 and IN1. Lamp L1 will light if both switches
are closed while lamp L2 will light if either of the switches is closed.
(i) Draw the truth table for the lamp control;
(ii) Write a logic equation for the lamp;
(iii) Draw a ladder logic program for the lamp control. (11 marks)

(c) With the aid of a diagram, describe a point – to – multipoint alarm system stating its merits.
(6 marks)

5. (a) Draw a labelled block diagram of a programmable logic controller (PLC) and state the function of each
part. (6 marks)

98 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(b) The figure below shows a ladder diagram for controlling the cyclic movement of an engine piston. Write
down the program listing. (8 marks)

6. (a) (i) State three advantages of Programmable Logic Controllers (PLCs) over personal computers (PC)
in control.

(ii) The figure below shows a diagram of a water tank under program control using a PLC. When the
water falls below the float switch, the tank’s top – up valve is automatically opened. If the water
level remains below the float switch level for more than 2 minutes an alarm 𝑌1 is activated.
Draw a ladder diagram program for the system. (10 marks)

99 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
DIGITAL CONTROL SYSTEMS:

1. (a) (i) Define aperture time with respect to data loggers.

(ii) A data logger has an analog input signal of 40 KHz and a qauntizer of 12-bits. Determine its
aperture. (3 marks)

(b) With the aid of a diagram, describe the operation of a counter-type analog-to-digital converter.
(7 marks)

4. ROBOTS FUNDAMENTAL AND ROBOTS PROGRAMMING:

The word robot refers to an automated multifunctional manipulator that works by energy, to perform a variety of tasks.
1.0 DEFINITION OF A ROBOT
▪ A robot is a computer-controlled machine that is programmed to move, manipulate objects, and accomplish
work while interacting with its environment.
▪ According to the Robot Institute of America (1979), a robot is defined as “a reprogrammable, multifunctional
manipulator designed to move material, parts, tools, or specialized devices through various programmed
motions for the performance of a variety of tasks.”

100 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Or
▪ Industrial robot is defined as “a number of rigid links connected by joints of different types that are controlled
and monitored by computer.”
1.1 FUNCTIONS OF A ROBOT
The functions of a robot can be classified into THREE areas:
▪ Sensing – the environment by external sensors e.g., vision, voice, touch, proximity etc.
▪ Decision making – based on information received from the sensors.
▪ Performing – the task decided.
1.2 ADVANTAGES AND DISADVANTAGES OF ROBOTS
The following are the advantages and disadvantages of employing robots:
Advantages:
1. Lifting and moving heavy objects
2. Working in hostile environments
3. Providing repeatability and consistency
4. Working during unfavorable hours
5. Performing dull or monotonous jobs
6. Increasing productivity, safety, efficiency and quality of products
7. Achieving more accuracy than human beings
Disadvantages:
1. Lack capability to respond in emergencies
2. The initial and installation costs of equipment of robots are quite high
3. They replace human workers, thus causing resentment among workers

1.3 TYPES OF INDUSTRIAL ROBOTS:


Industrial robots can be broadly divided into 2 main groups:
1. General purpose robots
▪ These robots carry standard designs and parts are readily available
▪ They can be easily adapted to the users’ requirements by attaching suitable end – effectors or fingers to them
according to the requirement of the work, such as a part picking operation, welding operation, spray painting
etc.
▪ They are cheaper, thus are mass produced
2. Special purpose robots

101 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ These robots are tailor made to specific job requirements. The ultimate user has to feed his requirements and
based on them, these robots are specially designed and built to cater to specific needs. Thus, their design and
manufacturing consume a lot of time and are not readily available in the market.
▪ They are very expensive, hence cannot be manufactured in large scale.
Robots may be categorized as follows
1. Tele – robots
▪ Are guided by human operators through remote control
2. Tele – presence robots
▪ This type of robot is similar to a tele – robot with a difference that is provided with a feedback of video, sound
and other data.
3. Mobile robots
▪ They are also designed to navigate and carry out the task with the intervention of human beings.
4. Autonomous robots
▪ These robots carry their tasks independently and receive their power from their environment.
5. Androids
▪ These robots are built to mimic humans.
6. Static plus industrial robots
▪ these are widely used arms employed in factories and laboratories
1.4 ROBOTIC SYSTEM:
A system is an integral whole of parts or subsystems.
It has a specific goal or output for a given set of inputs; a system may have many goals as well.
▪ A robot is a system as it combines several subsystems that interact themselves as well as with the environment
in which that robot works
▪ A robot has some specific objective. It may be designed for the following jobs/assignments;
I. To pick and place the work pieces
II. To interact with and work load a lathe, a milling machine or any equipment
III. To perform some assembly work
▪ To accomplish these assignments a robot should have the following components;
a) Manipulator arms – with specified co – ordinate system to attain a designed reach in work piece
b) Gripper – to match the geometry of the work piece to be handled
c) Control system – with or without servo – mechanisms for sending signals to the drives or permitting
storage of programs and data for desired path planning with adequate speed and good accuracy

102 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
d) Sensors – to feedback information for modifying the motion or path
e) Controller – is provided with interfacing units connected to external equipment
▪ The fig below shows a scheme of robotic system

a) Base – It may be fixed or mobile


b) Manipulator arm
▪ The most obvious mechanical configuration of the robot is the manipulator arm
▪ There are several designs of the arm to facilitate movement with the work piece envelope with maximum
possible load and speed with high precision and repeatability.
▪ A simple robot may be a two or three axes arm.
▪ A robot manipulator arm consists of several separate links making a chain. The arm is located relative to the
ground on either a fixed base or a movable base. It has a free end where an end – effector or gripper or
sometimes a specialized tool holder (for holding welding gun or drill etc.) is attached.
c) End – effector
▪ This is the gripper or end of arm tooling. End – effector is task – specific.
▪ The wide range of gripping methods includes
(i) Mechanical clamping
(ii) Magnetic gripping
(iii) Vacuum (Suction) gripping

103 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
d) Actuators and Transmission:
Actuators: The robot arm can be put to a desired motion with its payload if actuator modules are fitted in to
provide power drives to the system. There are 3 different types of power drives in use. i.e.
(i) Pneumatic drives
▪ They are composed of air to move the robot arm. They may employ linear actuator i.e. double acting cushioned
cylinders or it may employ rotary actuators like vane motors
Advantages of pneumatic actuators
a) Simple construction
b) Relatively inexpensive
c) Fast
d) Reliable
Disadvantages
a) Smaller payloads
b) Reduced repeatability
(ii) Hydraulic drives
▪ In this system, the electric motor pumps fluids (oil) from a reserve tank to the hydraulic actuators which are
double acting piston cylinder assemblies. Fluid at a higher pressure passes through the control valves before its
entry into the linear actuators.
Advantages of Hydraulic drives
a) They have high payload capabilities
b) Relatively easy to maintain
Disadvantages
a) Expensive
b) Not accurate
(iii) Electrical drives
▪ DC servo motors, Brushless DC motors, Reversible AC servo motors and stepper motors are important electrical
drives.
Advantages
a) They are clean and quiet with high degree of accuracy and reliability.
b) They also offer a wide range of payload capacity.
Disadvantage
a) They are very expensive

104 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Transmissions: These are elements between the actuators and the joints of the mechanical linkage. They are
generally used for the following reason:
a) Often the actuator output is not directly suitable for driving the robot linkage.
b) The output of the actuator may be kinematically different from the joint motion.
c) Actuators are usually big and heavy and often it is not practical to locate the actuator at the joint.
e) Controller:
▪ It provides the intelligence that is necessary to control the manipulator system. The controller coordinates the
sensory information and computes the control commands that must be sent to the actuators to carry out the
specified task. It generally includes:
a) Memory to store control program and the state of the robot system obtained from the sensors.
b) Computational unit that computes the control commands.
c) The appropriate hardware to interface with the sensors and actuators.
d) The hardware for a user interface.
▪ The ‘user interface’ allows the uses of a human operator to monitor or control the operation of the robot.
The operation of the robot must:
a) Have a display that shows the status of the system
b) Have an input device that allows the human to enter commands to the robot
▪ The user interface may be a ‘personal computer’ with the ‘appropriate software’ or ‘teach pendant’
f) Sensors:
▪ They perform the following functions:
a) Act as feedback devices to direct further actions of the manipulator arm and the end effector (gripper)
b) Interact with the robot’s working environment.
▪ There are 2 basic types of sensors. These includes:
(I) Tactile sensors
▪ These are contact sensors that must be brought into contact with the object to obtain signals to measure the
necessary qualities.
▪ When tactile sensors make physical contact with the object, an electrical signal is generated and sent to the
robot controller.
▪ The electrical signals may be obtained through the contacts of micro switches, electrical strain gauges or piezo
electric crystals
▪ Typical contact type robotic sensors include;
a) Force sensors

105 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
b) Torque sensors
c) Touch sensors
d) Position sensors
(II) Non-Tactile sensors
▪ These are contactless sensors which sense the signal remotely, but only with the specified range of distance
from the object.
▪ They detect and measure magnetic fields, infra-red and ultraviolet light, x-rays, electrical fields, ultrasonic sound
waves or electromagnetic waves.
▪ Typical non – contact robotic sensors include:
a) Proximity sensors
b) Electro – optical sensors
c) Range imaging sensors
Basic Motions:
▪ The six basic motions or degrees of freedom (DOFs) are as follows (from the figure above)
a) Vertical motion:
▪ The entire manipulator arm can be moved up and down vertically either by means of the shoulder swivel, i.e.,
turning it about a horizontal axis or by sliding it in a vertical slide.
b) Radial motion:
▪ In and out movements, to the manipulator arm is provided by Elbow extension by extending it and drawing back.
c) Rotational motion:
▪ Clockwise or anticlockwise rotational about vertical axis to the manipulator arm is provided through arm sweep
d) Pitch motion:
▪ It enables up and down movement of the wrist and involves rotational movement as well.
▪ It is also known as wrist bend.
e) Roll motion:
▪ Also known as wrist swivel, it enables rotation of the wrist
f) Yaw
▪ Also called wrist yaw, it facilitates rightward or leftward swiveling movement of the wrist.

▪ The most versatile robots can have the following degrees of freedom (DOFs):
a) Horizontal travel
b) Rotary movement

106 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
c) Radial arm movement
d) Vertical arm movement
e) Rotary wrist movement
f) Wrist bend
g) Wrist sweep
▪ These axes of movement enable movements to be programmed that duplicate those of a human operator in
performing a job.

1.5 ROBOT CLASSIFICATIONS


▪ Robot classification are enumerated and discussed below:
1) Standard classification.
2) Broad classification.
3) General classification.
1.51 Standard Classification
▪ Two standard classifications are:
a) Mechanical configuration based
b) Control method based
▪ The classification based on ‘mechanical configuration’ considers the various joints and links comprising the physical
structure of the robot and their relationship to each other.
▪ The classification by ‘control’ pertains to the type of technique implemented to control the robot. This classification
considers the following subclasses
➢ Non – servo controlled
➢ Servo controlled
Each of these classification techniques is discussed as under
1.51.1 Mechanical configuration
▪ Majority of commercially available robots can be grouped into 4 basic configurations:
a) Cartesian coordinate configuration
b) Cylindrical configuration
c) Spherical configuration
d) Jointed – arm configuration (Revolute)
a) Cartesian coordinate (rectilinear or gantry) configuration
▪ It has 3 mutually perpendicular axes which defines a rectangular work volume.

107 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ In this configuration, the links of the manipulator are constrained to move in a linear manner. Axes of a robotic
device that behaves in this manner is referred to as ‘prismatic’.

▪ The Cartesian devices maybe of two types:


a) Cantilevered Cartesian
▪ Such devices tend to have a limited extension from the support frame, are less rigid, but have a less restricted
work space than other robots.
▪ They have good repeatability and accuracy and are easier to program.
b) Gantry – style Cartesian
▪ Such robots are used when extremely heavy loads must be precisely moved.
▪ They are often mounted on the ceiling.
▪ They are generally more rigid but provide less access to the work space
b) Cylindrical configuration
▪ These robots use a vertical column with the robot arm attached to a side which can move up and down the column.
Simultaneously the arm can move radially with respect to the column.
▪ Usually, a full 360° rotation in θ is not permitted, due to restrictions imposed by hydraulic, electrical, or pneumatic
connections. Also, there is minimum as well as maximum extension due to mechanical requirements.
▪ Consequently, the overall volume or work envelope is a portion of a cylinder.

108 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
c) Spherical configuration
▪ This configuration has a telescopic arm which pivots about a horizontal axis and also rotates about a vertical axis
▪ Owing to mechanical and actuator connection limitations, the work envelope of such a robot is a portion of a sphere

d) Jointed – arm configuration (Revolute)


▪ This resembles the human arm and consist of a series of links connected by rotary joints which when referenced
from base are referred to as the shoulder, arm and wrist joints.
▪ There are 3 different types of jointed arm robots:
1) Pure spherical
2) Parallelogram spherical
3) Cylindrical
▪ These devices are relatively inexpensive and are used in applications that require rapid and smooth motion.

109 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
1.51.2 Control configuration
▪ Several techniques have been developed to control the various axes of a robot simultaneously. The two general
classes are:
a) Non – servo-controlled robots
▪ They are also called limited sequence robots, end – points robots, pick and place robots or bang – bang robots
▪ Such a robot is controlled by setting mechanical stops or limit switches to establish end points of travel of each
point.
b) Servo controlled robots
▪ These robots are normally subdivided into either continuous – path (CP) or point – to – point (PTP) devices. In
either case, information about the position and velocity or other physical quantities is continuously monitored
and fed back to the control system associated with each of the joints of the robots. Consequently, each axis
loop is closed.
▪ Use of closed loop control permits the manipulator’s members to be commanded to move and stop anywhere
within the limits of travel for the individual axes.
▪ It is also possible to control the velocity, acceleration, deceleration and jerk for various axes between the end
points.
1.52 Broad Classification
▪ Robots can be broadly classified as follows:
1) Programmable /reprogrammable general-purpose robots:
▪ These robots operate fully by programmed computer control
▪ The robot is taught beforehand to perform the necessary action in the teach mode. It can the take over and
execute the operation repetitively e.g., in welding, painting, assembly of components for mass manufacture,
loading/unloading of jobs into and from machine tools etc.
2) Tele – operated, man – controlled robots or man – in – the – loop manipulator:

110 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ These robots are man – controlled since they are employed in situations where it is not possible to anticipate all
the notion and handling requirements in such details as to render them programmable or teachable for machine
control
▪ This type of requirement is found in hazardous locations.
3) Intelligent robots:
▪ They are very advanced state of the art robots and possess adequate artificial or machine intelligence.
▪ They can explore the environment on their own, machine perceptions and evaluate them in real time and also
execute the necessary motor functions matching the actions of their sensory functions.
▪ They are built with mobility to not only move over floors but also to climb, ability to avoid obstacles, high power
– to – weight ratios, compactly assembled, with on board sensors, instruments and power supplies.
1.53 General Classification:
▪ According to general methods robots are classified as:
1) Special purpose robots
▪ They are designed and produced for a limited range of specific jobs e.g. welding, painting, casting, assembly,
material handling etc.
➢ They use manipulators with limited degree of freedom.
➢ The arms may be activated either hydraulically or pneumatically.
➢ The program of robot’s movements is recorded in its memory in sequence.
2) General purpose robots
▪ They are designed and produced to form a wide variety of jobs.
▪ They may be non – servo – controlled, servo – controlled or sensory type depending on sophistication.
a) Non – servo – controlled robots:
▪ These robots are the simplest type and have inherent limited control sequence characteristics.
▪ Their arms are operated by an open loop between exact end point positions on each axis. In point – to – point
control, only end points are defined and how these are achieved i.e. how the arm moves to reach end points is
of concern. However, in trajectory control, all points between start and end points are predefined.
b) Servo – controlled robots:
▪ They utilize the position velocity, acceleration, force and torque sensors additionally in order to estimate the
internal state of the manipulator. If the states at any time are in deviation to predetermined operational
parameters of the program, then the corrective action is taken to reduce the deviation to zero.
c) Sensory robots

111 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ These robots employ both internal control and external sensors, external sensors include TV cameras, pressure
detectors, magnetic sensors, force – torque sensors, laser range finders etc.
▪ The sensors find out the robot’s relation to its environment and determine the location of the parts to be
handled.
▪ The computer based on information from sensors, effect appropriate program modifications thus coping with
changing requirements and unpredictable situations.
1.60 SELECTION OF A ROBOT:
▪ The following factors should be considered while selecting a robot for a particular application:
1) Loading capacity required.
2) Adequate number of degrees of freedom.
3) Speed of movement.
4) Reach.
▪ Robots may be powered:
1) Electrically
2) Hydraulically
3) Pneumatically
▪ The electrically powered robots have the advantage of accurate movements and quite operation.
1.70 ROBOTS QUALITIES:
▪ The following qualities are expected in robots:
1) Tactile sensing:
▪ Robot with tactile sensor can identify an object and perform the function based on referenced data.
2) Vision:
▪ By incorporating vision systems, the utility of robots is increased.
▪ Vision system is capable of identifying the part for pick – up by pattern recognition data base on object’s
silhouette have been developed. Such systems can transform the position and orientation of the object into
robot coordinates enabling the robot to acquire the object in a known manner.
3) Mobility:
▪ To handle intermittent and asynchronous demands, compact mobile device which would move in complex paths
and access large area economically are developed.
4) Other important qualities:
➢ General purpose hands
➢ Computer interpretation of the visual and tactile data

112 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
➢ Multiple appendage hand – to – hand coordination
➢ Minimized spatial intrusion
➢ Man – robot voice communication
➢ Inherent safety
➢ Interaction with other technologies
➢ Total self-diagnostic fault tracing
1.80 ROBOT SPECIFICATIONS:
▪ The various specifications are:
1) Work envelope (work volume of a manipulator)
▪ Is defined as the envelope or space within which the robot can manipulate the end of the wrist.
▪ It depends on the number of types of joints, physical size of the joints and links and the ranges of various joints.
2) Load carry capacity
▪ The load carrying capacity of a robot depends on:
➢ Its physical size and construction
➢ Its capability to transmit force and torque to the end effector in the wrist
3) Speed of movement
▪ Is the speed at which a robot is capable of manipulating its end – effector
▪ It is governed by:
➢ The distance to be moved
➢ The weight of the part to be moved
➢ The accuracy required in placement of the part in position
▪ Heavier parts and higher placement accuracy position demand slower movements while the lighter parts can be
moved at faster speeds
4) Repeatability
▪ This is the measure of the robot’s ability to position an object at a previously taught point in the work envelope.
5) Control resolution
▪ This relates to the system’s capability to divide the range of the total movement into closely spaced points that
can be identified. Thus, it would represent the minimum noticeable movement achievable.
▪ The controller can generate pulses of very small duration but the positioning device should be able to respond
and change its position accordingly.
𝐑𝐚𝐧𝐠𝐞 𝐨𝐟 𝐦𝐨𝐯𝐞𝐦𝐞𝐧𝐭
𝐜𝐨𝐧𝐭𝐫𝐨𝐥 𝐫𝐞𝐬𝐨𝐥𝐮𝐭𝐢𝐨𝐧 =
𝟐𝐧
Where, n – Number of bits devoted to a joint

113 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
𝟐𝐧 – Number of addressable points
6) Spatial resolution
▪ Spatial resolution combines the control resolution of all motion and also considers the mechanical errors in the
points and associated links.
7) Mechanical errors
▪ Mechanical errors arise from:
➢ Backlash in gears
➢ Hysteresis
➢ Deflection of links
➢ Hydraulic leaks
8) Accuracy
▪ Accuracy is the measure of the ability of robot to position the end of wrist at a desired location in the work
envelope.
9) Stability
▪ It relates to the amount of overshoot and oscillations in robot motion as it is about to reach certain location.
▪ A stable system has less oscillation but it becomes inherently slower in response.
Example 1:
One of the links of a robot has a telescoping arm with a stroke of 768 mm. The control memory of the robot has 8 – bit
storage capacity for this axis. Determine the control resolution for the same.
Solution:
Stroke length (Range of movement) = 768 mm
Bit storage capacity for the axis, n=8
768
control resolution = = 3 mm
(2)8
Example 2:
A certain robot has a slide with a total range of 1.2 m and it is desired that will have a control resolution of 4.6 mm on
this axis. Determine the bit storage capacity which the control memory must possess to accommodate this level of
precision.
Solution:
total range = 1.2 m or 1200 mm; Control resolution = 4.6 mm
Range of movement
control resolution =
2n
Range of movement
2n =
control resolution
114 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
1200
=
4.6
= 260.87
log 260.87
𝑛=
log 2
= 8.022 ≈ 8 bit
Example 3:
The telescopic arm of an industrial robot obtains total range of rotation of 120°. The robot has a 12 –bit storage capacity
for the axis. The arm fully extends to 1500 mm and fully retracts to 750 mm from the pivot point. Determine the robot’s
control resolution for the axis
I. In degrees of rotation
II. On linear scale
Solution:
Range of rotation
I. control resolution of rotation =
2n
120
= = 0.0293°
(2)12
Range of movement (Hmax − Hmin )
II. control resolution for translation =
2n
1500 − 750
=
(2)12
= 0.183 mm
1.90 ROBOTS PERFORMANCE TESTING
(a) Geometric values:
▪ The geometric values include the following:
(i) Workspace: It is the envelope reached by the centre of the interface between the
wrist and the tool, using all available axis motions.
(ii) Static behavior: It indicates the deformation of a fixed robot structure under
different load cases.
(iii) Position accuracy: It is the repeatable accuracy that can be achieved at nominal
load and normal operating temperature.
(iv) Path accuracy: it indicates at what level of accuracy programmed path curves can be
followed at nominal load.
▪ Following are the typical errors in path accuracy of a robot:
a) Path accuracy or mean – path dispersion error

115 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
b) Trailing error or mean – path deviation
c) Overshoot during acceleration/deceleration
(v) Reproduction of smallest steps: The slip – stick effect may become serious when the velocities are
very low.
(vi) Synchronous travel accuracy: It relates to cases where robot has to perform tasks synchronous to
a moving conveyor as in spray painting and assembly
(vii) Long – term behavior: It provides information on the time required to achieve thermal stability .
(b) Kinematic values:
▪ The kinematic values include cycle time, speed, acceleration.
▪ It involves measuring of attainable cycle times for a defined sequence in different areas of the working.
(c) Dynamic values:
▪ It involves determination of dynamic behavior of simple components and the total structure.
(d) Power noise values:
▪ These values are usually measured in decibel at a distance of one meter from the working space.
(e) Thermal values:
▪ The change in temperature affect deviation of the structure.
1:91 ROBOTS KINEMATIC CONTROL
(a) Robot Arm Kinematics
It deals with analytical study of the geometry of motion of a robot arm with respect to a fixed reference co – ordinate
system without regard to the forces/moments that cause the motion.

Forward and reverse Kinematics

▪ When the position and orientation of end – effector, for a manipulator are derived from the given joint angles
and link parameters, the scheme is called the forward kinematics problem.
▪ When the joint angles and the different configurations of the manipulator are derived from the position and
orientation of the end – effector, the scheme is known as the Inverse/Reverse Kinematics problem.
▪ Since the independent variables in robot arm are the joint variables, and the task is usually stated in terms of the
reference coordinate frame, the inverse kinematics problems is used more frequently
1.92 ROBOT SENSING AND VISION:
Robot sensing:
▪ A robot can interact with its environment in a flexible manner with the use of external sensing mechanisms.
▪ There are two principal categories of robot sensors, these are:
(i) Internal state sensors
116 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ These sensors deal with the detection of variables such as arm joint position, which are used for robot control.
(ii) External state sensors
▪ These sensors deal with the detection of variables such as range, proximity and touch.
▪ External sensing is used for robot guidance, as well as for object identification and handling.
Robot vision:
▪ It is a process of extracting, characterizing and interpreting information from images of a three-dimensional
world.
▪ This process commonly referred to as machine or computer vision may be subdivided into six areas:
(i) Sensing (ii) Preprocessing (iii) Segmentation (iv) Description
(v) Recognition (vi) Interpretation
2: 00 ROBOTIC SENSORS AND VISION:
▪ A sensor is a transducer used to make a measurement of a physical variable.
▪ For a robotic manipulator to operate effectively and intelligently and enable it work in an unstructured
environment, it must be equipped with sensors which give information about itself and its environment.
▪ The computer – cum – controller operating the robot must receive the information from the sensors and
process it in real time for decision making.
▪ Robots capable of making such decision are called intelligent robots, the environment sensing is called
intelligent sensing and the sensors used for such operations are called intelligent sensors.
▪ The intelligent sensors need associated hardware and software to process the signals from the robot’s data
acquisition system. The performance capability and flexibility of a robot are greatly dependent on data –
acquisition system.
2.10 CHARACTERISTICS OF A SENSING DEVICE:
▪ A sensory device should possess the following characteristics:
▪ Range: It refers to the minimum and maximum change in input signal to which the sensor can respond.
The sensor should have a wide operating range.
▪ Response: The sensor should be capable of responding to changes in the sensed variable in minimum time.
Ideally, the response should be instantaneous.
▪ Accuracy: The measurement accuracy should be as high as possible.
The sensor's output should properly reflect the input quantity being measured or sensed.
▪ Sensitivity: The sensitivity relates to the change in the output exhibited by the sensor for the change in input.
It should be as high as possible.
▪ Linearity: The sensory device should exhibit the same sensitivity over its entire operating range.

117 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ It should be suitable for the environment in which it is to be employed.
▪ It should have a suitable physical size, cost and ease of operation.
▪ It should not disturb or have any effect upon the quantity it senses or measures.
▪ It should include isolation from receiving excess signals or electrical noise that could give rise to the possibility of
mis – operation or damage of the sensor circuit or system.
2:20 TYPES OF SENSORS:
A. The sensors can broadly be classified as:
(i) Internal state sensors:
▪ There are used to measure position, velocity or acceleration of robot joints and/or the end-effector.
▪ The following devices fall into this class:
(i) Potentiometers ("pots"); (ii) Resolvers; (iii) Optical encoders; (iv)
Differential transformers (i.e., LVDTS and RVDTs) (v) Synchros (iv) Linear
inductive scales; (vi) Optical interrupters; (viii) Tachometer (ix) Accelerometers
etc.
(ii) External state sensors:
▪ These are used to monitor the robot's geometric and for relation to its task, environment or the objects that it is
handling.
▪ Such devices can be of either visual or nonvisual variety.
▪ The following devices are included in this class:
(i) Strain gauges; (ii) Proximity devices; (iii) Electromagnetic sensors; (iv)
Pressure transducers; (v) Ultrasonic sensors etc.
B. The sensors can also be classified as follows:
(i) Tactile sensors:
▪ These are contact sensors that must be brought in contact with the object to obtain signals to measure the
necessary quantities.
▪ When the tactile sensors make contact with the object, an electrical analog or digital signal is generated and
sent to the robot controller.
▪ Electrical signals may be obtained through the contact of microswitches.
▪ Signal may also be obtained through mechanical pressures which change resistances of electrical strain gauges
or generate electrical potentials in piezoelectric crystals.
▪ Typical contact type robotic sensors include:

118 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(i) Force sensors; (ii) Torque sensors; (iii) Position sensors; (iv) Touch
sensors;
▪ Tactile sensors are:
(i) Microswitches: Signaling the current under rated voltage
(ii) Piezoelectric crystals: Generating voltage under pressure.
(iii) Potentiometers (Linear or Rotary): Measuring current or voltage drop.
(iv) Electric strain gauges: Changing electrical resistance.
(v) Linear voltage differential transformer (LVDT): Measuring output voltage.
(vi) Resolvers: Counting position.
(vii) Encoders (Absolute or Incremental): Informing angular position.
▪ Tactile sensors can be used to sense a diverse range of stimulus ranging from detecting the presence or absence
of a grasped object to complete tactile image.
▪ A tactile sensor consists of an array of touch sensitive sites, the sites may be capable of measuring more than
one property.
(ii) Non-tactile sensors:
▪ These are contactless sensors which sense the signals remotely, but only within the specified range of distance
from the object.
▪ These sensors detect and measure magnetic fields, infrared and ultra violet light, X-rays, electrical fields,
ultrasonic sound waves or electromagnetic waves.
▪ Non-tactile/non-contact sensor are:
(i) Proximity sensors: Knowing the presence of the object.
(ii) Range imaging sensors: Measuring the range (distance).
(iii) Ultrasonic sensors: Measuring range by sound waves.
(iv) Electro – optical vision sensors: Computer vision or image processing for
contour search.
(v) Magnetic sensor: Measuring Hall voltage.
C. Robotic sensors can also be classified as follows:
▪ Status sensors: Are used to detect position, velocity, acceleration, torque, force etc.
(i) Potentiometer; (ii) Tachometer; (iii) Optical encoder;
(iv) Microswitch etc.
▪ Environment sensor: Are used to detect presence, motion, force, torque, touch/ tactile, etc.
(i) Contact sensors:

119 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ Pressure, force, slip, torque, surface finish, temperature, pH etc.
(ii) Non-contact sensors:
▪ Visional, optical, acoustic, infrared, proximity, range, temperature, chemical etc.
▪ “Contact or touch sensors” are one of the most common sensors in robotics.
▪ These are generally used to detect a change in position, velocity, acceleration, force, or torque at the
manipulator joints and/or the end-effector.
▪ These are mainly of two types:
(i) Bumper type sensor:
▪ They detect whether they are touching anything, the information is either "Yes" or "No". They cannot give
information about how hard is the contact or what they are touching.
(ii) Tactile sensors:
▪ These are more complex and provide information on how hard the sensor is touched, or what is the direction
and rate of relative movement.
▪ "Non-contact sensors" are used to get parametric information about the environment, task, objects in the
workspace and to detect presence, distance or features of the workpiece.
TOUCH OR TACTILE SENSORS
▪ In robotics, touch or contact sensors are used to obtain information associated with the contact between a
manipulator hand and objects in the workspace.
▪ Touch/Contact sensors can be subdivided into the following two principal categories:
(i) Binary sensors
(ii) Analog sensors
(i) Binary Sensors:
▪ A binary sensor is a contact device e.g. microswitch.
▪ A switch is placed on the inner surface of each finger of a manipulator hand as shown in the figure below.
▪ Furthermore, with the movement of the hand over the object and sequentially making contact with it surface, it
is possible to center the hand over the object for grasping and manipulation.
▪ For providing further tactile information, multiple binary touch sensors can be used on i the inner surface of
each finger.
▪ Besides this, the binary sensors are often mounted on the external surfaces of ad manipulator hand to provide
control signals useful for guiding the hand throughout the workspace.
(ii) Analog Sensors:
▪ The output of an analog sensor (compliant device) is proportional to a total force.

120 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ An analog device consists of a spring-loaded rod which is mechanically linked to a rotating shaft in such a way
that the displacement of the rod due to a lateral force result in a proportional rotation of the shaft.
▪ The rotation is then measured continuously using a potentiometer or digitally using a code wheel. Knowledge of
spring constant yields the force corresponding to a given displacement.

POSITION AND DISPLACEMENT SENSORS

These sensors are employed as components of the robot control systems

▪ The robot's control structure needs to know the position of each joint in order to calculate the position of the
end-effector thus enabling the successful completion of the programmed task.
▪ The movements of the joint can be either linear or angular/rotary depending on the type of robot
▪ The two main types of position sensors are:
(i) Absolute
(ii) Incremental
Some common devices which are used as position sensors are:
a) Potentiometers (Pot)
▪ A pot is the simplest device that can be used to measure position.
▪ Potentiometers are analog devices whose output voltage is proportional to the position (angular or linear) of the
wiper.
▪ Pots when applied to robots can be made to monitor either angular position or a revolute joint or linear position
of a prismatic joint.
▪ A potentiometer can be constructed by winding a resistive element in a coil configuration. By applying a D.C.
voltage 𝑉𝑖𝑛 across the entire resistance 𝑅, the voltage 𝑉𝑜𝑢𝑡 is proportional to the linear or rotary distance of
sliding contact or "wiper" from reference point A.

𝑟
Mathematically, 𝑉𝑜𝑢𝑡 = 𝑅 𝑉𝑖𝑛

where, 𝑟 −The resistance of the coil between the wiper and the reference.

b) Encoders(optical)
▪ Encoders (non-contact devices) give digital signals directly.
▪ "Optical encoder" is one of the most widely used position sensors, due to the following merits: (i) Simple
construction

121 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(ii) Low cost
(iii) Ease of application
(iv) Versatility.
▪ It converts linear or angular displacement into digital code or pulse signals
▪ Capable of resolutions that are more than adequate for robotic applications these non-contact sensory devices
come in two distinct classes:
(1) Absolute encoders:
▪ These encoders provide actual position relative to a fixed reference (zero) position.
▪ Their output is a digitally coded signal with distinct digital code indicative of each particular least significant
increment of resolution.
▪ The encoder is able to give linear or rotational position even if power has been applied to the electromechanical
system using the sensor. Thus, a robot joint equipped with an absolute encoder will not require any calibration
cycle since the controller will immediately, upon power-up, know the actual joint position.
(2) Incremental encoders:
▪ These encoders sense the position from previous position.
▪ Their output is a pulse for each increment of resolution but these make no distinction between increments.
▪ Such a sensor only provides positional information relative to some reference point.
▪ A robot utilizing an incremental encoder must, therefore, first execute a calibration sequence before "true"
positional information can be obtained.
Although either linear or rotary encoders for both of the foregoing classes are available, the rotary device is almost
exclusively used in robotic applications.

Construction of an optical encoder:

▪ The optical encoder consists of the following three basic comfortable:

(i) A light source: It can be an incandescent lamp or infrared light-emitting diode (LED).

(ii) A rotary or translatory disc: The disc has alternate opaque and transparent sectors,
which are etched by means a photographic process on a plastic disc or slots are cut on a metal
disc.

(iii) A sensor: It is a photodiode or phototransistor, which senses the light (or no light)
passing through sectors or slots of the disc.

122 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Finally, a conditioning electronics detects the light and dark signals and converts the signals into usable
form of pulses or digital code.

(i) Incremental Optical encoder


▪ The disc of the encoder is connected to the motor shaft and rotates with motor.
▪ The disc rotation permits the light to reach the sensor, whenever the transparent slot comes in front of LED,
thereby generating a series of pulses as output of sensor.
▪ These pulses are fed to a counter, which counts the number of pulses; the count being a measure of angle
(distance) through which the shaft has moved
▪ The speed of shaft is obtained by sampling the counter at regular intervals by means of clock pulses.
▪ In Incremental optical encoder
360°
𝐵𝑎𝑠𝑖𝑐 𝑟𝑒𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛 =
𝑁𝑠
Where 𝑁𝑠 − 𝑁𝑜. 𝑜𝑓 𝑠𝑒𝑐𝑡𝑜𝑟𝑠 𝑖𝑛 𝑡ℎ𝑒 𝑑𝑖𝑠𝑐
▪ The accuracy and resolution of the increment optical encoder can be increased by using another disc as a mask,
using two or four optoelectronic channels or using multiplier circuits.
(ii) Absolute optical encoder
▪ Absolute encoder, is capable of giving the correct rotary position at all times even after power-up has occurred.
▪ The device produces a separate and unique coded word for each shaft position.
▪ Every reading is independent of the preceding one.
▪ Fig. below shows an absolute encoder mounted on a motor:
c) Linear variable differential transformer (LVDT).
4: 00 ROBOT PROGRAMMING:
▪ Robot must be programmed to teach the robot the particular motion sequence and other actions that must be
performed in order to accomplish its task.
▪ A robot program can be considered as a path in space that is to be followed by the manipulator, combined with
peripheral actions that support the work cycle.
▪ It can be defined as a sequence of joint coordinate positions.
2:10 METHODS OF ROBOT PROGRAMMING:
▪ To program a robot, specific commands are entered into the robot’s controller memory. This is done in several
ways;
▪ one of which is the manual programming method used for limited sequence robots i.e., robots have short work
cycles.

123 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ Here programming is done by setting limit switches and mechanical stops to control the end points of its
motions. A sequencing device determines the order in which each joint is actuated to form the complete
motion cycle.
▪ After the rapid proliferation of microcomputers in industries, almost all industrial robots have digital computers
as their controllers.
▪ There are three styles of programming are followed.
(i) Lead through programming.
(ii) Textual (or) computer like programming languages.
(iii) Off-line programming.
(i) Lead through Programming:
▪ Here the manipulator is driven through the various motions needed to perform a given task, recording the
motions into the robot’s computer memory for subsequent playback.
▪ Based on the teach procedure, lead through programming can be distinguished into two i.e.
a) Powered lead through
▪ The user guides the robot through interaction with a Teach Pendant.
▪ The teach pendant is a hand-held control box that allows control of each manipulator joint or of each cartesian
degree of freedom.
▪ It consists of toggle switches, dials and buttons which the programmer activates in a coordinated fashion to
move the manipulator to the required positions in the workplace. The important components of a teach
pendant are illustrated in the figure below
▪ The powered lead through is most commonly used nowadays and is usually limited to point to point motions
e.g. spot welding, machine loading and unloading etc. rather than continuous movement.
▪ This is due to the difficulty in using the teach pendant to regulate complex geometric motions in space.

124 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
b) Manual lead through (walk through) method:
▪ It requires the operator to physically move the manipulator through the motion sequence.
▪ It is convenient for continuous path programming where the motion cycle involves smooth complex curvilinear
movements of the robot arm e.g. spray painting and continuous arc welding etc.
▪ In this method since the programmer has to physically grasp the robot arm and end-effector it could be difficult
to move through the motion sequence in the case of large robots.
▪ So, a special programming device which has the same joint configuration as the actual robot is substituted for
the actual robot.
Advantages of Lead through Programming:
(i) No special programming skills or training required.
(ii) Easy to learn.
Disadvantages:
(i) Difficult to achieve high accuracy and straight-line movements or other geometrically defined trajectories.
(ii) Difficult to edit unwanted operator moves.
(iii) Limited programming logic ability.
(iv) Difficult to synchronize it with other machines or equipment in the work cell.
(v) Large memory requirements.
(vi) Robot cannot be used in production while it is programmed.

125 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(ii) Textual or Computer like Programming:
▪ This method of robot programming involves the use of a programming language similar to computer
programming.
▪ The textual language apart from the various capabilities of a computer programming language, also includes
statements specifically designed for robot control e.g., motion control and input / output.
▪ Motion − control commands are used to direct the robot to move its manipulator to some defined position in
space while the input/output commands are used to control the receipt of signals from sensors and other
devices and to initiate control signals to other pieces of equipment in the work cell.
▪ These robot languages use offline / online methods of programming i.e. the program is written off-line with the
textual language to define the logic and sequence while the teach pendant is used to define on-line, the specific
point locations in the workspace.
Advantages of textual programming over lead-through programming include
(i) Extended program logic.
(ii) Enhanced sensor capabilities.
(iii) Improved output capabilities for controlling external equipment.
(iv) Computations and data processing capabilities.
(v) Communication with other computer systems.
(iii) Off-line Programming:
▪ In this case the programs can be developed without needing to use the robot, i.e. there is no need to physically
locate the point positions in the work space for the robot as required with textual and lead through
programming.
▪ The robot program can be prepared at a remote computer terminal and down loaded to the robot controller for
execution without interrupting production.
▪ This saves production time lost to delays in teaching the robot a new task. The programs developed off-line can
be tested and evaluated using simulation techniques.

126 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ The benefits of off-line programming are:
(i) Higher utilization of the robot and the equipment with which it operates as off-line programming can be
done while the robot is still in production on the preceding job.
(ii) The sequence of operations and robot movements can be optimized or easily improved
(iii) Existing CAD data can be incorporated.
(iv) Enables concurrent engineering and reduces production time.
(v) Programs can be easily maintained and modified.
EXAMINATION QUESTIONS
1. (a) Define each of the following with respect to robots:
(i) Modularity
▪ The property of flexibility built into a robot and control system by assembling separate units,
which can be easily joined to or arranged with other parts or units.
(ii) Dexterity
▪ The measure of the robot’s skill of completing specific difficult paths.
(iii) Work envelope
▪ The set of all points which a manipulator can reach without intrusion. Sometimes the shape of
the work space, and the position of the manipulator itself can restrict the work envelope.
(3 marks)
(b) Describe the following robot programming methods:
(i) Use of a teach pendant
(ii) Lead – through (6 marks)
(c) A conveyor moves parts from one process line to another. The conveyor is driven by a motor (M) which
is controlled by a START and STOP switch. A proximity sensor (P) is used to detect the parts moving on

127 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
the conveyor. Out of 1000 parts, one part is taken out for quality check. A solenoid (S) is operated for 2
seconds to divert the part for a quality check. Draw a PLC ladder diagram program for this process.
(11 marks)
2. (a) Define each of the following sensor characteristics used in robotics
(i) Range (ii) Response (iii) Accuracy
(iv) Sensitivity (v) Linearity (5 marks)
(b) The figure below shows the multileveled control architecture of a computer – based intelligent robotic
manipulator. Describe its operation (6 marks)

▪ A robot having a fusion of the available sensory data with task planning is characterized as an intelligent robot.
It has the capability of perception of action.
▪ The control algorithm guarantees coordinated motion of the mechanical structure in correspondence to the
task planning
▪ The signals from all the sensors on the manipulator and in the environment are fed to the computer – controller
which analyses them as per system models task programs, control algorithms, motion algorithms and
intelligence algorithms and generate the control signals.
▪ These control signals are applied to the actuators to command and control the manipulator.

128 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ The interaction of the manipulator with the work environment is sensed by the sensors and again fed back and
the cycle is continued.
3. (a) State each of the following with respect to robots:
(i) Three types of grippers
(ii) Three types of non-contact proximity switches (6 marks)
(b) The figure below shows a diagram of a robot arm – link in the x – y plane. The link
moves by an angle 𝜃 from point A to B.

Show that the matrix of rotation is given by:


𝑥2 cos 𝜃 −sin 𝜃 𝑥1
(𝑦 ) = ( )( )
2 sin 𝜃 cos 𝜃 𝑦1
(c) The figure below shows a path followed by a robot to move an object from point x to point y. Write an
algorithm to describe the robot motion. (6 marks)

129 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Solution;
START;
MOVE FORWARD 5 m;
TURN 90° LEFT;
MOVE FORWARD 25 m;
TURN 90° RIGHT;
MOVE FORWARD 7 m;
TURN 90° RIGHT;
MOVE FORWARD 30 m;
TURN 90° LEFT;
MOVE FORWARD 4 m;
TURN 90° LEFT;
MOVE FORWARD 6 m;
STOP
END

130 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
4. (a) (i) State three demerits of lead – through programming in robotics.4 m
(ii) List three types of proximity sensors used in robotics (6 marks)
5. (a) Define each of the following with respect to robot motion
(i) yaw;
(ii) roll;
(iii) pitch. (3 marks)
(b) Explain three qualities expected of a modern industrial robot (6 marks)
(c) Table (a) shows the commands of a robot programming language, while table (b) is the
program to control the movement of a robot.
Draw a trace of the robot path, indicating the path distances (11 marks)
Table (a)
Command Description
1. Open Opens the Robot Gripper jaws
2. Close Closes the Robot Gripper jaws
Robot moves x – meters horizontally, y – meters vertically
Relative to the present location.
3. MOV (x, y)
- x = negative horizontally
- y = negative vertically
4. Go Robot starts to move
5. Halt Robot stops moving
6. End End of program
7. Start Robot starts to move
8. stop Robot stops moving

Table (b)
Open
Close
Start

MOV (20, 0)
Stop
Start

131 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
MOV (0, -15)
Stop
Start

MOV (5, 0)
Stop
Start

MOV (0, -10)


Stop
Start

MOV (-25, 0)
Stop
Start

MOV (0, -6)


Stop
Start

MOV (8, 0)
Stop
Open
End

Solution;

132 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
6. (a) (i) State three merits of using robots in industry.
(ii) List three sensors used in robotics. (6 marks)
(b) Describe each of the following robot programming methods:
(i) Manual
(ii) Lead – through
(iii) Off – line (6 marks)
(c) The table below shows the commands of a robot programming language. A robot is programmed to
apply glue following the pattern of figure below. The glue applicator tool held by the robot is turn – on
by an output signal from channel 2. Extra glue is applied at rounded spots by pausing for 0.75 seconds at
each spot while the paint applicator tool remains on. The Cartesian coordinate for each point is as
shown.
Write a program to accomplish the robot task (8 marks)

133 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Command Meaning
1. Open Opens the Robot gripper jaws
2. Close Closes the Robot gripper jaws
3. MOV (x, y) Moves gripper to defined location (x, y)
4. Pause (K) Causes the arm to stop for K seconds
5. Signal (N, P) Sends output signal P to channel N:
6. End End of program

Solution:
Mov (0,0)
Signal (P,2)
Pause (0.75)

Mov (0,10)
Signal (P, 2)
Pause (0.75)

Mov (20,10)
Signal (P, 2)
Pause (0.75)

134 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
Mov (10,5)
Signal (P, 2)
Pause (0.75)

Mov (20,0)
Signal (P, 2)
Pause (0.75)

Mov (0,0)
Signal (P, 2)
Pause (0.75)

Open
Close
End

7. (a) Describe the following types of Robotic sensors, stating an example in each case:
(i) Tactile
(ii) Proximity
(b) (i) Describe an industrial robot.
(ii) Explain the working of the following parts of a robot
I. Manipulator
II. End – effector
III. Motors (8 marks)
(c) A robot has been constructed to control three safes with lockable doors that have sensors mounted on
them. Safe A has two doors that close to cause a third door on this safe to open whenever the robot
touches them. Safe B has two doors that close when the robot touches them. A third door on this safe
close whenever the robot touches the two doors. The action of safe A or B causes third safe C to open its
third door. Let opening be logic ‘1’, closing be logic ‘0’. Draw a:
(i) Logic circuit to implement the actions of the three safes;
(ii) Truth table to describe safes A, B and C individually (8 marks)
8. (a) Define each of the following with respect to robots

135 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
(i) Degree of freedom
(ii) Off line programming (2 marks)
(b) The figure below shows a diagram of a pneumatic proximity sensor
(i) Describe its operation
(ii) Explain one area of application of the sensor in robotics (6 marks)
(c) The figure below shows a diagram of a double – acting single – ended hydraulic cylinder for the linear
motion of a robot arm. The diameter of the piston, D is 15 cm and the diameter of the piston rod, d, is
10−5 𝑚3
7.5 cm. A pump supplies hydraulic oil to the cylinder at a rate of 4 ∙ 0 × with a pressure of
𝑠
105 𝑁
4∙5× 𝑚2
.

9. (a) List THREE actuators used in commercial robots, stating the merit of each (6 marks)
(b) Describe each of the following robot programming methods:
(i) Manual
(ii) Lead through
(iii) Off – line (6 marks)
(c) The figure below shows a robot arm and a tray of spare parts (A). Write a pseudo code program to
instruct the robot arm to pick ten spare parts, one at a time and place them into tray B.
(8 marks)
10. (a) Explain any three advantages of using robots in industries (6 marks)
(b) List any three types of sensors used in robotics (3 marks)
(c) The table below shows commands of a robot programming language. A robot is to be programmed to
paint a pattern shown in the figure below. The paint applicator tool held by the robot is turned on by the
output signal from channel 5. Extra paint is applied at rounded spots by pausing 0.5 seconds at each
spot while the paint applicator tool remains on. The co – ordinates for each point are shown
Command Meaning
1. Open Opens the robot gripper jaws
2. Close Closes the robot gripper jaws
3. Mov (x, y) Moves gripper to defined location (x, y)
4. Pause (k) Causes the arm to stop for k seconds
5. Signal (N, P) Sends output signal P to channel N, P = ON/OFF
6. END End of program

136 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
11. (a) Describe the three rotational forces in a robotic arm. (6 marks)

(b) Describe each of the following robot programming methods:


(i) Lead through
(ii) Off-line (4 marks)
12. (a) With the aid of a diagram, describe each of the following robot – arm motions;
(i) Yaw;
(ii) Roll;
(iii) Pitch. (6 marks)
(b) Describe each of the following elements of a robotic system:
(i) Actuator;
(ii) Sensor;
(iii) Drive. (6 marks)
(c) Table (a) shows the commands of a robot programming language while table (b) is a program to control
the movement of the robot. Sketch a trace of the robot path under the program control, indicating the
distances. (8 marks)
Table (a);
No. Command Description
1. Open Opens the Robot Gripper Jaws
2. Close Closes the Robot Gripper Jaws
Robot moves x – metres eastwards, y – metres northwards
Note;
3. Move (x, y)
−x = move westwards
−y = move southwards
4. End End of program
5. Stop Robot stops moving
6. Start Robot starts to move

Table (b)

▪ Open
▪ Close
▪ Start

137 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
▪ Move (30,0)
▪ Stop
▪ Start
▪ Move (0, −15)
▪ Stop
▪ Start
▪ Move (−25, −10)
▪ Stop
▪ Start
▪ Move (8, −6)
▪ Stop
▪ Open
▪ End

12. (a) Figure below shows a pick and place robot that picks up parts from one conveyor belt and places them
on another belt. When a part moving along the lower conveyor belt activates switch SW1 , a solenoid
powered gripper picks the part and carries it towards the upper conveyor belt. When the gripper
reaches switch SW2, it releases the part and moves back to pick another part. When the gripper reaches
switch SW3, it halts and waits for the next part to start the cycle all over again.
Draw a relay logic ladder diagram to control this operation.

138 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))
13.

139 | P a g e
(Eng. Omondi Stephen – Lecturer P.C. KTTI (Electrical and Electronic Dept.))

You might also like