fully automated nursing system.PDF

128
MANSOURA UNIVERSUTY FACULTY OF ENGINEERING COMPUTERS AND SYSTEMS ENGINEERING Supervised by Dr.Mohamed Sherif El-Ksasy 2011

Transcript of fully automated nursing system.PDF

Page 1: fully automated nursing system.PDF

MANSOURA UNIVERSUTY

FACULTY OF ENGINEERING

COMPUTERS AND SYSTEMS ENGINEERING

Supervised by

Dr.Mohamed Sherif El-Ksasy 2011

Page 2: fully automated nursing system.PDF

Hussien Rezk Hussien Hussien حسين رزق حسين حسين

Ziad Mahmoud Zaki Ebada زياد محمود زكي عبادة

Samar Ibrahim Mohamed المندوه سمر ابراىيم محمد

Samar Gamal Moaawad سمر جمال معوض

Shimaa Ibrahim Mohamed االباصيرى شيماء ابراىيم محمد

Sofia Hamza Abdel-Hady صوفيا حمزة عبد اليادي

Kamelia Awad Saad كاميليا عوض سعد

Lamis Wageh Ahmed لميس وجيو أحمد

Mohamed Foaad Abdel-Aziz محمد فؤاد عبد العزيز

Mohamed Maher Abd-allah محمد ماىر عبد اهلل

Mohamed El-Sayed Badawy السيد بدويمحمد

Mahmoud Abdel-Wanis Talkhan عبد الونيس طلخان ودمحم

Nada Ahmed Abo-Elhasan ندا أحمد أبو الحسن

Hagar El-sayed Khder ىاجر السيد خضر

Hala El-Sayed Ali ىالة السيد علي

Page 3: fully automated nursing system.PDF

First and foremost, thanks to Allah who gave us the

inspiration and power to accomplish this work we

would like to thank various people for helping and

supporting us to complete our project.

Thanks to:

Ass.Prof.Dr. Sabry Sraya.

Prof.Dr. Fayez Gomaa Areed.

Prof.Dr. Hesham Arafat

Dr. Mohamed Sherif El-Kasasy.

Dr. Amira Yassin.

Eng. Mohamed Moaawad.

Eng. Hesham Gad.

Eng.Mahmoud Saafan.

Bola Ashraf

Sara Abdel-hamid Mostafa

Nashwa Abdel-Hady Ahmed

Page 4: fully automated nursing system.PDF

Chapter 1: Introduction…………...…………….. P2

1.1 - the idea of the project ……………....……………… P3

1.2 - the aims of the project …………..……....………….. P6

1.3 - the challenges of the project …………...…...……….P7

1.4 - the tools of the project ………………....……………P8

1.5 - steps of the project …………..………………………P9

Chapter 2: micro control ……………….………P11

2.1 - Define Microcontroller……………….………..…..P12

2.2 - Microcontrollers Used Today………………..….…P13

2.3 - Embedded design…………....………………..……..P14

2.4 - CPU Diagrams……………………….………….….P15

2.5 - The CPU core…………………………….…………P16

2.6 - Memory Types……………………………….…..….P17

2.7 – Programs……………………………...….…………P20

2.8 - Programming environments………………….……P21

Page 5: fully automated nursing system.PDF

2.9 - Architectural features………………………..…..…P23

2.10 - Microcontroller Features…………...………..……P28

2.11 – PIC 16f877 Architecture………....………….……P34

Chapter 3: Hardware description ……...…..P37

3.1 - Introduction……………………...…………...…...…P37

3.2 - Tools used……………………………....……..…..…P37

3.3 - Components used…………………………......…..…P38

3.4 - Circuits used…………………....…...………….……P52

Chapter 4: AGV……..………………….…..………...P68

4.1 - introduction………………….…...…………………P69

4.2 - navigation……………..…………….………………P72

4.3 - Steering control……………………….……………P76

4.4 - Magnetic Tape mode……………………..…………P77

4.5 - Guide Tape……………………………………...……P78

4.6 - why light…………...…………………………...……P80

Page 6: fully automated nursing system.PDF

Chapter 5: Mechanics description .…….….P82

5.1 - Robot’s mechanical design……………………….…P83

5.2 – Components…………………………..……….….….P84

5.2.1 - The base…………………………………..…….….P84

5.2.2 -The arm………………………....……………..……P86

5.2.3- The disk………………………………...…..…....….P87

5.2.4- The disk shroud………………………..……….…..P88

5.2.5 - The disk lug…………………………..….……....…P90

5.3 - Robot main structure (body)…………….…....…..….P91

5.4 - Robot motion and motors…………...……….………P92

Chapter 6: Software description ….…….….P95

6.1 - About software…………....………………….………P96

6.2 - Welcome window……………….......……………….P99

6.3 - Main window…………………...………………….P100

6.4 - Patients data window………..………………..……P102

6.5 - Patient medicines window……………….......…….P105

Page 7: fully automated nursing system.PDF

6.6 - Doctors data window……………...……...………..P107

6.7 - Medicines data window………………...…………P110

6.8 - Patients medicines windows………………………P113

Chapter 7: Future work……………………….P116

7.1 - GSM……………………………………………..…P117

7.2 - Camera……………………………....…...…..…..…P118

7.3 - Automatic pharmacy…………………………....…P118

7.4 - Image processing……………………………….…P118

7.5 - Wireless connection……………………….…....…P118

7.6 - Mechanical design………………...……………….P119

Page 8: fully automated nursing system.PDF

Chapter 1

Page 9: fully automated nursing system.PDF

Chapter 1 : Introduction

2

1.1- The idea of the project

1.2- The aims

1.3 - The challenges

1.4 - The tools

1.5 - the steps of the project

Page 10: fully automated nursing system.PDF

Chapter 1 : Introduction

3

In this book we will talk about our project, why we

choose it, its main idea, its internal component, and

problem we faced and how we overcome them.

Nowadays we suffer from the spread of infectious

diseases, but the biggest problem is the transmission of

these diseases in hospitals themselves.

Medical errors’ ghost threatens patients, so who is

responsible for that??

In our project we try to find answer to this question...

We search a lot until we got that a large proportion of

medical errors came from nurses' errors.

Nurses could make mistakes in medicines' times or in

amount of required dosage of the drug. And this causes

problems for patients. Also,, if there is patient has

infectious disease and nurse deals with it without being

sterilized well she could be affected and pass it to the

others .

So we tried to find a simple solution to this problem by

using something that not forget times and doesn't help

in the transmission of the disease.

Page 11: fully automated nursing system.PDF

Chapter 1 : Introduction

4

This is ROBOT …

Figure (1-1)

Nowadays, we are witnessing the great scientific

revolution in the field of robots and it proved its ability

to do human activities very well.

But let's shade light on what is ROBOT

ROBOT :Is a mechanical intelligent machine which can

perform dangerous tasks on its own or with guidance.

In practice, a robot is usually an electromechanical

machine which is guided by a computer and electronic

programming so by good programming and training,

robot can do any task.

Page 12: fully automated nursing system.PDF

Chapter 1 : Introduction

5

Figure (1-2)

So we exploit this to solve the previous problem

because ROBOT can store huge amount of data and

linking them, in addition to it doesn't transmit the

infection and not forget like human ….

Page 13: fully automated nursing system.PDF

Chapter 1 : Introduction

6

This project was the work of three parts:

1. The first part is special to hardware that

responsible for work of the electronic circuits that

will be explained in chapter 2.

2. The second part is special to mechanics that

responsible for mechanical design of the robot this

will be explained in chapter 5.

3. The third part is special to software that

responsible for programming and building the

database of the robot, this will be explained in

chapter 6.

1 -Patient :

Protect him from nurses’ errors like medicine miss

timing,over dosage or dose incomplete.

2 -Nurse:

Reduce the burden on the nurse.

Protect them from Infectious diseases.

Page 14: fully automated nursing system.PDF

Chapter 1 : Introduction

7

3 -Doctor:

Continuous monitoring of the patient's condition from

anywhere.

4 - Hospital owners:

Reduce manpower and burdens to hospitals' owners to

increase.

5 - Making use of technology to reduce human errors.

6 - Using new technique (light follower).

1 - Firstly, we have to choose suitable way for robot

(light follower or line follower).

2 - Choosing suitable design for robot.

3 - Choosing suitable programming language.

4 - How to connect software (database) with hardware

(robot).

Page 15: fully automated nursing system.PDF

Chapter 1 : Introduction

8

In hardware:

1. The program that we use:

Protuse professional.

Eagel .

Micro c

2. Programmable device.

3. PIC 16f877.

4. Max232.

5. Sensors.

6. Electrical resistances.

7. Capacitors.

8. Stepper motor.

9. Serial cables.

10. Regulator LM7805.

11. Transistors.

12. Relays.

In software:

1. Programming language (c#).

2. SQL (Structured Query Language) fordatabase.

Page 16: fully automated nursing system.PDF

Chapter 1 : Introduction

9

1. Every 6 hours nurse put medicines in robot.

2. Time is checked permanently in database and at

specific time signal is sent to serial with bed’s

number

3. Serial send signal to the light follower to light the

path to the bed.

4. Robot detects light by light sensor and begin its

trip to the bed.

5. Robot detects the place where to put medicine by

using limit switch.

6. Robot still at its place till the next signal, if there

is signal with other bed number then its path is

lightedand robot turn to it .. and if there isn’t

signal it back to its start point.

Page 17: fully automated nursing system.PDF

Chapter 2

Page 18: fully automated nursing system.PDF

Chapter 2 : Micro Control

11

2.1 - Define Microcontroller

2.2 - Microcontrollers Used Today

2.3 - Embedded design

2.4 - CPU Diagrams

2.5 - The CPU core

2.6 - Memory Types

2.7 - Programs

2.8 - Programming environments

2.9 - Architectural features

2.10 - Microcontroller Features

2.11 - PIC61F877A Architecture

Page 19: fully automated nursing system.PDF

Chapter 2 : Micro Control

12

Micro-controllers units (MCU's) :

Micro-Controller is very important to modern

electronics they replace hundreds of discreet logic chips

with a single IC. A modern micro-controller has:

Flash ROM for the machine code that constitutes

the program that will be run.

Ram that will be used for user variables at

execution time.

EEPROM data area for storing non-volatile user

data during execution time.

Programmable trimmers for use internally at watch

dog timers and other counters like the program

counter that tells the micro-controller where it is in

the program being executed.

IO-ports to communicate to the outside world.

And of course the core that will include the ALU

(Arithmetic Logic Unit) where most of the magic is

done.

Page 20: fully automated nursing system.PDF

Chapter 2 : Micro Control

13

A microcontroller is a kind of miniature computer that

you can find in all kinds of gizmos. Some examples of

common, every-day products that have

microcontroller’s built-in are shown in Figure 1-1. If it

has buttons and a digital display, chances are it also has

a programmable microcontroller brain.

Figure (2-1) Every-Day Examples of Devices that Contain

Microcontrollers

Try making a list and counting how many devices with

microcontrollers you use in atypical day. Here are some

examples: if your clock radio goes off, and you hit the

snooze button a few times in the morning, the first

thing you do in your day is interact with

microcontroller. Heating up some food in the

microwave oven and making a call on a cell phone also

Page 21: fully automated nursing system.PDF

Chapter 2 : Micro Control

14

involve operating microcontrollers. That’s just the

beginning. Here are a few more examples: turning on

the television with a handheld remote, playing a

handheld game, using a calculator, and checking your

digital wristwatch. All those devices have

microcontrollers inside them that interact with you.

A microcontroller can be considered a self-contained

system with a processor, memory and peripherals and

can be used as an embedded system. The majority of

microcontrollers in use today are embedded in other

machinery, such as automobiles, telephones,

appliances, and peripherals for computer systems.

These are called embedded systems. While some

embedded systems are very sophisticated, many have

minimal requirements for memory and program length,

with no operating system, and low software complexity.

Typical input and output devices include switches,

relays, solenoids, LEDs, small or custom LCD displays,

radio frequency devices, and sensors for data such as

temperature, humidity, light level etc. Embedded

Page 22: fully automated nursing system.PDF

Chapter 2 : Micro Control

15

systems usually have no keyboard, screen, disks,

printers, or other recognizable I/O devices of a personal

computer, and may lack human interaction devices.

One thing you will see often is CPU diagrams. Usually,

these are done as block diagrams to help you see how

the different sub-systems on the chip fit together. It's

kind of like a road map. Here is such a diagram for the

68HC11.

Figure (2-3)

Page 23: fully automated nursing system.PDF

Chapter 2 : Micro Control

16

This overall diagram is very helpful for trying to locate

major features of a chip. For example, I can see from

the map that there is an A/D converter, and it is

connected to PORT E. I also see that there is EEPROM,

RAM, and ROM available on the chip. It also tells me

that PORTC is a bidirectional port, and PORTB is a

output only port. Most chips will come with some sort

of documentation along these lines. You can expect to

find a block diagram like this near the front of most

manuals.

The CPU core is the 'computer' part of the

Microcontroller. Its job is to run the program supplied

by the designer. It does this by using memory, some

registers, and the program memory. As seen in the

block diagram above, the M68HC11 CPU is called out as

a subcomponent of the chip as a whole. There is a

reason. Most Microcontrollers are available in multiple

versions. Each version will have its own interesting set

of features. The 68HC811E2, for example, is a chip with

Page 24: fully automated nursing system.PDF

Chapter 2 : Micro Control

17

the 68HC11 CPU at its core, but 2k of EEPROM and some

extra timer options.

The 68HC11A1 has 512 bytes of EEPROM, and 256 bytes

of RAM. It is quite typical for manufacturers to put out

multiple versions of the chip, so you need to know

which version you are dealing with!

Microprocessors come with several different types of

memory. The amount of memory on a single chip varies

quite a bit by manufacturer. Typically, 512 to 2k of

program space and 256-512 bytes of RAM are available.

There are memory options available. I will give you a

brief overview of each.

RAM :

RAM means Random Access Memory. It is general

purpose memory that can store data or programs. RAM

is 'volatile', which means when the power is shut off,

the contents of the memory is lost. Most personal

computers have several megabytes of RAM. Most

microcontrollers have some RAM built into them, but

Page 25: fully automated nursing system.PDF

Chapter 2 : Micro Control

18

not very much. 256 bytes is a fairly common amount.

Some have more, some have less.

ROM:

ROM is Read Only Memory. This is typically memory

that is programmed at the factory to have certain

values. It cannot be changed, but it can be read as many

times as you want. ROM is typically used to store

programs and data that don’t change over time. Many

Microcontrollers have lots of ROM. Unfortunately,

unless you are ordering thousands of parts, the ROM is

useless to you, and in fact is wasting address space.

Most individuals stay away from controllers with lots of

ROM.

EPROM:

EPROM is Erasable Programmable Read Only Memory.

This is ROM that can be field programmed using an

EPROM programmer, which is a special device that

takes your program information and programs (often

called burning) the EPROM. To erase an EPROM, you

need an EPROM eraser. This is usually a small box that

has a strong UV light bulb. You place the EPROM part

into the box for several minutes. The UV light causes

Page 26: fully automated nursing system.PDF

Chapter 2 : Micro Control

19

the program to be erased. Most EPROM chips have a

small clear window into the chip. This is for the UV light

to pass through. EPROM devices range from 8kb to

32kb. Bigger versions are available, but not usually used

on Microcontrollers.

There are EPROM chips that are not 'windowed'. A

more correct term for this is PROM or OTP (One Time

Programmable) packages. You will typically find that

windowed parts usually cost more. The Microchip PIC

series of processors are a well-known OTP chip. For

example, a PIC16C61 costs about $7, and the windowed

version of the PIC16C61 costs about $15. OTP parts are

great if your design is done, and you never intend to

change the program again.

EEPROM:

EEPROM is Electrically Erasable Programmable Read

Only Memory. Yes, the acronyms are getting long!

EEPROM is extremely useful for a variety of uses. For

example, when you save configuration information on

many household devices, the information is commonly

written into EEPROM. EEPROM can also be

'programmed' from software, so you typically do not

Page 27: fully automated nursing system.PDF

Chapter 2 : Micro Control

20

need to remove the part from your circuit to reprogram

it. This is a big advantage. It typically takes about 10

milliseconds to write each byte of EEPROM.

Flash EEPROM:

Yet another version of the EEPROM, Flash memory

programs much faster. A byte may only take a few

hundred microseconds to program. That is an

advantage over EEPROM. However, Flash memory

typically requires you to erase the entire contents

before you can program it. Flash EEPROM usually comes

in large quantities. The 68HC912B32, for example, is a

single chip controller with 32kb of FLASH EEPROM on

the chip!

Summarizing Memory:

Excuse the pun, but the different types of memory is

just too much to remember! In summary: RAM is good.

EEPROM is good. EPROM requires programming

hardware. ROM is mostly useless. Flash EEPROM is OK.

2.7) Programs:

Microcontroller programs must fit in the available on-

chip program memory, since it would be costly to

Page 28: fully automated nursing system.PDF

Chapter 2 : Micro Control

21

provide a system with external, expandable, memory.

Compilers and assemblers are used to convert high-

level language and assembler language codes into a

compact machine code for storage in the

microcontroller's memory. Depending on the device,

the program memory may be permanent, read-only

memory that can only be programmed at the factory, or

program memory may be field-alterable flash or

erasable read-only memory.

Microcontrollers were originally programmed only in

assembly language, but various high-level programming

languages are now also in common use to target

microcontrollers. These languages are either designed

especially for the purpose, or versions of general

purpose languages such as the C programming

language. Compilers for general purpose languages will

typically have some restrictions as well as

enhancements to better support the unique

characteristics of microcontrollers. Some

microcontrollers have environments to aid developing

certain types of applications. Microcontroller vendors

Page 29: fully automated nursing system.PDF

Chapter 2 : Micro Control

22

often make tools freely available to make it easier to

adopt their hardware.

Many microcontrollers are so quirky that they

effectively require their own non-standard dialects of C,

such as SDCC for the 8051, which prevent using

standard tools (such as code libraries or static analysis

tools) even for code unrelated to hardware features.

Interpreters are often used to hide such low level

quirks.

Interpreter firmware is also available for some

microcontrollers. For example, BASIC on the early

microcontrollers Intel8052; BASIC and FORTH on the

Zilog Z8 as well as some modern devices. Typically these

interpreters support interactive programming.

Simulators are available for some microcontrollers, such

as in Microchip's MPLAB environment and the

Revolution Education PICAXE range. These allow a

developer to analyze what the behavior of the

microcontroller and their program should be if they

were using the actual part. A simulator will show the

internal processor state and also that of the outputs, as

well as allowing input signals to be generated. While on

the one hand most simulators will be limited from being

Page 30: fully automated nursing system.PDF

Chapter 2 : Micro Control

23

unable to simulate much other hardware in a system,

they can exercise conditions that may otherwise be

hard to reproduce at will in the physical

implementation, and can be the quickest way to debug

and analyze problems.

Recent microcontrollers are often integrated with on-

chip debug circuitry that when accessed by an in-circuit

emulator via JTAG, allow debugging of the firmware

with a debugger.

Von-Neumann Architecture :

Microcontrollers based on the Von-Neumann

architecture have a single "data" bus that is used to

fetch both instructions and data. Program instructions

and data are stored in a common main memory. When

such a controller addresses main memory, it first

fetches an instruction, and then it fetches the data to

support the instruction. The two separate fetches slows

up the controller's operation.

Page 31: fully automated nursing system.PDF

Chapter 2 : Micro Control

24

Harvard Architecture :

Microcontrollers based on the Harvard Architecture

have separate data bus and an instruction bus. This

allows execution to occur in parallel. As an instruction

is being "pre-fetched", the current instruction is

executing on the data bus. Once the current instruction

is complete, the next instruction is ready Togo. This

pre-fetch theoretically allows for much faster execution

than on-Neumann architecture, but there is some

added silicon complexity.

Figure (2-3)

Page 32: fully automated nursing system.PDF

Chapter 2 : Micro Control

25

CISC:

Almost all of today's microcontrollers are based on the

CISC (Complex Instruction Set Computer) concept. The

typical CISC microcontroller has well over 80

instructions, many of them very powerful and very

specialized for specific control tasks. It is quite common

for the instructions to all behave quite differently. Some

might only operate on certain address spaces or

registers, and others might only recognize certain

addressing modes.

The advantages of the CISC architecture are that many

of the instructions are macro-like, allowing the

programmer to use one instruction in place of many

simpler instructions.

RISC:

The industry trend for microprocessor design is for

Reduced Instruction Set Computers (RISC) designs. This

is beginning to spill over into the microcontroller

market. By implementing fewer instructions, the chip

designed is able to dedicate some of the precious silicon

real-estate for performance enhancing features.

Page 33: fully automated nursing system.PDF

Chapter 2 : Micro Control

26

The benefits of RISC design simplicity are a smaller chip,

smaller pin count, and very low power consumption.

Among some of the typical features of a RISC processor:

Harvard architecture (separate buses for

instructions and data) allows simultaneous access

of program and data, and overlapping of some

operations for increased processing performance

Instruction pipelining increases execution speed.

Orthogonal (symmetrical) instruction set for

programming simplicity; allows each instruction to

operate on any register or use any addressing

mode; instructions have no special combinations,

exceptions, restrictions, or side effects.

SISC:

Actually, a microcontroller is by definition a Reduced

Instruction Set Computer (at least in my opinion). It

could really be called a Specific Instruction Set

Computer (SISC). The [original] idea behind the

microcontroller was to limit the capabilities of the CPU

itself, allowing a complete computer (memory, I/O,

interrupts, etc.) to fit on the available real estate. At

the expense of the more general purpose instructions

Page 34: fully automated nursing system.PDF

Chapter 2 : Micro Control

27

that make the standard microprocessors (8088, 68000,

32032) so easy to use, the instruction set was designed

for the specific purpose of control (powerful bit

manipulation, easy and efficient I/O, and so on).

Microcontrollers now come with a mind boggling array

of features that aid the control engineer - watchdog

timers, sleep/wakeup modes, power management,

powerful I/O channels, and so on. By keeping the

instruction set specific (and reduced), and thus saving

valuable real estate, more and more of these features

can be added, while maintaining the economy of the

microcontroller.

UART:

A UART (Universal Asynchronous Receiver Transmitter)

is a serial port adapter for asynchronous serial

communications.

USART:

A USART (Universal Synchronous/Asynchronous

Receiver Transmitter) is a serial port adapter for either

asynchronous or synchronous serial communications.

Communications using a USART are typically much

faster (as much as 16 times) than with a UART.

Page 35: fully automated nursing system.PDF

Chapter 2 : Micro Control

28

Synchronous serial port:

A synchronous serial port doesn't require start/stop

bits and can operate at much higher clock rates than an

asynchronous serial port. Used to communicate with

high speed devices such as memory servers, display

drivers, additional A/D ports, etc. Can also be used to

implement a simple microcontroller network.

Microcontrollers from different manufacturers have

different architectures and different

Capabilities. Some may suit a particular application

while others may be totally

Unsuitable for the same application. The hardware

features common to most

Microcontrollers are described in this section.

Supply Voltage :

Most microcontrollers operate with the standard logic

voltage of 5‏V. Some

Page 36: fully automated nursing system.PDF

Chapter 2 : Micro Control

29

Microcontrollers can operate at as low as 2.7‏V, and

some will tolerate 6‏V without

Any problem. The manufacturer’s data sheet will have

information about the allowed

Limits of the power supply voltage. PIC18F452

microcontrollers can operate with a

Power supply of 2‏V to 5.5‏V.

Usually, a voltage regulator circuit is used to obtain the

required power supply voltage

When the device is operated from a mains adapter or

batteries.

For example, a 5Vregulator is required if the

microcontroller is operated from a 5V supply using a 9V

battery.

The Clock :

All microcontrollers require a clock (or an oscillator) to

operate, usually provided by

external timing devices connected to the

microcontroller. In most cases, these external

Page 37: fully automated nursing system.PDF

Chapter 2 : Micro Control

30

Timing devices are a crystal plus two small capacitors. In

some cases they are resonators

Or an external resistor-capacitor pair. Some

microcontrollers have built-in timing

Circuits and do not require external timing components.

If an application is not time sensitive, external or

internal (if available) resistor-capacitor timing

components are the best option for their simplicity and

low cost .An instruction is executed by fetching it from

the memory and then decoding it. This usually takes

several clock cycles and is known as the instruction

cycle. In PIC Microcontrollers, an instruction cycle takes

four clock periods. Thus the microcontroller

operates at a clock rate that is one-quarter of the actual

oscillator frequency. ThePIC18F series of

microcontrollers can operate with clock frequencies up

to 40MHz.

Timers :

Timers are important parts of any microcontroller. A

timer is basically a counter which

Page 38: fully automated nursing system.PDF

Chapter 2 : Micro Control

31

is driven from either an external clock pulse or the

microcontroller’s internal oscillator.

A timer can be 8 bits or 16 bits wide. Data can be loaded

into a timer under program

control, and the timer can be stopped or started by

program control. Most timers can be

configured to generate an interrupt when they reach a

certain count (usually when they

overflow). The user program can use an interrupt to

carry out accurate timing-related

operations inside the microcontroller. Microcontrollers

in the PIC18F series have at

least three times. For example, the PIC18F452

microcontroller has three built-in

timers.

Some microcontrollers offer capture and compare

facilities, where a timer value can be

read when an external event occurs, or the timer value

can be compared to a preset

Page 39: fully automated nursing system.PDF

Chapter 2 : Micro Control

32

value, and an interrupt is generated when this value is

reached. Most PIC18F

microcontrollers have at least two capture and compare

modules.

Reset Input :

A reset input is used to reset a microcontroller

externally. Resetting puts the

microcontroller into a known state such that the

program execution starts from address

0 of the program memory. An external reset action is

usually achieved by connecting

a push-button switch to the reset input. When the

switch is pressed, the microcontroller

is reset.

Serial Input-Output :

Serial communication (also called RS232

communication) enables a microcontroller

to be connected to another microcontroller or to a PC

using a serial cable. Some microcontrollers have built-in

hardware called USART (universal synchronous

Page 40: fully automated nursing system.PDF

Chapter 2 : Micro Control

33

asynchronous receiver-transmitter) to implement a

serial communication interface.

The user program can usually select the baud rate and

data format. If no serial

Input-output hardware is provided, it is easy to develop

software to implement serial

data communication using any I/O pin of a

microcontroller. The PIC18F series of

microcontrollers has built-in USART modules. We shall

see in Chapter 6 how to write

micro C programs to implement serial communication

with and without a USART module.

Some microcontrollers (e.g., the PIC18F series)

incorporate SPI (serial peripheral

Interface) or I2C (integrated interconnect) hardware bus

interfaces. These enable a

Microcontroller to interface with other compatible

devices easily.

Page 41: fully automated nursing system.PDF

Chapter 2 : Micro Control

34

This is PIC used in this project and the most useful in the

world.

Figure (2-3)

This PIC contain 40 pins

Figure (2-4)

Page 42: fully automated nursing system.PDF

Chapter 2 : Micro Control

35

Figure (2-5)

Page 43: fully automated nursing system.PDF

Chapter 3

Page 44: fully automated nursing system.PDF

Chapter 3 : Hardware Description

37

3.1 - Introduction

3.2 - Tools used

3.3 - Components used

3.4 - Circuits used

Page 45: fully automated nursing system.PDF

Chapter 3 : Hardware Description

38

The goal of this projects to do something useful to the

medical field and can help patients and assistant who

responsible for patient’s service.

In this is chapter we will talk about the part of hardware

in the project.

3.2.1 - For Simulation :

Eagle

Proteus

3.2.2 - For programming :

Micro C programming language

Page 46: fully automated nursing system.PDF

Chapter 3 : Hardware Description

39

3.3.1 - PIC16F77A :

Figure (3-1)

In stepper motor circuit :

Take the input from switches and control the motor’s

steps.

In serial circuit:

Take signal from pc and convert it to language that

robot can understand.

In sensor circuit:

It takes signal from sensors and gives output to relays to

operate motors.

Page 48: fully automated nursing system.PDF

Chapter 3 : Hardware Description

41

Phototransistor :

Figure (3.6)

3.3.4 – LDR :

LDRs or Light Dependent Resistors are very useful

especially in light/dark sensor circuits. Normally the

resistance of an LDR is very high, sometimes as high as

1000 000 ohms, but when they are illuminated with

light resistance drops dramatically.

Figure (3-7)

Page 49: fully automated nursing system.PDF

Chapter 3 : Hardware Description

42

3.3.5 - Stepper motor :

is a brushless, electric motor that can divide a full

rotation into a large number of steps. The motor's

position can be controlled precisely without any

feedback mechanism (see Open-loop controller), as long

as the motor is carefully sized to the application.

Stepper motors are similar to switched reluctance

motors (which are very large stepping motors with a

reduced pole count, and generally are closed-loop

commutated).

Figure (3-8)

3.3.6 – Leds :

This component is used to test the program and to

generate lights.

Its shape like as shown as :

Page 50: fully automated nursing system.PDF

Chapter 3 : Hardware Description

43

Figure (3-9)

3.3.7 - Serial cable :

A serial cable is a cable that can be used to transfer

information between Computer and test board using

serial communication, often using the standard.

Serial cables used connectors with 9 pins.

Figure (3-10)

Page 51: fully automated nursing system.PDF

Chapter 3 : Hardware Description

44

3.3.8 - Regulator LM7805 :

A voltage regulator is an electrical regulator designed to

automatically maintain a constant voltage level.

Electronic voltage regulators are found in devices such

as computer power supplies where they stabilize the DC

voltages used by the processor and other elements

Figure (3-11)

3.3.9 - Max232 :

The MAX232 is an integrated circuit that converts

signals from an RS-232 serial port to signals suitable for

use in TTL compatible digital logic circuits. The MAX232

is a dual driver/receiver and typically converts the RX,

TX, CTS and RTS signals.

Datasheet on this like (http://datasheets.maxim-

ic.com/en/ds/MAX220-MAX249.pdf)

Page 53: fully automated nursing system.PDF

Chapter 3 : Hardware Description

46

3.3.11 - Oscillator (Crystals) :

This device gives the clock pulse to the circuit to give

the output to the User

Figure 3.14

3.3.12 - Potentiometer :

Is a three-terminal resistor with a sliding contact that

forms an adjustable voltage divider. If only two

terminals are used (one side and the wiper), it acts as a

variable resistor or rheostat. Potentiometers are

commonly used to control electrical devices such as

volume controls on audio equipment. Potentiometers

operated by a mechanism can be used as position

transducers, for example, in a joystick.

Page 54: fully automated nursing system.PDF

Chapter 3 : Hardware Description

47

Figure (3-15)

3.3.13 - LM741 (Op-Amps used as comparator) :

The 741 op-amp is a common general purpose

Operational amplifier.

This op-amp is useful as it has short circuit protection

and high gain over a wide voltage (up to 18V max)

Figure (3-16)

Page 55: fully automated nursing system.PDF

Chapter 3 : Hardware Description

48

3.3.14 – Transistors :

A transistor can be thought of as a simple current

switch. There are two main transistors NPN and PNP.

NPN is the most common transistors. A transistor can

be thought of as two diodes sharing the same anode for

NPN or cathode for PNP. The base emitter junction is

forward biased and the base collector is reversed

biased. By applying a small voltage to the base of a

transistor you allow a current flow through the

transistor from the collector towards the emitter. This is

easy to remember as the collector will generally be

connected to your supply voltage and the emitter will

go towards ground. Also it is important to note that a

transistor is a current operated device and not voltage.

When a transistor is "switched on" it acts as a

conductor and therefore has very low resistance. If you

put too much current through a transistor it will get

VERY hot and will probably breakdown therefore you

should have a current limiting resistor connected in

series with Collector Emitter of a transistor as well as a

series resistor with the base of the transistor to also

limit the current flow at the base emitter junction.

Page 56: fully automated nursing system.PDF

Chapter 3 : Hardware Description

49

Diagrams of transistors: NPN & PNP Diode

representation

Figure (3-17)

NPN made out of diodes :

Figure (3-18)

A transistor has 3 pins: Base, emitter and Collector the

majority current flow is through Collector towards

emitter there is a secondary current flow from base to

emitter.

Page 57: fully automated nursing system.PDF

Chapter 3 : Hardware Description

50

Darlington pair : Like we use (tip122)

Figure (3-19)

This is two transistors connected together so that the

amplified current from the first transistor is amplified

further by the second transistor. The first transistor's

emitter feeds into the second transistor's base and as a

result the input signal is amplified. This circuit acts like a

single transistor with the gain = to the product of all the

gains of the transistors.

Hfetotal = hfe1 × hfe2

This might sound like a good thing right but with all

good things come draw backs doubling the transistors

also doubles the base voltage and therefore instead on

needing 0.7v to switch the transistor you will now need

1.4v. A Darlington pair is so sensitive to current flow,

Page 58: fully automated nursing system.PDF

Chapter 3 : Hardware Description

51

that it can detect the current of you touching the base

connector with your finger; this makes it perfect for

touch plate switches.

Transistor to switch a large load

Figure (3-20)

When a transistor is used as a switch it must be either

fully on or off. If driving a inductive load like a relay or

any type of coil you should connect a diode in reverse

bias across the load so that back EMF will not flow into

the transistor, destroying it.

Page 59: fully automated nursing system.PDF

Chapter 3 : Hardware Description

52

3.4.1 - light circuit :

Light path :

It the smart circuit that receive the signal from pc (

have patient database ) And show it to the robot to

know it’s path to reach the patient bed who have a

drug in this time .

this signal is translated from microcontroller to know

the desired path of the patient and to make the path

light up .

and when the robot reach to the desired bed , it receive

signal from limit switch to turn off the desired path

and test if it have another signal that have another path

to go it to provide service to the patient of this bed , or

the robot finish it’s service to go it’s

initial place .

the component of this circuit :

max 232 :

Interface used as the link between

the Micro Controller and PC.

Page 60: fully automated nursing system.PDF

Chapter 3 : Hardware Description

53

MAX 232

Page 61: fully automated nursing system.PDF

Chapter 3 : Hardware Description

54

Figure (3-21)

Internal structure for MAX 232

Figure (3-22)

Page 62: fully automated nursing system.PDF

Chapter 3 : Hardware Description

55

Way to connect the MAX 232

serial port

Figure (3-23)

tip

Figure (3-24)

Page 63: fully automated nursing system.PDF

Chapter 3 : Hardware Description

56

used to as electronic switch to connect and

disconnect…..

Figure (3-25)

Figure (3-26)

Page 64: fully automated nursing system.PDF

Chapter 3 : Hardware Description

57

Figure (3-27)

Serial circuite : Pcp

Figure (3-28)

Page 65: fully automated nursing system.PDF

Chapter 3 : Hardware Description

58

light circuit :

simulation this circuit using proteus at initial the robot

found in switch that have number three and when the

circuit of microcontroller receive signal from pc via

serial port by pins RB6, RB7

and this signal is translated from the code that found in

microcontroller and then the path is determind and

light up.

Port B defined as output which responsible for follow

up 1 binary which mean 5 volt on the path we need to

light up .

When the determined path is light , the sensor circuit

detect the light .

RLD (LM 741) :

When robot follow the light and reach to the desired

bed , it press the limit switch to turn off the path …and

check if it has another path to go in and provide a

service to the patient , or the robot finish it’s task to go

it’s initial place .

Page 66: fully automated nursing system.PDF

Chapter 3 : Hardware Description

59

Limit switch :

Figure (3-29)

At the end of each course there is this the sensor to tell

us when the arrival of the robot to a place you want at

this moment is off track Shining who was walking by the

robot, and then tested the presence of a signal to move

the robot to service bed last or whether it had

completed his task specified in the current time and

must return to his place again.

3.4.2) Sensor circuit :

The circuit is based on a Schmitt Trigger. I have publish

in the past many circuits based on this brilliant building

block, like this Thermostat Circuit and this PC Fan

Failure Alarm. If you do not know how the Schmitt

Trigger works, I suggest you follow this link to read the

theory.

Page 67: fully automated nursing system.PDF

Chapter 3 : Hardware Description

60

The IC1 (741) along with the resistors R2, R3 and r4

performs the Schmitt Trigger. Instead of a waveform,

the input to the 741 comes from a voltage divider,

performed by a photocell (PH1) and a potentiometer

R1. This potentiometer will eventually set the sensitivity

of the circuit.

This is the photocell (LDR) that i use The output of the

Schmitt Trigger is driven through a resistor (R5) to the

base of the transistor amplifier. The circuit as-is, may

not be able to directly drive a relay with this transistor.

If you plan to use this circuit to drive higher loads than

LEDs, then you may consider use more amplification

stages. I only plan to power some 3-4 LEDs, so the

power is enough. Each LED will have its own limiting

resistor.

The circuit has a hysteresis that can be adjusted by

changing R4. This hysteresis works as follows: The LEDs

turn on when a specific amount of light falls on the

photocell. The LEDs will remain ON as long as the

Page 68: fully automated nursing system.PDF

Chapter 3 : Hardware Description

61

luminosity is bellow this amount. When the amount of

light starts to increase again and goes above this

specific point, the LEDs will NOT turn off. Instead, the

amount of light must go a little bit higher for the LEDs

to turn off. This difference is the hysteresis. The bigger

the R4 - the smaller the hysteresis and vice versa.

Any resistor between 100 Ohms and 100 KOhms can be

used. But keep in mind that above 40 KOhms, the

hysteresis is very small, almost none, so practically

there is no meaning to make such a circuit. The point of

this circuit is to have this hysteresis. The reason is very

simple. Suppose that you use this circuit for security

light - the LEDs must turn on when the ambient light is

not sufficient. Now suppose that this circuit is outside,

and the sun begins to fall. There will be a time, that the

amount of light is exactly at the point that the LEDs

must turn on. In an ideal world, the LEDs would turn on

and remain like this. But this will not happen. Instead,

the LEDs will turn on and off every time that the light

slightly changes, even for a tiny amount, causing the

circuit to oscillate. This is where the hysteresis comes to

save the day. When the LEDs turn on, the luminosity

Page 69: fully automated nursing system.PDF

Chapter 3 : Hardware Description

62

will have to change a lot until they turn off again. So,

slight light changes will be filtered.

Figure (3-30)

But we work on light so we change it to work on light

When the LDR see the light lm741 will out 1 if not the

o/p will be zero

Figure (3-31)

Page 70: fully automated nursing system.PDF

Chapter 3 : Hardware Description

63

Figure (3-32)

Figure (3-33)

Page 71: fully automated nursing system.PDF

Chapter 3 : Hardware Description

64

Robot brian !!

It consist of pic16f877the input of the circuit comes

from the sensor circuit to port D and the output to port

B to motor driver .

Figure (3-34)

Figure (3-35)

Page 72: fully automated nursing system.PDF

Chapter 3 : Hardware Description

65

Motor driver : with 4 Relay and Transistor k2222:

it drive the two motor by the orders come from

microcontroller circuit (robot brain)

Figure (3-36)

Figure (3-37)

Page 73: fully automated nursing system.PDF

Chapter 3 : Hardware Description

66

3.4.3 - SerialCircuit

Figure (3-38)

Page 74: fully automated nursing system.PDF

Chapter 4

Page 75: fully automated nursing system.PDF

Chapter 4 : AGV

68

4.1 - introduction

4.2 - navigation

4.3 - Steering control

4.4 - Magnetic Tape mode

4.5 - Guide Tape

4.6 - why light?

Page 76: fully automated nursing system.PDF

Chapter 4 : AGV

69

An automated guided vehicle or automatic guided

vehicle (AGV) is a mobile robot that follows markers or

wires in the floor, or uses vision or lasers. They are most

often used in industrial applications to move materials

around a manufacturing facility or a warehouse.

Application of the automatic guided vehicle has

broadened during the late 20th century and they are no

longer restricted to industrial environments.

Figure (4-1)

Page 77: fully automated nursing system.PDF

Chapter 4 : AGV

70

Automated guided vehicles (AGVs) increase efficiency

and reduce costs by helping to automate a

manufacturing facility or warehouse The AGV can tow

objects behind them in trailers to which they can

autonomously attach. The trailers can be used to move

raw materials or finished product. The AGV can also

store objects on a bed. The objects can be placed on a

set of motorized rollers (conveyor) and then pushed off

by reversing them. Some AGVs use fork lift to lift

objects for storage. AGVs are employed in nearly every

industry, including, pulp, paper, metals, newspaper, and

general manufacturing. Transporting materials such as

food, linen or medicine in hospitals is also done.

An AGV can also be called a laser guided vehicle (LGV)

or self-guided vehicle (SGV). In Germany the technology

is also called Fahrerlose Transportsystem (FTS) and in

Sweden förarlösa truckar. Lower cost versions of AGVs

are often called Automated Guided Carts (AGCs) and are

usually guided by magnetic tape. AGCs are available in a

variety of models and can be used to move products on

an assembly line, transport goods throughout a plant or

Page 78: fully automated nursing system.PDF

Chapter 4 : AGV

71

warehouse, and deliver loads to and from stretch

wrappers and roller conveyors.

The first AGV was brought to market in the 1950s, by

Barrett Electronics of Northbrook, Illinois, and at the

time it was simply a tow truck that followed a wire in

the floor instead of a rail. Over the years the technology

has become more sophisticated and today automated

vehicles are mainly Laser navigated e.g. LGV (Laser

Guided Vehicle). In an automated process, LGVs are

programmed to communicate (via an off board server)

with other robots to ensure product is moved smoothly

through the warehouse, whether it is being stored for

future use or sent directly to shipping areas. Today, the

AGV plays an important role in the design of new

factories and warehouses, safely moving goods to their

rightful destinations.

In the late 20th century AGVs took on new roles as

ports began turning to this technology to move ISO

shipping containers. The Port of Rotterdam employs

well over 100 AGVs.

Page 79: fully automated nursing system.PDF

Chapter 4 : AGV

72

AGV applications are seemingly endless as capacities

can range from just a few pounds to hundreds of tons.

Wired :

The wired sensor is placed on the bottom of the robot

and is placed facing the ground. A slot is cut in the

ground and a wire is placed approximately 1 inch below

the ground. The sensor detects the radio frequency

being transmitted from the wire and follows it.

Laser Target Navigation :

The wireless navigation is done by mounting retro

reflective tape on walls, poles or machines. The AGV

carries a laser transmitter and receiver on a rotating

turret. The laser is sent off then received again the

angle and (sometimes) distance are automatically

calculated and stored into the AGV’s memory. The AGV

has reflector map stored in memory and can correct its

position based on errors between the expected and

received measurements. It can then navigate to a

Page 80: fully automated nursing system.PDF

Chapter 4 : AGV

73

destination target using the constantly updating

position.

Modulated Lasers :

The use of modulated laser light gives greater range and

accuracy over pulsed laser systems. By emitting a

continuous fan of modulated laser light a system can

obtain an uninterrupted reflection as soon as the

scanner achieves line of sight with a reflector. The

reflection ceases at the trailing edge of the reflector

which ensures an accurate and consistent measurement

from every reflector on every scan. The LS9 Scanner is

manufactured by guidance navigation Ltd and, by using

a modulated laser; this system achieves an angular

resolution of ~ 0.1 mrad (0.006°) at 8 scanner

revolutions per second.

Pulsed Lasers:

A typical pulsed laser scanner emits pulsed laser light at

a rate of 14,400 Hz which gives a maximum possible

resolution of ~ 3.5 mrad (0.2°) at 8 scanner revolutions

Page 81: fully automated nursing system.PDF

Chapter 4 : AGV

74

per second. To achieve a workable navigation, the

readings must be interpolated based on the intensity of

the reflected laser light, to identify the Centre of the

reflector.

Gyroscopic Navigation:

Another form of AGV guidance is inertial navigation.

With inertial guidance, a computer control system

directs and assigns tasks to the vehicles. Transponders

are embedded in the floor of the work place. The AGV

uses these transponders to verify that the vehicle is on

course. A gyroscope is able to detect the slightest

change in the direction of the vehicle and corrects it in

order to keep the AGV on its path. The margin of error

for the inertial method is ±1 inch.

Inertial can operate in nearly any environment including

tight aisles or extreme temperatures.

Page 82: fully automated nursing system.PDF

Chapter 4 : AGV

75

Figure (4-2)

Unit-load AGV using natural-features navigation to

carry steel to quality assurance lab, courtesy Mobile

RobotsInc.

Natural Features Navigation:

Navigation without retrofitting of the workspace is

called Natural Features Navigation. One method uses

one or more range-finding sensors, such as a laser

range-finder, as well as gyroscopes and/or inertial

measurement units with Monte-Carlo/Markov

localization techniques to understand where it is as it

dynamically plans the shortest permitted path to its

goal. The advantage of such systems is that they are

Page 83: fully automated nursing system.PDF

Chapter 4 : AGV

76

highly flexible for on-demand delivery to any location.

They can handle failure without bringing down the

entire manufacturing operation, since AGVs can plan

paths around the failed device. They also are quick to

install, with less down-time for the factory.

To help an AGV navigate it can use two different steer

control systems. The differential speed control is the

most common. In this method there are two sets of

wheels being driven. Each set is connected to a common

drive train. These drive trains are driven at different

speeds in order to turn or the same speed to allow the

AGV to go forwards and/or backwards. The AGV turns

in a similar fashion to a tank. This method of steering is

good in the sense that it is easy to maneuver in small

spaces. More often than not, this is seen on an AGV that

is used to transport and turn in tight spaces or when the

AGV is working near machines.

Page 84: fully automated nursing system.PDF

Chapter 4 : AGV

77

This setup for the wheels is not used in towing

applications because the AGV would cause the trailer

tojackknife when it turned.

The other type of steering used is steered wheel control

AGV.

This type of steering is similar to a cars steering. It is

more precise in following the wire program than the

differential speed controlled method.

This type of AGV has smoother turning but cannot make

sharp turns in tight spots.

Steered wheel control AGV can be used in all

applications; unlike the differential controlled.

Steered wheel control is used for towing and can also at

times have an operator control it.

The magnetic tape is laid on the surface of the floor or

buried in a 10 mm channel, not only does it provide the

path for the AGV to follow but also sort strips of the

tape in different combos of the strip tell the AGV to

Page 85: fully automated nursing system.PDF

Chapter 4 : AGV

78

change lane and also speed up slow down and stop with

north and south magnetic combos, this is used by

TOYOTA USA and TOYOTA JAPAN.

Many light duty AGVs (some known as automated

guided carts or AGCs) use tape for the guide path. The

tapes can be one of two styles: magnetic or colored.

The AGC is fitted with the appropriate guide sensor to

follow the path of the tape.

One major advantage of tape over wired guidance is

that it can be easily removed and relocated if the course

needs to change.

It also does not involve the expense of cutting the

factory or warehouse floor for the entire travel route.

Additionally, it is considered a "passive" system since it

does not require the guide medium to be energized as

wire does.

Page 86: fully automated nursing system.PDF

Chapter 4 : AGV

79

Colored tape is initially less expensive, but lacks the

advantage of being embedded in high traffic areas

where the tape may become damaged or dirty.

A flexible magnetic bar can also be embedded in the

floor like wire but works under the same provision as

magnetic tape and so remains unpowered or passive.

To overcome this drawback, instead of guide tape we

used light follower.

Figure (4-3)

Page 87: fully automated nursing system.PDF

Chapter 4 : AGV

80

Light is smart circuit that receive the signal from pc And

show it to the robot to know its path.

Figure (4-4)

There are many advantages to use light follower instead

of line follower:

1. It is a New AGV technique that provides more

study for us.

2. Simple.

3. easy to implement.

4. Easy in programming.

Page 88: fully automated nursing system.PDF

Chapter 4 : AGV

81

5. Can be expanded as paths can be added easily.

6. No need to change code in case of expand.

7. Light overcomes some of line disadvantages

(Crash and expandability).

8. looks elegant and used in many styles.

9. Reflect luxury.

10. No need to be embedded in the floor like wire.

11. Controlled by pc only.

12. easy to maintained.

13. errors are easy to be detected.

But its disadvantage is high cost.

Page 89: fully automated nursing system.PDF

Chapter 5

Page 90: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

82

5.1 - Robot’s mechanical design

5.2 - Components

5.2.1 - The base

5.2.2 - The arm

5.2.3 - The disk

5.2.4 - The disk shroud

5.2.5 - The disk lug

5.3 - Robot main structure (body)

5.4 - Robot motion and motors

Page 91: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

83

This robot is a simulation for an auto nurse robot which

delivers medicine to definite places.

Figure (5-1)

Page 92: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

84

A simple mechanical design was made to provide this

job, and the robot main components are as follow:

5.2.1 - The base :

A square shaped base 30cm x 30cm which contains

motors, wheels and free wheels

It also provides installation for robot main structure.

Figure (5-2)

Page 93: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

85

Figure (5-3)

Figure (5-4)

Page 94: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

86

5.2.2 - The arm :

Which holds the stepper motor and the disk is also

fitted to the base.

Figure (5-5)

Page 95: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

87

5.2.3 - The disk :

The disk is made from wood and is dividing into 17

portions which include medicine.

Figure (5-6)

Page 96: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

88

The disk consists of two modules :

- The upper modules which contains medicine (Fig 5).

- The lower module which provides the motion of the

disk as it has a direct contact with the Stepper motor.

Figure (5-7)

5.2.4 - The disk shroud :

Which surrounds the disk to prevent medicine in the

disk from falling down in the robot.

Page 97: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

89

It has one open port for medicine sliding out of the disk.

Figure (5-8)

Page 98: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

90

5.2.5 - The disk lug :

At which the medicine slides over it out of the robot.

Figure (5-9)

Page 99: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

91

The body is made of metal and wood and it provides

containment for the disk, electronics, motors and the

base.

Figure (5-10)

Page 100: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

92

There are two types of motors were used in the robot

which are (gearbox motor, stepper motor).

The base contains two gear box motors with two small

wheels centered in the base to enable the robot to

rotate in its position without shifting.

Figure (5-11)

Page 101: fully automated nursing system.PDF

Chapter 5 : Mechanical Description

93

The disk contains one stepper motor to provide the

rotational motion of the disk.

Figure (5-12)

Page 102: fully automated nursing system.PDF

Chapter 6

Page 103: fully automated nursing system.PDF

Chapter 6 : Software Description

95

Contents

6.1 - About software

6.2 - Welcome window

6.3 - Main window

6.4 - Patients data window

6.5 - Patient medicines window

6.6 - Doctors data window

6.7 - Medicines data window

6.8 - Patients medicines windows

Page 104: fully automated nursing system.PDF

Chapter 6 : Software Description

96

6.1 - About software

In this chapter we will talk about the software we use

to manage small hospital.

This project is fully depend on software as the idea of

software part is storing all data about patients and the

times of their medicines in database and then sent it to

the robot by serial connection and then robot start it’s

trip to deliver medicines to the patient .

Programs Used:

Microsoft visual C# programming language.

Microsoft SQL server 2008.

How does program wok?

1. User inters patient data and his medicines and

clicks save.

2. Data saved in database via connection between c#

and database.

3. Time is checked permanently and at specific time a

signal is sent to light follower to light the path to

the specific bed.

Page 105: fully automated nursing system.PDF

Chapter 6 : Software Description

97

Design goals :

The ECMA standard lists these design goals for C#

language is intended to be a simple, modern, general-

purpose, object-oriented programming language.

The language, and implementations thereof, should

provide support for software engineering principles

such as strong-type checking, array bounds checking,

detection of attempts to use uninitialized variables,

and automatic garbage collection. Software robustness,

durability, and programmer productivity are important.

The language is intended for use in developing software

component suitable for deployment in distributed

environments.

Source code portability is very important, as is

programmer portability, especially for those

programmers already familiar with C and C++.

Support for internationalization is very important.

C# is intended to be suitable for writing applications for

both hosted and embedded system, ranging from the

Page 106: fully automated nursing system.PDF

Chapter 6 : Software Description

98

very large that use sophisticated operating systems,

down to the very small having dedicated functions.

Although C# applications are intended to be economical

with regard to memory and processing

power requirements, the language was not intended to

compete directly on performance and size with C or

assembly language.

Page 107: fully automated nursing system.PDF

Chapter 6 : Software Description

99

6.2 - Welcome window :

When using welcome window, There are some different

functions to choose from. Picture below is an example

of how the interface looks like and a short description

of each function.

Figure (6.1)

Welcome window used for user access control to define

user type and his privileges for using the software.

Page 108: fully automated nursing system.PDF

Chapter 6 : Software Description

100

6.3 - Main window :

When using main window, there are some different

functions to choose from. Picture below is an example

of how the interface looks like and a short description

of each function.

Figure (6.2)

1 – Patient data button : used to switch to the patients

data window to add new patient or modify existing one

or even delete a patient.

Page 109: fully automated nursing system.PDF

Chapter 6 : Software Description

101

2 – Doctor data button : used to switch to the doctors

data window to add new doctor or modify existing one

or even delete a doctor.

3 – Medicine data button : used to switch to the

medicine data window to add new medicine or modify

existing one or even delete a medicine.

4 – Exit button : used to close the program.

Page 110: fully automated nursing system.PDF

Chapter 6 : Software Description

102

6.4 - Patients data window :

When using patients data window, There are some

different functions to choose from. Picture below is an

example of how the interface looks like and a short

description of each function.

Figure (6.3)

1 – View button : used to show existing patient data

according to his ID number. Just enter the patient ID

number and click the view button the patient data will

appear in the fields shown in the window.

Page 111: fully automated nursing system.PDF

Chapter 6 : Software Description

103

2 – Save button : used to add new patient data to the

database. All you have to do is fill the required fields in

the patients data window and click the save button and

data will be sent to the database.

3 – Update button : used to modify existing patient data

by entering his ID number and click the view button to

show his data and then modify the required fields and

click the update button to send the modified data to the

database.

4 – Delete button : used to delete existing patient data

by entering his ID number and click the view button to

confirm that it is the required patient and then click the

delete button to send request to the database to delete

this patient from the database.

5 – Clear button : this button is used to clear all fields in

the patients data window to prepare it to new

operation.

6 – Add medicines button : used to add required

medicines for the patient with the number of times will

he take the medicine, the time when he will take the

Page 112: fully automated nursing system.PDF

Chapter 6 : Software Description

104

medicine, and the number of pills of the medicine

should the patient take.

7 – Browse button : used to add a picture for the

patient from hard disk drive or any other media to be

saved with the patient data in the database.

Page 113: fully automated nursing system.PDF

Chapter 6 : Software Description

105

6.5 - Patient medicines window :

When using patient medicines window, There are some

different functions to choose from. Picture below is an

example of how the interface looks like and a short

description of each function.

Figure (6.4)

Button number (1) : used to confirm the you done with

choosing the required medicines for the patient by

choosing them from the given comboboxes, choose

what number of times will the patient take the

Page 114: fully automated nursing system.PDF

Chapter 6 : Software Description

106

medicine, and the number of pills of the medicine will

the patient take then the data will be saved in patient

medicines table in the database.

Button number (2) :used to cancel the operation of

choosing required medicines for the patient and this

due to error happened or if there is any other reason.

Page 115: fully automated nursing system.PDF

Chapter 6 : Software Description

107

6.6 - Doctors data window :

When using doctors data window, There are some

different functions to choose from. Picture below is an

example of how the interface looks like and a short

description of each function.

Figure (6.5)

1 – View button : used to show existing doctor data

according to his ID number. Just enter the doctor ID

number and click the view button. The data will be send

Page 116: fully automated nursing system.PDF

Chapter 6 : Software Description

108

from the database to be appeared in the fields shown in

the window.

2 – Save button : used to add new doctor data to the

doctors data table in the database. All you have to do is

fill the required fields in the doctors data window and

click the save button and data will be saved in doctors

data table in the database.

3 – Update button : used to modify existing doctor data

by entering his ID number and click the view button to

show his data and then modify the required fields and

click the update button to send the modified data to the

doctors data table in the database.

4 – Delete button : used to delete existing doctor data

by entering his ID number and click the view button to

confirm that it is the required doctor and then click the

delete button to send request to the database to delete

this patient from the doctors data table in the database.

5 – Clear button : this button is used to clear all fields in

the doctors data window to prepare it to new

operation.

Page 117: fully automated nursing system.PDF

Chapter 6 : Software Description

109

6 – View Doctor DB button : used to select all doctors

data from the doctors data table to be viewed in the

data grid view shown in the doctors data window.

7 – Browse button : used to add a picture for the doctor

from hard disk drive or any other media to be saved

with the doctor data in the doctors data table in the

database.

Page 118: fully automated nursing system.PDF

Chapter 6 : Software Description

110

6.7 - Medicines data window :

When using medicines data window, There are some

different functions to choose from. Picture below is an

example of how the interface looks like and a short

description of each function.

Figure (6.6)

1 – View button : used to show existing medicine data

according to its ID number. Just enter the medicine ID

number and click the view button. The data will be send

Page 119: fully automated nursing system.PDF

Chapter 6 : Software Description

111

from the database to be appeared in the fields shown in

the window.

2 – Save button : used to add new medicine data to the

medicines data table in the database. All you have to do

is fill the required fields in the medicines data window

and click the save button and data will be saved in

medicines data table in the database.

3 – Update button : used to modify existing medicine

data by entering its ID number and click the view button

to show its data and then modify the required fields

and click the update button to send the modified data

to the medicines data table in the database.

4 – Delete button : used to delete existing medicine

data by entering its ID number and click the view button

to confirm that it is the required medicine and then click

the delete button to send request to the database to

delete this medicine from the medicines data table in

the database.

5 – Clear button : this button is used to clear all fields in

the medicine data window to prepare it to new

operation.

Page 120: fully automated nursing system.PDF

Chapter 6 : Software Description

112

6 – View Medicine DB button : used to select all

medicines data from the medicines data table to be

viewed in the data grid view shown in the medicines

data window.

Page 121: fully automated nursing system.PDF

Chapter 6 : Software Description

113

6.8 – Patients Medicines window :

When using Patients medicines window, There are

some different functions to choose from. Picture below

is an example of how the interface looks like and a

short description of each function.

Figure (6.7)

Page 122: fully automated nursing system.PDF

Chapter 6 : Software Description

114

This window is used for show patients medicines for

specific time period to send the signal to the robot to

deliver them to patients from the hospital pharmacy

under supervision of the responsible pharmacist.

The time of medicines is appeared in the data grid view

shown in the previous figure.

Page 123: fully automated nursing system.PDF

Chapter 7

Page 124: fully automated nursing system.PDF

Chapter 7 : Future Work

116

Figure (7-1)

It is a type of serial.

It is wireless network like mobile network.

Used instead of wired connection.

Advantages :

Remote control of the room.

Used in wide range.

Page 125: fully automated nursing system.PDF

Chapter 7 : Future Work

117

Disadvantages :

Very expensive

Needs high possibility

Message is not pure.

Some commands of GSM :

At + CMGS: to send a signal.

At + CMGR: to read signal.

At + CMGD: to delete message.

At: to check if the device is connected.

Camera can be added to robot so that patient’s family

can talk and see patient through it.

Doctor can talk to patient and precede patient status.

It increases more security to the system.

Nurse ensures that patient takes his medicine.

Page 126: fully automated nursing system.PDF

Chapter 7 : Future Work

118

Our project is a part of automatic hospital system.

So we hope to do automatic pharmacy that contain medicine and robot take it automatic without need to human.

Robot can take medicine and deliver it to the patient without error and faster in the time required.

Pharmacy contains software that contain database for medicines.

We hope to use technique of image processing in our project to recognize patient.

And this technique provides more security for system to avoid errors.

Doctor can access patient’s data remotely to precede his status with wireless connection through mobile network or internet.

Page 127: fully automated nursing system.PDF

Chapter 7 : Future Work

119

Improve design to enable it to inject patient or liquid

bottles.

Page 128: fully automated nursing system.PDF

Programming language C# by Prof. Dr. Ali Ibrahim Al-Desouky.

Micro controller by Dr. Mohamed Sherief Al-Kasasy http://www.w3schools.com/sql/sql_quickref.asp http://www.luxand.com http://www.wikipedia.com From Wikipedia, the free encyclopedia The Basics - Microcontrollers (part 1) Student Guide VERSION 2.2

Thanks to Robin Getz of National Semiconductor who supplied some of the material in this section.