microcontroller based anaesthesia injector

58
ANIL NEERUKONDA INSTITUTE OF TECHNOLOGY AND SCIENCES (UGC AUTONOMOUS) (Affiliated to Andhra University, Approved by AICTE & Accredited by NBA) Sangivalasa, Visakhapatnam Dist., (A.P.) CERTIFICATE This is to certify that the project report entitled MICROCONTROLLER BASED ANAESTHESIA INJECTORsubmitted by M.Kavya Sai (315126512106), P.V.S.Meghana (315126512129), M.Sai Praneeth (315126512088), N.Manoj Kalyan (315126512110) in partial fulfillment of the requirements for the award of the degree of Bachelor of Technology in Electronics & Communication Engineering of Andhra University, Visakhapatnam is a record of bonafide work carried out under my guidance and supervision. Project Guide Head of Department Mr.N.Srinivasa Naidu M.Tech,AMIETE Dr.V.Rajya LakshmiM.E.,Ph.D,MHRM,MIEEE,MIE,MIETE Dept. of ECE Dept. of ECE ANITS ANITS

Transcript of microcontroller based anaesthesia injector

ANIL NEERUKONDA INSTITUTE OF TECHNOLOGY AND SCIENCES

(UGC AUTONOMOUS)

(Affiliated to Andhra University, Approved by AICTE & Accredited by NBA)

Sangivalasa, Visakhapatnam Dist., (A.P.)

CERTIFICATE

This is to certify that the project report entitled “MICROCONTROLLER BASED

ANAESTHESIA INJECTOR” submitted by M.Kavya Sai (315126512106),

P.V.S.Meghana (315126512129), M.Sai Praneeth (315126512088), N.Manoj Kalyan

(315126512110) in partial fulfillment of the requirements for the award of the degree of

Bachelor of Technology in Electronics & Communication Engineering of Andhra

University, Visakhapatnam is a record of bonafide work carried out under my guidance and

supervision.

Project Guide Head of Department

Mr.N.Srinivasa Naidu M.Tech,AMIETE Dr.V.Rajya LakshmiM.E.,Ph.D,MHRM,MIEEE,MIE,MIETE

Dept. of ECE Dept. of ECE

ANITS ANITS

MICROCONTROLLER BASED ANAESTHESIA

INJECTOR

A Project report submitted in partial fulfillment of the requirements for the award

of the degree of

BACHELOR OF TECHNOLOGY IN

ELECTRONICS AND COMMUNICATION ENGINEERING

Submitted by

M.KAVYA SAI (315126512106) P.V.S.MEGHANA (315126512129)

M.SAI PRANEETH (315126512088) N.MANOJ KALYAN (315126512110)

Under The Esteemed Guidance Of

Mr. N.SRINIVASA NAIDUM.Tech,AMIETTE

ASSISTANT PROFESSOR

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

ANIL NEERUKONDA INSTITUTE OF TECHNOLOGY AND

SCIENCES

(UGC AUTONOMOUS)

(PermanentlyAffiliated to Andhra University, Approved by AICTE and Accredited

by NBA& NAAC with ‘A’ Grade)

SANGIVALASA, BHEEMUNIPATNAM MANDAL,

VISAKHAPATNAM, ANDHRA PRADESH

2018-2019

i

ACKNOWLEDGEMENT

We would like to express our deep sense of gratitude and respect to N. Srinivasa Naidu,

Assistant Professor, Department of Electronics and Communication Engineering, ANITS,

for his unsurpassed knowledge and immense encouragement.

We are grateful to Dr.V.Rajyalakshmi, Head of the Department, Electronics and

Communication Engineering, for providing us with the required facilities for the

completion of the project work.

We are very much thankful to the Principal and Management, ANITS,Sangivalasa, for

their encouragement and cooperation to carry out this work at the Industry.

We express our thanks to all teaching and non-teaching staff of Department of ECE, for

providing great assistance in accomplishment of the project.

We would like to thank our parents, friends, and classmates for their encouragement

throughout our project period. At last but not the least, we thank everyone for supporting

us directly or indirectly in completing this project successfully.

PROJECTSTUDENTS

M.KAVYASAI (315126512106)

P.V.S.MEGHANA (315126512129)

M.SAIPRANEETH (315126512088)

N.MANOJKALYAN (315126512110)

ii

CONTENTS

ACKNOWLEDGEMENT i

LIST OF FIGURES v

LIST OF TABLES vi

ABBREVATIONS

vii

ABSTRACT viii

CHAPTER 1.INTRODUCTION 1

1.1 PROJECT OBJECTIVE 2

1.2 PROJECT OUTLINE 2

CHAPTER 2.AUTOMATIC ANAESTHESIA SYSTEM 3

2.1 WORKING OF THE SYSTEM 3

2.2 FLOWCHART 4

CHAPTER 3.COMPONENTS OF AAI SYSTEM 5

3.1 COMPONENTS REQUIRED FOR THE SYSTEM 5

3.2 MICROCONTROLLER 5

3.2.1 MICROCONTROLLER VS MICROPROCESSOR 5

3.2.2 ARDUINO MEGA 6

3.2.3 OVERVIEW 7

3.2.4 POWER 7

3.2.5 MEMORY 8

iii

3.2.6 INPUT AND OUTPUT 8

3.2.7 COMMUNICATION 10

3.2.8 AUTOMATIC (SOFTWARE) RESET 10

3.2.9 USB OVERCURRENT PROTECTION 11

3.2.10PHYSICALCHARACTERISTICS 11

3.2.11PROGRAMMING 12

3.2.12PROGRAM STRUCTURE 13

3.3 LIQUID CRYSTAL DISPLAY 14

3.3.1 INTERFACING LCD TO ARDUINO 15

3.3.2 CIRCUIT DIAGRAM -ARDUINO TO 16×2 LCD 16

3.4 KEYPAD 17

3.5 STEPPER MOTOR 18

3.5.1 QUICK OVERVIEW 18

3.5.2 DESCRIPTION 19

3.5.3WORKING PRINCIPLE 20

3.5.4 STEPPER MOTOR TYPES BY CONSTRUCTION 21

3.5.5DRIVING MODES 22

3.5.6A4988 STEPPER DRIVER 22

3.6 REAL TIME CLOCK-DS3231 25

3.7 SYRINGE INFUSION PUMP 27

3.7.1 3D PRINTING 27

3.7.2 WORKING OF 3D PRINTING 28

3.7.3 BENEFITS OF 3D PRINTING 29

3.7.4 LIMITATIONS OF 3D PRINTING 29

iv

3.7.5 APPLICATION OF 3D PRINTING 29

3.7.6 SHAFT COUPLER 30

3.7.7 LEAD SCREW 32

3.7.8 ALUMINIUM FRAME 33

3.8 MECHANISM 34

CHAPTER 4. RESULTS 35

CHAPTER 5. CONCLUSION 38

REFERENCES 39

PROJECT MANAGEMENT AND FINANCE

PROJECT CODE

v

LIST OF FIGURES

Fig 1.1 Embedded System 1

Fig 2.1 Block Diagram of AAI System 3

Fig 2.2 Flowchart Representation of AAI System 4

Fig 3.1 Arduino Mega Pinout 6

Fig 3.2 Structure of Arduino Programming 12

Fig 3.3 16*2 Lcd Module Pin Out 13

Fig 3.4 LCD Interfacing to Arduino 14

Fig 3.5 4*4 Keypad 15

Fig 3.6 Nema17 5.6 Kg-Cm Stepper Motor17

Fig 3.7 Working Principle of Stepper Motor 18

Fig 3.8 Stepper Motor Types by Construction 19

Fig 3.9 Permanent Magnet Steppermotor 19

Fig 3.10 A4988 Motor Driver 20

Fig 3.11 Microstepping of A4899 20

Fig 3.12 A4988 Stepper Motor Driver Pin Out 21

Fig 3.13 Stepper Motor Interfacing To Arduino Mega

Through Stepper Driver 22

Fig 3.14 Real Time Clock-Ds3231 24

Fig 3.15 Features of RTC Ds-323124

Fig 3.16 Interfacing Real Time Clock to Arduino Mega 25

Fig 3.17 RTC Sample Output 25

Fig 3.18 3D Printing 30

Fig 3.19 Shaft Coupler 31

Fig 3.20 Shaft Coupling 32

Fig 3.21 Lead Screw 32

Fig 3.22 Interfacing Stepper Motor to Lead Screw 33

Fig 3.23 Aluminium Frame 33

Fig 4.1 Interfacing LCD with Arduino Mega 35

Fig 4.2 Interfacing Keypad with Arduino Mega 35

Fig 4.3 Syringe at Initial Position 35

Fig 4.4 Syringe Moving In Forward Direction 35

Fig 4.5 Syringe Moving In Backward Direction 36

vi

LIST OF TABLES

Table 3.1 Arduino Mega Features 7

Table 3.2 Step Resolutions Provided By Stepper Driver 24

vii

LIST OF ABBREVATIONS

AAI - AutomaticAnaesthesia Injector

RTC - Real Time Clock

ROM - Read only memory

PCB - Printed Circuit Board

RAM - Read Access Memory

IC - Integrated Circuit

UART- Universal Asynchronous Register Time

USB - Universal Serial Bus

ICSP – In Circuit Serial Programming

AC - Alternating Current

DC - Direct Current

PWM - Pulse Width Modulation

SRAM – Static Random Access Memory

EEPROM -Electrically Erasable Programmable Read Only Memory

FTDI -Future Technology Devices International

TTL -Transistor-Transistor Logic

MISO -Master In , Slave Out

MOSI -Master Out, Slave In

SCK -Serial Clock

IDE -Integrated Development Environment

FET -Field Effect Transistor

SDA -Serial Data

SCL -Serial Clock

viii

ABSTRACT

The objective of this paper is to aid an anaesthetist during a surgery to eliminate human

errors in injecting precise amount of anaesthesia drug to the patient. In the hospitals when

any major operation is performed, the patient must be in anesthetize condition. If the

operation lasts for a long time, complete dose of anaesthesia cannot be administered in a

single stroke. It may lead to the patient’s death. If lower amount of anaesthesia is

administered, the patient may wakeup at the middle of the operation. To avoid this, the

anaesthetist administers few milliliters of anaesthesia at specified time to the patient. If the

anaesthetist fails to administer the anaesthesia drug to the patient at a particular time in

precise amount, the patient may become conscious which causes agony to the patient and

inconvenience to the surgeon. To overcome such hazardous problems the design of an

automatic anaesthesia machine based on a micro-controller is effective.

ix

1

CHAPTER-1

INTRODUCTION

Major operations are performed to remove or reconstruct the infected parts in the human

body. These operations will lead to blood loss and pain. Therefore, it is necessary to

arrest the pain and the blood loss. Anesthesia plays an important role in the part of

painkilling. AAI can be defined as “Automatic administration of precise amounts of

anaesthesia at a specific time suggested by the anesthetist.” Anaesthesia is very

essential in performing painless surgery and so an Automatic administration of

Anesthesia is needed for a successful surgery.

An Embedded system is a combination of computer hardware, software and additional

mechanical parts designed to perform a specific function. An example is the microwave

oven. It is hardly realized that the oven actually consists of a processor and the software

running inside. Another example is the TV remote control. Very few actually realize

that there is a microcontroller inside that runs a set of programs especially for the TV.

Fig 1.1: EMBEDDED SYSTEM

1.1 PROJECT OBJECTIVE

2

The main aim of the project is to aid an anaesthetist during a surgery to eliminate human

errors in injecting precise amount of anaesthesia drug to the patient. Keypad is

interfaced to set the level of anesthesia to be administered to the patient in terms of

milliliters (1ml to 1000ml) and the time at which the drug should be injected. LCD is

interfaced to display the quantity to be injected and the time at which the drug is to be

injected. Real time clock keeps a track of current time. Stepper motor is mechanically

connected to the syringe infusion pump injects uniform flow of anesthesia at desired

time.

1.2 PROJECT OUTLINE

This project report is presented over the five remaining chapters. Chapter 2 explains the

working of “Automatic Anaesthesia System” using a flow chart. Chapter 3 presents the

“Components of Automatic Anaesthesia System”. Chapter 4 presents the “Interfacing

of Keypad”, to provide the quantity of anaesthesia drug to be injected and the time,

“Interfacing of LCD”, to display the quantity to be injected and the time and

“Interfacing of Stepper motor”, connected to syringe infusion pump to inject

anaesthesia with ARDUINO MEGA. Finally, the results of the project work and

conclusions are drawn in chapter 5.

CHAPTER 2

3

AUTOMATIC ANAESTHESIA SYSTEM (AAI)

Automatic Anesthesia Injector system is also an application of embedded

technologies in which a microcontroller is used to control the entire unit.

Fig 2.1: BLOCK DIAGRAM OF AAI SYSTEM

2.1 WORKING OF THE SYSTEM

By using the keypad provided along with the Microcontroller, the anesthetist can set

the level of anesthesia to be administered to the patient in terms of milliliters (1ml to

1000ml). After receiving the anesthesia level from the keypad, the Microcontroller sets

the system to administer anesthesia to the prescribed level. The rotation of the stepper

4

motor causes the Infusion Pump to move in forward or in a backward direction and the

anesthesia provided in the syringe is injected into the body of the patient.

2.2 FLOWCHART

Fig 2.2: FLOWCHART REPRESENTATION OF AAI SYSTEM

CHAPTER 3

COMPONENTS OF AAI SYSTEM

5

3.1 COMPONENTS REQUIRED FOR THE SYSTEM

1) Micro-Controller – to Control the overall operation (ARDUINO MEGA 2560)

2) Stepper Motor – to control the movement of the Syringe Infusion Pump (NEMA

17)

3) Liquid Crystal Display (16*2)

4) Keypad (4*4)

5) Real Time Clock (DS3231)

6) Syringe Infusion Pump

3.2 MICROCONTROLLER

A Microcontroller is a general-purpose device that is meant to read data, perform

limited calculations on that data and control its environment based on those

calculations. The prime use of a microcontroller is to control the operation of a machine

using a fixed program that is stored in ROM and that does not change over the lifetime

of the system. A microcontroller is a highly integrated chip that includes all or most of

the parts needed for a controller in a single chip. The microcontroller could be rightly

called a one-chip solution.

3.2.1 MICRO CONTROLLER Vs MICRO PROCESSOR

If a system is developed with a microprocessor, the designer has to go for external

memory such as RAM, ROM or EPROM and peripherals and hence the size of the PCB

will be large to hold all the required peripherals. But the micro controller has got all

these peripheral facilities on a single chip and hence development of similar system

with micro controller reduces PCB size and the overall cost of the design. The

6

difference between a Microprocessor and Microcontroller is that a Microprocessor can

only process with the data, but Microcontroller can control external device in addition

to processing the data. If a device has to be switched “ON” or “OFF”, external ICs are

needed to do this work. But with Microcontroller the device can be directly controlled

without an IC. A Microcontroller often deals with bits, not bytes as in the real-world

application, for example switch contracts can be open or close, indicators should be lit

or dark and motors can be either turned on or off and so forth.

3.2.2 ARDUINO MEGA

Fig 3.1: ARDUINO MEGA PINOUT

3.2.3 OVERVIEW

7

The Arduino Mega is a microcontroller board based on the ATmega2560. It has 54

digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs,

4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a

power jack, an ICSP header, and a reset button. It contains everything needed to support

the microcontroller; simply connect it to a computer with a USB cable or power it with

a AC-to-DC adapter or battery to get started. The Mega is compatible with most shields

designed for the Arduino Duemilanove or Diecimila.

TABLE 3.1: ARDUINO MEGA FEATURES

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limits) 6-20V

Digital I/O Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per I/O Pin 40 Ma

DC Current for 3.3V Pin 50 Ma

Flash Memory 256 KB of which 8KB used by boot loader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

3.2.4 POWER

The Arduino Mega can be powered via the USB connection or with an external power

supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or

battery. The adapter can be connected by plugging a 2.1mm center-positive plug into

the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin

headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than

7V, however, the 5V pin may supply less than five volts and the board may be unstable.

If using more than 12V, the voltage regulator may overheat and damage the board. The

8

recommended range is 7 to 12 volts. The Mega2560 differs from all preceding boards

in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the

Atmega8U2 programmed as a USB-to-serial converter.

The power pins are as follows:

➢ VIN. The input voltage to the Arduino board when it's using an external power

source (as opposed to 5 volts from the USB connection or other regulated power

source). You can supply voltage through this pin, or, if supplying voltage via

the power jack, access it through this pin.

➢ 5V. The regulated power supply used to power the microcontroller and other

components on the board. This can come either from VIN via an on-board

regulator, or be supplied by USB or another regulated 5V supply.

➢ 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current

draw is 50 mA.

➢ GND. Ground pins.

3.2.5 MEMORY

The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB is used

for the boot loader), 8 KB of SRAM and 4 KB of EEPROM (which can be read and

written with the EEPROM library).

3.2.6 INPUT AND OUTPUT

Each of the 54 digital pins on the Mega can be used as an input or output, using

pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each

pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor

(disconnected by default) of 20-50 kilo ohms. In addition, some pins have specialized

functions:

➢ Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX)

and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and

9

transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the

corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.

➢ External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19

(interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be

configured to trigger an interrupt on a low value, a rising or falling edge, or a

change in value.

➢ PWM: 0 to 13. Provide 8-bit PWM output with the analogWrite() function.

➢ SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI

communication using the SPI library. The SPI pins are also broken out on the

ICSP header, which is physically compatible with the Uno, Duemilanove and

Diecimila.

➢ LED: 13. There is a built-in LED connected to digital pin 13. When the pin is

HIGH value, the LED is on, when the pin is LOW, it's off.

➢ I2C: 20 (SDA) and 21 (SCL). Support I2C (TWI) communication using the

Wire library (documentation on the Wiring website). Note that these pins are

not in the same location as the I2C pins on the Duemilanove or Diecimila.

The Mega2560 has 16 analog inputs, each of which provides10 bits of resolution (i.e.

1024 different values). By default they measure from ground to 5 volts, though is it

possible to change the upper end of their range using the AREF pin and

analogReference() function.

There are a couple of other pins on the board:

➢ AREF. Reference voltage for the analog inputs. Used with analogReference().

➢ Reset. Bring this line LOW to reset the microcontroller. Typically used to add

a reset button to shields which block the one on the board.

3.2.7 COMMUNICATION

10

The Arduino Mega2560 has a number of facilities for communicating with a computer,

another Arduino, or other microcontrollers. The ATmega2560 provides four hardware

UARTs for TTL (5V) serial communication. An ATmega8U2 on the board channels

one of these over USB and provides a virtual com port to software on the computer

(Windows machines will need a .inf file, but OSX and Linux machines will recognize

the board as a COM port automatically. The Arduino software includes a serial monitor

which allows simple textual data to be sent to and from the board. The RX and TX

LEDs on the board will flash when data is being transmitted via the ATmega8U2 chip

and USB connection to the computer (but not for serial communication on pins 0 and

1).

3.2.8 AUTOMATIC (SOFTWARE) RESET

Rather than requiring a physical press of the reset button before an upload, the Arduino

Mega2560 is designed in a way that allows it to be reset by software running on a

connected computer. One of the hardware flow control lines (DTR) of the ATmega8U2

is connected to the reset line of the ATmega2560 via a 100 nanofarad capacitor. When

this line is asserted (taken low), the reset line drops long enough to reset the chip. The

Arduino software uses this capability to allow you to upload code by simply pressing

the upload button in the Arduino environment. This means that the boot loader can have

a shorter timeout, as the lowering of DTR can be well-coordinated with the start of the

upload.

This setup has other implications. When the Mega2560 is connected to either a

computer running Mac OS X or Linux, it resets each time a connection is made to it

from software (via USB). For the following half-second or so, the boot loader is running

on the Mega2560. While it is programmed to ignore malformed data (i.e. anything

besides an upload of new code), it will intercept the first few bytes of data sent to the

board after a connection is opened. If a sketch running on the board receives one-time

configuration or other data when it first starts, make sure that the software with which

11

it communicates waits a second after opening the connection and before sending this

data.

The Mega2560 contains a trace that can be cut to disable the auto-reset. The pads on

either side of the trace can be soldered together to re-enable it. It's labelled

"RESET-EN". You may also be able to disable the auto-reset by connecting a 110 ohm

resistor from 5V to the reset line.

3.2.9 USB Over current Protection

The Arduino Mega has a resettable polyfuse that protects your computer's USB ports

from shorts and over current. Although most computers provide their own internal

protection, the fuse provides an extra layer of protection. If more than 500 mA is applied

to the USB port, the fuse will automatically break the connection until the short or

overload is removed.

3.2.10 PHYSICAL CHARACTERISTICS AND SHIELD COMPATIBILITY

The maximum length and width of the Mega PCB are 4 and 2.1 inches respectively,

with the USB connector and power jack extending beyond the former dimension. Three

screw holes allow the board to be attached to a surface or case.The distance between

digital pins 7 and 8 is 160 mil (0.16"), not an even multiple of the 100 mil spacing of

the other pins.

The Mega is designed to be compatible with most shields designed for the Diecimila or

Duemilanove. Digital pins 0 to 13 (and the adjacent AREF and GND pins), analog

inputs 0 to 5, the power header, and ICSP header are all in equivalent locations. Further

the main UART (serial port) is located on the same pins (0 and 1), as are external

interrupts 0 and 1 (pins 2 and 3 respectively). SPI is available through the ICSP header

on the Mega and Duemilanove / Diecimila. I2C is not located on the same pins on the

Mega (20 and 21) as the Duemilanove / Diecimila (analog inputs 4 and 5).

12

3.2.11 PROGRAMMING

The Arduino Mega can be programmed with the Arduino software.

The ATmega2560 on the Arduino Mega comes preburned with a boot loader that allows

you to upload new code to it without the use of an external hardware programmer. It

communicates using the original STK500 protocol.

Arduino is a prototype platform (open-source) based on an easy-to-use hardware and

software. It consists of a circuit board, which can be programmed (referred to as a

microcontroller) and ready-made software called Arduino IDE (Integrated

Development Environment), which is used to write and upload the computer code to

the physical board.

The key features are −

➢ Arduino boards are able to read analog or digital input signals from

different sensors and turn it into an output such as activating a motor,

turning LED on/off, connect to the cloud and many other actions.

➢ We can control your board functions by sending a set of instructions to

the microcontroller on the board via Arduino IDE (referred to as

uploading software).

➢ Unlike most previous programmable circuit boards, Arduino does not

need an extra piece of hardware (called a programmer) in order to load

a new code onto the board. We can simply use a USB cable.

➢ Additionally, the Arduino IDE uses a simplified version of C++, making

it easier to learn to program.

3.2.12 PROGRAM STRUCTURE

13

The Arduino software is open-source software. The source code for the Java

environment is released under the GPL and the C/C++ microcontroller libraries are

under the LGPL.

Structure

Arduino programs can be divided in three main parts: Structure, Values (variables and

constants), and Functions.

Software structure consists of two main functions −

➢ Setup( ) function

➢ Loop( ) function

Fig 3.2: STRUCTURE OF ARDUINO PROGRAMMING

Void setup ( ) {

14

}

PURPOSE − The setup () function is called when a sketch starts. Use it to

initialize the variables, pin modes, start using libraries, etc. The setup function

will only run once, after each power up or reset of the Arduino board.

INPUT --

OUTPUT --

RETURN --

Void Loop ( ) {

}

PURPOSE − After creating a setup() function, which initializes and sets the

initial values, the loop() function does precisely what its name suggests, and

loops consecutively, allowing your program to change and respond. Use it to

actively control the Arduino board.

INPUT --

OUTPUT --

RETURN --

3.3 LIQUID CRYSTAL DISPLAY

A Liquid Crystal Display commonly abbreviated as LCD is basically a display unit

built using Liquid Crystal technology. When we build real life/real world electronics

based projects, we need a medium/device to display output values and messages. The

most basic form of electronic display available is 7 Segment display –which has its own

limitations. The next best available option is Liquid Crystal Displays which comes in

different size specifications. Out of all available LCD modules in market, the most

commonly used one is 16×2 LCD Module which can display 32 ASCII characters in 2

lines (16 characters in 1 line). Other commonly used LCD displays are 20×4 Character

15

LCD, Nokia 5110 LCD module, 128×64 Graphical LCD Display and 2.4 inch TFT

Touch screen LCD display.

3.3.1 INTERFACING 16×2 LCD TO ARDUINO

The JHD162A LCD module has 16 pins and can be operated in 4-bit mode or 8-bit

mode. Here we are using the LCD module in 4-bit mode. Before going in to the details

of the project, let’s have a look at the JHD162A LCD module. The schematic of a

JHD162A LCD pin diagram is given below.

Fig 3.3: 16*2 LCD MODULE PIN OUT

The name and functions of each pin of the 16×2 LCD module is given below.

➢ Pin1 (Vss): Ground pin of the LCD module.

➢ Pin2 (Vcc): Power to LCD module (+5V supply is given to this pin)

➢ Pin3 (VEE): Contrast adjustment pin. This is done by connecting the ends of a

10K potentiometer to +5Vand ground and then connecting the slider pin to the

VEE pin. The voltage at the VEE pin defines the contrast. The normal setting is

between 0.4 and 0.9V.

➢ Pin4 (RS): Register select pin. The JHD162A has two registers namely

command register and data register. Logic HIGH at RS pin selects data

register and logic LOW at RS pin selects command register. If we make the RS

pin HIGH and feed an input to the data lines (DB0 to DB7), this input will be

16

treated as data to display on LCD screen. If we make the RS pin LOW and feed

an input to the data lines, then this will be treated as a command (a command to

be written to LCD controller – like positioning cursor or clear screen or scroll).

➢ Pin5(R/W): Read/Write modes. This pin is used for selecting between read and

write modes. Logic HIGH at this pin activates read mode and logic LOW at this

pin activates write mode.

➢ Pin6 (E): This pin is meant for enabling the LCD module. A HIGH to LOW

signal at this pin will enable the module.

➢ Pin7 (DB0) to Pin14 (DB7): These are data pins. The commands and data are

fed to the LCD module though these pins.

➢ Pin15 (LED+): Anode of the back light LED. When operated on 5V, a 560 ohm

resistor should be connected in series to this pin. In arduino based projects the

back light LED can be powered from the 3.3V source on the arduino board.

➢ Pin16 (LED-): Cathode of the back light LED.

3.3.2 CIRCUIT DIAGRAM – ARDUINO TO 16×2 LCD MODULE

RS pin of the LCD module is connected to digital pin 12 of the arduino. R/W pin of the

LCD is grounded. Enable pin of the LCD module is connected to digital pin 11 of the

arduino. In this project, the LCD module and arduino are interfaced in the 4-bit mode.

This means only four of the digital input lines (DB4 to DB7) of the LCD are used. This

method is very simple, requires less connections and you can almost utilize the full

potential of the LCD module.

17

Fig 3.4: LCD INTERFACING TO ARDUINO

Digital lines DB4, DB5, DB6 and DB7 are interfaced to digital pins 5, 4, 3 and 2 of the

Arduino. The 10K potentiometer is used for adjusting the contrast of the display. 560

ohm resistor R1 limits the current through the back light LED. The arduino can be

powered through the external power jack provided on the board. +5V required in some

other parts of the circuit can be tapped from the 5V source on the arduino board. The

arduino can be also powered from the PC through the USB port

3.4 KEYPAD

Keypads are used in all types of devices, including cell phones, fax machines,

microwaves, ovens, door locks, etc. They’re practically everywhere. Tons of electronic

devices use them for user input

18

Fig 3.5: 4*4 KEYPAD

This is a keypad that follows an encoding scheme that allows it to have much less output

pins than there are keys. For example, the matrix keypad we are using has 16 keys (0-

9, A-D, *, #), yet only 8 output pins. With a linear keypad, there would have to be 17

output pins (one for each key and a ground pin) in order to work. The matrix encoding

scheme allows for less output pins and thus much less connections that have to be made

for the keypad to work. In this way, they are more efficient than linear keypads, being

that they have less wiring.

3.5 STEPPER MOTOR

3.5.1 QUICK OVERVIEW

1. Step Angle: 1.8 °

2. Current: 1.2 A/Phase

3. Holding Torque: 5.6 kg-cm

19

4. Detent torque: 2.8 N.cm (Maximum)

5. Lead Wires: 4

6. Shaft diameter: 5 mm

Fig 3.6: NEMA17 5.6 kg-cm STEPPER MOTOR

3.5.2 DESCRIPTION

The stepper motors move in precisely repeatable steps, hence they are the motors of

choice for the machines requiring precise position control. The NEMA17 5.6 kg-cm

Stepper Motor can provide 5.6 kg-cm of torque at 1.2A current per phase.

The motor’s position can be commanded to move or hold at one position with the help

of Stepper Motor Drivers. The NEMA17 5.6 kg-cm Stepper Motor provides excellent

response to starting, stopping and reversing pulses from stepper motor driver.

They are very useful in the various applications, especially which demands low speed

with high precision. Many machines such as 3D Printers, CNC Router and Mills,

Camera Platforms, XYZ Plotters etc.

20

It is a brushless DC motor, so the life of this motor is dependent upon life of the

bearings. The position control is achieved by a simple Open Loop control mechanism

so doesn’t require complex electronic control circuitry.

Note:

1. The Nema17 5.6kgcm Stepper motor dimensions and weight may have ±2%

error.

2. Resonances can occur because of improper installment.

3. Not easy to operate at extremely high speeds.

Features:

1. Input pulse decides the rotation angle of the motor.

2. High accuracy of around 3 to 5% a step.

3. Provides good starting, stopping and reversing.

4. Control of this motor is less costly because of exclusion of complex control circuitry.

5. The speed is proportional to the frequency of input pulses.

3.5.3 WORKING PRINCIPLE

Stepper motor is a brushless DC motor that rotates in steps. This is very useful because

it can be precisely positioned without any feedback sensor, which represents an open-

loop controller. The stepper motor consists of a rotor that is generally a permanent

magnet and it is surrounded by the windings of the stator. As we activate the windings

step by step in a particular order and let a current flow through them they will magnetize

the stator and make electromagnetic poles respectively that will cause propulsion to the

motor.

21

Fig 3.7: WORKING PRINCIPLE OF STEPPER MOTOR

3.5.4 STEPPER MOTOR TYPES BY CONSTRUCTION

By construction there are 3 different types of stepper motors: permanent magnet

stepper, variable reluctance stepper and hybrid synchronous stepper motor. The Hybrid

Synchronous motor is a combination of permanent magnet stepper and the variable

reluctance stepper. It has permanent magnet toothed rotor and also a toothed stator. The

rotor has two sections, which are opposite in polarity and their teeth are offset as shown

here. Fig is a front view of a commonly used hybrid stepper motor which has 8 poles

on the stator that are activated by 2 windings, A and B. So if we activate the winding

A, we will magnetize 4 poles of which two of them will have South polarity and two of

them north polarity.

Fig 3.8: HYBRID STEPPER MOTOR

22

3.5.5 DRIVING MODES

There are several different ways of driving the stepper motor. The first one is the Wave

Drive or Single-Coil Excitation. In this mode we active just one coil at a time which

means that for this example of motor with 4 coils, the rotor will make full cycle in 4

steps.

Next is the Full step drive mode which provides much higher torque output because we

always have 2 active coils at a given time. However this doesn’t improve the resolution

of the stepper and again the rotor will make a full cycle in 4 steps.

FIG 3.9 FULL STEP DRIVING MODE

3.5.6 A4988 STEPPER DRIVER

Fig 3.10 A4988 STEPPER DRIVER

However the most common method of controlling stepper motors nowadays is the

Micro stepping. In this mode we provide variable controlled current to the coils in form

23

of sin wave. This will provide smooth motion of the rotor, decrease the stress of the

parts and increase the accuracy of the stepper motor.

Fig3.11: MICROSTEPPING OF A4899

The pin out of the driver and hooking it up with the stepper motor and the controller is

as shown in Fig 3.12. So the 2 pins on the button right side are for powering the driver,

the VDD and Ground pins that are to be connected to a power supply of 3 to 5.5 V and

in our case that will be our controller, the Arduino Board which will provide 5 V. The

following 4 pins are for connecting the motor. The 1A and 1B pins will be connected

to one coil of the motor and the 2A and 2B pins to the other coil of the motor. For

powering the motor the next 2 pins, Ground and VMOT are connected to Power Supply

from 8 to 35 V and also a decoupling capacitor with at least 47 µF for protecting the

driver board from voltage spikes. The next two 2 pins, Step and Direction are the pins

that we actually use for controlling the motor movements. The Direction pin controls

the rotation direction of the motor and it is to be connected to one of the digital pins on

our microcontroller, for example connect it to the pin number 4 of the Arduino Board.

With the Step pin the micro steps of the motor are controlled and with each pulse sent

to this pin the motor moves one step.

24

Fig 3.12: A4988 STEPPER MOTOR DRIVER PIN OUT

The next 3 pins (MS1, MS2 and MS3) are for selecting one of the five step resolutions

according to the above truth table. These pins have internal pull-down resistors so if

they are left disconnected, the board will operate in full step mode.

The last one, the ENABLE pin is used for turning on or off the FET outputs. So logic

high will keep the outputs disabled.

TABLE 3.2 STEP RESOLUTIONS PROVIDED BY STEPPER DRIVER

25

3.6 REAL TIME CLOCK- DS3231

Fig 3.13: REAL TIME CLOCK-DS3231

The DS3231 is a low-cost, highly accurate Real Time Clock which can maintain hours,

minutes and seconds, as well as, day, month and year information. Also, it has

automatic compensation for leap-years and for months with fewer than 31 days.

Fig 3.14: FEATURES OF RTC DS-3231

The module can work on either 3.3 or 5 V which makes it suitable for many

development platforms or microcontrollers. The battery input is 3V and a typical

26

CR2032 3V battery can power the module and maintain the information for more than

a year. The module uses the I2C Communication Protocol which makes the connection

to the Arduino Board very easy.

Fig 3.15: INTERFACING REAL TIME CLOCK TO ARDUINO MEGA

27

Fig 3.16: RTC SAMPLE OUTPUT

So all we need is 4 wires, the VCC and the GND pins for powering the module, and the

two I2C communication pins, SDA and SCL.

3.7 SYRINGE INFUSION PUMP

The Syringe Infusion pump provides uniform flow of fluid by precisely driving the

plunger of a syringe towards its barrel. It provides accurate and continuous flow rate

for precisely delivering anesthesia medication in critical medical care.Glass and plastic

Syringes of all sizes from 1ml to 30ml can be used in the infusion pump. The flow rates

can be adjusted from 1ml to 99ml. Since it accepts other syringe size also, much lower

flow rate can be obtained by using smaller syringes.

A good infusion device should be:

1. Reliable and electrically safe

2. Able to deliver the infusion accurately and consistently

3. Easy to set up and use

4. Portable and robust

5. Powered with battery and mains both

6. Equipped with override rapid infusion facility

7. Capable of alerting line occlusion and need to re-change syringe

3.7.1 3D PRINTING

3D printing is also called additive manufacturing. This term accurately describes how

this technology works to create objects. "Additive" refers to the successive addition of

thin layers between 16 to 180 microns or more to create an object. In fact, all 3D printing

28

technologies are similar, as they construct an object layer by layer to create complex

shapes.

3.7.2 WORKING OF 3D PRINTING

There are 3 main steps in 3D printing.

The first step is the preparation just before printing; when you design a 3D file of the

object you want to print. This 3D file can be created using CAD software, with a 3D

scanner or simply downloaded from an online marketplace. Once you have checked

that your 3D file is ready to be printed, you can proceed to the second step.

The second step is the actual printing process. First, you need to choose which material

will be the best to achieve the specific properties required for your object. The variety

of materials used in 3D printing is very broad. It includes plastics, ceramics, resins,

metals, sand, textiles, biomaterials, glass, food and even lunar dust! Most of these

materials also allow for plenty of finishing options that enable you to achieve the precise

design result you had in mind, and some others, like glass for example, are still being

developed as 3D printing material and are not easily accessible yet.

The third step is the finishing process. This step requires specific skills and materials.

When the object is first printed, often it cannot be directly used or delivered until it has

been sanded, lacquered or painted to complete it as intended.

29

Fig.3.17: FLASH PRINT SOFTWARE USED FOR 3D PRINTING OF HARDWARE COMPONENTS

3.7.3 BENEFITS OF 3D PRINTING

1. Geometric complexity at no extra cost

2. Very low start-up costs

3. Customization of each and every part

4. Low-cost prototyping with very quick turnaround

5. Large range of(speciality) materials

3.7.4 LIMITATIONS OF 3D PRINTING

1. Lower strength and anisotropic properties

2. Less cost-competitive at higher volumes

3. Limited accuracy and tolerances

4. Post-processing and support removal

3.7.5 APPLICATIONS OF 3D PRINTING

1. Aerospace

2. Automotive

3. Robotics

4. Tooling

5. Healthcare

6. Design

7. Cinema

8. Education

30

Fig 3.18: 3D PRINTER

FIG.3.19 3D PRINTED COMPONENTS

The material used for 3d printing of hardware components is PLA (polymer).The

software used is flash print; it has a wide range of parameters can be set by the user for

greater printing flexibility. The file format used for design of 3d printing hardware

components is an STL file.

3.7.6 SHAFT COUPLER

Fig 3.20: SHAFT COUPLER

Dimensions: 5mm*8mm

Shaft Coupling

Shaft couplings are actually the mechanical device that connects or couples the two

drive element or shaft together for transmitting the power from one end to another.

31

Couplings do not allow any shaft interruption during operation. Anyway, with the

torque limiting couplings can disconnect when the limit of the torque is exceeded.

Advantages of Shaft Coupling

• Transfer the power from one end to another end

• Provide connectivity of shaft with the other units that are manufactured such as

motor and generators

• Provide shaft misalignment and mechanical flexibility

• Decreases the shock load transmission from shaft one end to another

• Provide protection against overload

• Adjust the rotating unit vibration characteristics

• Connect the driving part

There is the number of applications based on coupling in automobiles such as drive

shaft connecting the engine, and the rear axle is just the universal joint. And based on

the area of application, there are various types of couplings. These shaft couplers are

divided into following categories:

Types of Shaft Coupling: Couplings

• Rigid Couplings

• Flexible or compensating

couplings

32

FIG 3.21: SHAFT COUPLING

3.7.7 LEAD SCREW

A lead screw also known as a power screw or translation screw is a screw used as a

linkage in a machine, to translate turning motion into linear motion. Because of the

large area of sliding contact between their male and female members, screw threads

have larger frictional energy losses compared to other linkages. They are not typically

used to carry high power, but more for intermittent use in low power actuator and

positioned mechanisms. Common applications are linear actuators, machine slides

(such as in machine tools), vises, presses, and jacks.

FIG 3.22: LEAD SCREW

Dimensions: Length-20cm

Diameter-8mm

Advantages and Disadvantages:

The advantages of a lead screw are:

• Large load carrying capability

• Compact

• Simple to design

• Easy to manufacture; no specialized machinery is required

33

• Large mechanical advantage

• Precise and accurate linear motion

• Smooth, quiet, and low maintenance

• Minimal number of parts

• Most are self-locking

The disadvantages are that most are not very efficient. Due to the low efficiency they

cannot be used in continuous power transmission applications. They also have a high

degree of friction on the threads, which can wear the threads out quickly.

FIG 3.23: INTERFACING STEPPER MOTOR TO LEAD SCREW

3.7.8 ALUMINIUM FRAME

The aluminum frame is an essential component used in many Machines.

34

FIG 3.24: ALUMINIUM FRAME

Dimensions:

Length: 20.5 cm; Height: 3.3 cm; Width: 3.3 cm

Aluminium Frame for supporting the mechanical interface of motor and infusion

pump.

3.8 BASIC MECHANISM

• Switch on the AUTOMATIC ANAESTHESIA SYSTEM.

• The anaesthetist sets the level of anaesthesia to be administered to the patient

in terms of millilitres (1ml to 1000ml) and time at which the drug should be

injected using Keypad.

• The quantity to be injected and the time are displayed on the LCD.

• Real time clock keeps track of current time.

• When the time entered by the anaesthetist matches the current time, the stepper

motor rotates and the syringe infusion pump mechanically connected to the

stepper motor injects uniform flow of anaesthesia by precisely driving the

plunger of a syringe towards its barrel.

• This process will be repeated every time up on requirement of injecting

anaesthesia to the patient.

35

CHAPTER 4

RESULTS

In this Keypad is interfaced to provide the quantity to be injected and the timing, LCD

is interfaced to display the quantity to be injected and the timing and Stepper motor is

interfaced and connected to syringe infusion pump to inject anaesthesia with

ARDUINO MEGA 2560.

FIG 4.1: INTERFACING LCD WITH ARDUINO

• Interfacing LCD to

display the quantity

of drug to be injected

and the time at which

drug should be

injected.

36

Fig 4.2: INTERFACING KEYPAD WITH ARDUINO

FIG.4.3: SYRINGE INFUSION PUMP CONNECTED TO THE MOTOR

The infusion pump is mechanically interfaced to the stepper motor. In Fig.4.3 it can be

observed that the piston is at initial position i.e. the stepper motor did not yet start the

rotation operation

• Interfacing Keypad

to provide the

inputs, quantity to

be injected and the

time at which drug

should be injected.

37

FIG.4.4: PISTON OF THE SYRINGE MOVING IN FORWARD DIRECTION

In Fig4.4 it is observed that the stepper motor starts its rotation after its phases are

energised by the pulses of stepper driver which is controlled by the Arduino board.

The piston moves in forward direction which helps in injecting anaesthesia drug to the

patient.

FIG.4.5: PISTON OF THE SYRINGE MOVING IN BACKWARD DIRECTION

In fig 4.5 it can be observed that the piston is moving in backward direction. This action

is performed by controlling the direction pin of stepper driver. This backward motion

of piston is helpful for refilling of the syringe with the required anaesthsia drug.

38

CHAPTER 5

CONCLUSION

Microcontroller is made use of to perform anaesthesia injecting operation, where the

quantity to be injected and the time at which the drug should be injected is provided.

The Microcontroller displays the quantity to be injected and the time in the display

device. Syringe infusion pump is mechanically connected to the motor. The stepper

motor is used to control the forward and backward movement of the piston of the

syringe. It is practically calculated that 150 steps of stepper motor rotation is required

to inject 1ml of drug when the delay provided to stepper motor between each pulse is

6000 microseconds and the step angle is 1.8 degrees (i.e. full step).

The Syringe Infusion pump injects uniform flow of anaesthesia by precisely driving the

plunger of a syringe towards its barrel.

Modern technologies have developed using Embedded Systems promoting comfortable

and better life. PREVENTION IS BETTER THAN CURE and protection is

39

intelligent than prevention and MICROCONTROLLER BASED ANESTHESIA

MACHINE is one of the efficient protecting systems plays its major roll in Bio-

Medical field.

40

REFERENCES

[1] Kenneth J. Ayala, The 8051 microcontroller architecture, programming, and

applications, Indian reprint 2007, THOMSON Delmar learning. [2] Biomedical Instrumentation and Application – William John Webster

[3] Exploring Arduino Tools and Techniques for engineering wizardry – Jermy Blum

[4] 3D Printing: Technology, Applications and Selection - 1st edition - Rafiq Noorani

41

PROJECT MANAGEMENT AND FINANCE

42

CODE

#include<LiquidCrystal.h>

#include<Keypad.h>

#include<stdio.h>

#include <DS3231.h>

DS3231 rtc(SDA,SCL);

LiquidCrystal lcd(8,9,10,11,12,13);

long int n;

long int value=0;

char key;

char tm[8];

String sam;

long int z;

long int t =z*150;

String s;

const int stepPin = 3;

const int dirPin = 4;

const byte ROWS =4;

const byte COLS = 4;

char keys[ROWS][COLS] =

{

{'1','2','3','A'},

43

{'4','5','6','B'},

{'7','8','9','C'},

{'*','0','#','D'}

};

byte rowPins[ROWS] = { 22,23,24,25 };

byte colPins[COLS] = { 26, 27 ,28,29};

Keypad kpd = Keypad( makeKeymap(keys), rowPins,

colPins, ROWS, COLS );

void setup() {

// put your setup code here, to run once:

pinMode(stepPin,OUTPUT);

pinMode(dirPin,OUTPUT);

rtc.begin();

// The following lines can be uncommented to set the date and time

rtc.setTime(22, 45, 00); // Set the time to 12:00:00 (24hr format)

for(int k=8 ; k<14;k++)

{

pinMode(k,OUTPUT);

}

lcd.begin(16, 2);

44

}

void loop() {

// put your main code here, to run repeatedly:

lcd.setCursor(0,0);

lcd.print(rtc.getTimeStr());

delay(1000);

key='a';

while(key!='#'){

key = kpd.getKey();

if(key != NO_KEY)

{

if((key >='0') && (key <='9'))

value=value*10;

value=value+key-'0';

}

if(key== '#')

{

Serial.println("amount=");

Serial.println(value+13);

lcd.setCursor(0,0);

lcd.print("amount=");

lcd.setCursor(0,1);

lcd.print(value+13);

z=value+13;

value=0;

}

}

key='a';

while(key!='#'){

key = kpd.getKey();

if(key != NO_KEY)

{

if((key >='0') && (key <='9'))

value=value*10;

45

value=value+key-'0';

}

if(key== '#')

{

Serial.println("time=");

Serial.println(value+13);

n=value+13;

sam=String(n);

tm[0]=sam[0];

tm[1]=sam[1];

tm[2]=':';

tm[3]=sam[2];

tm[4]=sam[3];

tm[5]=':';

tm[6]=sam[4];

tm[7]=sam[5];

tm[8]=' ';tm[9]=' ';tm[10]=' ';tm[11]=' ';

Serial.println(tm);

lcd.setCursor(0,0);

lcd.print("time=");

lcd.setCursor(0,1);

lcd.print(tm);

value=0;

}

}

s=String( rtc.getTimeStr());

if(s.equals(tm))

{

digitalWrite(dirPin,HIGH);

for(int x = 0; x < t; x++) {

digitalWrite(stepPin,HIGH);

delayMicroseconds(6000);

digitalWrite(stepPin,LOW);

46

delayMicroseconds(6000);

}

delay(1000);

digitalWrite(dirPin,LOW);

for(int x = 0; x < t; x++) {

digitalWrite(stepPin,HIGH);

delayMicroseconds(6000);

digitalWrite(stepPin,LOW);

delayMicroseconds(6000);

}

delay(1000);

}

}