You are on page 1of 25

CHAPTER 3

METHODOLOGY

3.1 OVERVIEW

FIG the VDI 2206 model (VDI 2206- A guide for design of new Mechatronic systems, 2002)

The Association of German Engineers (VDI –Verein Deutscher Ingenieure) developed the design
methodology for mechatronic systems, VDI-2206, to meet the need to solve more complex engineering
problems in an innovative manner (Avarestech.com, 2019). The methodology seeks to integrate
and combine different disciplines, such as mechanical engineering, electronic instrumentation, and
information technology. This design process method is iterative, where each iteration represents a
degree of maturity in the solution of the mechatronic system. Its main characteristics are as follows.

▪The mechatronic system is divided into modules, also called subsystem, in a top-down process. The
modules are divided into assemblies, the components of which provide the details.

▪Throughout the process, models and simulations are developed to define the behavior of the system.
▪The system integration is a bottom-up process, starting with the integration of components, assemblies,
and modules, and finally, the complete mechatronic system is actualized through constant validation
and verification at all its levels. This allows the system requirements to be revised along the design
process.

The above design process can be grouped into four main stages (see Fig.2. 1); it has as input the
requirements and specifications that the system must meet and as output the mechatronic system itself.
The stages are briefly described as following.

1. System design: The system is considered as a whole, and later defined at the level of
components. The system is divided into modules, defining the system constraints. The details of the
modules are in accordance with the development of the task distribution, transition and power
generation functions, information and control functions, sensor selection, actuators and components,
human-machine interface, reliability, and design safety.

2. Domain-specific design: The components are designed according to the specific domain to which
they belong. (Domains include Mechanical, Electrical, Electronic and Software/Information)

3. Analysis and modeling: Mathematical models of components are developed using behavior
modeling and simulation tools. These models are analyzed and must provide the system behavior
throughout the system design, the domain-specific design, and the system integration.

4. System and software integration: The system integration stage includes the spatial integration
of components, sensors, actuators, cables, connectors, necessary adaptations and synergistic effects
and precision implementation in the system. The software integration stage includes the development
of prototypes for verification and validation. Finally, the necessary tests and adjustments of all the
modules are conducted under real operating conditions, and system reliability and safety,
electromagnetic compatibility, and compliance with specifications are verified. After the acceptance of
the system, the next step is the production of the system.

Mechanical system design

This include identification of mechanical constraints to lead into the overall design of the mechanical
framework. Various solutions of the mechanical system are analyzed to be developed into a single
perfect solution that meets the prescribed objectives. Principle design and solutions are analyzed and
selected for appropriate components to be designed.

ii) Electrical/Electronic system design


Just like mechanical system, all the electrical/electronic constraints are also met in the section. Each
appropriate component is selected based on the mechanical and objectives need. Several calculations
such as statics are done.

iii) Software/Information technology


The software system that basically integrates all the domains is done to complete the whole system.

a) Modelling and Simulation

The overall models obtained from cross domains are simulated to test for functionality without having
to physically build a model.

b) Verification/Validation

Experimental tests are carried out to verify the geometries and fits for certain parts for mechanical
system. To verify the working of the electrical part, Proteus software is used. It tests the motor as well
as the drive for impeller to see whether selected components fit well and do not go beyond their
working limits like torque, over voltage and over-currents.

3.2 ADD SYSTEM REQUIREMENTS


An ADD System is to be designed that addresses or solves the problem statement in Chapter 1. Non
adherence to medication and medication errors are causing significant harm to patients, prolonged
hospital stays which results in large financial burdens for both the hospital and the patient. Medication
non adherence and errors are resulting in deaths.

The following research steps were carried out in order to come out with a fully functioning machine.

 Motor selection and specification.


 Develop method of alerting the patient or care giver when its time to take medication.
 Develop a way of communication between system and patient or care giver.
 Develop a biometric identification method so as to secure the meds.
 Determine the ADD dimensions.
 Develop a suitable control strategy.

3.2.1NARRATIVE REQUIREMENTS

The system should be able to control the operation of a medication dispensing. This system should be
microcontroller-based and a software program that helps the user to operate and manage the system.
The System should be able to communicate with the patient or care giver through an sms. An alarm
module is used to notify the patient or caregiver of the time for medication by use of a buzzer and LEDs
to cater for the deaf patients.

Table of system requirements

Minimum cost The cost is the essential factor in projects and it


determines the failure or the success of the
project. The design of the system should maintain
the minimum cost for the implementation
accompanied with the high quality of the
product.

Simplicity of use Many users tend to dislike several steps-based


interfaces. Consequently, the design should
provide a friendly interface that can be easily
accessed with least complexity for both users and
administrator. This interface is very suitable
interface since it provides a mean to access
system effectively.

Ease of configuration In normal conditions, the operators of this


system are not professionals, so the design has to
ensure that installation, distributing the
medications and adding information to the
system are carried out with minimum effort
whenever it is needed.

Modular design It is a design approach in which the system is


subdivided into smaller modules. Each module is
designed and configured to carry out certain
tasks and specific medication. They are
integrated together to perform functionalities
required by the system. Such an approach
provides design flexibility.

Security The system is controlling dispensing process,


which is a critical application that should be
authenticated against any unauthorized user or
children. Therefore, the facial recognition
technique is used to ensure that our system is
secure against any interventions of unauthorized
users.
Accessibility and reliability The design should ensure the perfectness in use,
and the user should move the device with ease.
This requires that the device should have a small
size and should be light in weight.
Microcontroller considerations It is known that the microcontroller has limited
memory capacity, limited speed and
computational power; this fact must be taken
into consideration when designing the system
and programming the microcontroller.
Weight The device should be light in weight with weight
<2.0kg
Material Material to be used should be rust free and of
light weight
Alarm and LEDs For patient notification of time to take
medication a 45-120dB speaker is used and the
buzzer should sound simultaneously with the
blinking of the LED( 3volts)
Display For medication information display and
programming a 16*2 LED is used and a 4*4
keypad.

3.3 SYSTEM DESIGN SECTION


3.3.1 SYSTEM ARCHITECTURE
The Automated Drug Dispensing system consists of two aspects which are the hardware and the
software, the software part consists of the program code and the type of compiler that has been used.

3.3.2 HARDWARE ARCHITECTURE

 MCU controls all the system functions.


 LCD (Liquid Crystal Display) display all the medication information and also used during system
programing.
 MDT (Medication Dispensing Trey) contains the medication and it dispenses once the dispensing
button is pressed at proper time.
 Alarm module it notifies the user when its time to take medication by a buzzer and also LEDs to
cater for the deaf patients.
 Keypad The dispenser will utilize a 4x4 matrix keypad for onboard information entering process.
 GSM Module The user will be able to receive the text message by serially connecting the device
to a GSM supported by antenna.
MATHEMETICAL MODELLING OF THE ADD SYSTEM
SERVO MOTOR

FIG The schematic diagram of the motor control system.


System Equations:

The motor torque T is related to the armature current, I , by a torque constant K;

T = Ki (1)

The generated voltage, , is relative to angular velocity by;

(2)
From Fig.2.7 we can write the following equations based on the Newton’s law combined
with the Kirchoff’s law:

J = Ki (3)

L + Ri = V-

Transfer Functions:
Using the Laplace transform, equations (3) and (4) can be written as:

J θ (s) + bsθ (s) = KI (s) (5)

LsI (s) + RI (s) = V (s) – Ksθ (s) (6)

where s denotes the Laplace operator. From (6) we can express I(s):

and substitute it in (5) to obtain:

J
This equation for the DC motor is shown in the block diagram in Fig.2.8. From equation (8),
the transfer function from the input voltage, V (s), to the output angle, , directly follows

Ga(s)=
From the block diagram in Fig.2. 8, it is easy to see that the transfer function from the input
voltage, V (s), to the angular velocity, , is:

Gv(s)=
FIG A Closed-loop System Representing the dc servo motor

3.4 DOMAIN DESIGN SECTION


3.4.1 MECHANICAL DOMAIN

3.4.2 ELECTRONIC DOMAIN

3.4.2.1 DC SERVO MOTOR


These motors are either separately excited dc motors or permanent-magnet dc motors. The speed of DC
servomotors is normally controlled by varying the armature voltage. Their armature is deliberately
designed to have large resistance so that torque-speed characteristics are linear and have a large
negative slope the negative slope serves the purpose of providing the viscous damping for the servo
drive system.

Servos are controlled by sending an electrical pulse of variable width, or pulse width modulation (PWM),
through the control wire. There is a minimum pulse, a maximum pulse and a repetition rate. A
servomotor can usually only turn 90° in either direction for a total of 180° movement. The motor's
neutral position is defined as the position where the servo has the same amount of potential rotation in
the both the clockwise or counter-clockwise direction. The PWM sent to the motor determines position
of the shaft, and based on the duration of the pulse sent via the control wire the rotor will turn to the
desired position. The servomotor expects to see a pulse every 20 milliseconds (ms) and the length of the
pulse will determine how far the motor turns.
3.4.2.2 DRIVE L293D IC
L293D is a typical Motor drive or IC, which allows DC motor to drive on either direction. L293D is a 16-
pin IC that can control a set of two DC motors simultaneously in any direction. It means that you can
control two DC motor with a single L293D IC.

It works on the concept of H-bridge is a circuit which allows the voltage to be flown in either direction.
As you know voltage need to change its direction for being able to rotate the motor in clockwise or
anticlockwise direction, hence H bridge IC are ideal for driving a DC motor.

In a single L293D chip there two H-Bridge circuit inside the IC, which can rotate two DC motors
independently. Due its size is very much used in robotic application for controlling DC motors.

There are 16 pins sticking out of this IC, this is the functionality and the connection of each pins:

Table 3.2: pin description of drive L293D

Pin Name Function Name Connected to

1 Enable pin for motor 1; active high Enable 1,2

2 Input 1 for Motor 1 Input 1 Pin A.1

3 output 1 for Motor 1 Output 1 Servo 2

4 Ground (0V) Ground

5 Ground (0V) Ground

6 Output 2 for motor 1 Output 2 Servo 2

7 Input 2 for motor 1 Input 2 Pin A.2

8 Supply voltage for motor: 9-12V VCC 2 VCC

(up to 36V)

9 Enable pin for motor 2: active high Enable 3,4

10 Input 1 for Motor 1 Input 3 Pin A.6

11 Output 1 for Motor 1 Output 3 Servo 1

12 Ground (0V) Ground

13 Ground (0V) Ground

14 Output 2 for Motor 1 Output 4 Servo1

15 Input 2 for Motor 1 Input 4 Pin A.7


16 Supply voltage: 5V (up to 36V) VCC 1 VCC

There 4 input pins for this l293d, pin 2,7 on the left and pin 15 ,10 on the right shown on the pin diagram.
Left input pins will regulate the rotation of servo motor connected across left side and right input for
motor on the right-hand side. The motors are rotated based on the inputs provided across the input pins
as

LOGIC 0 or LOGIC 1

Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When
an enable input is high, the associated driver gets enabled. As a result, the outputs become active and
work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their
outputs are off and in the high-impedance state.

Table 3.3: motor controller

Input 1 Input 2 Enable 1,2 Result

0 0 1 Stop

0 1 1 Anti-clockwise rotation

1 0 1 Clockwise rotation

1 1 1 Stop

0 1 50% duty cycle Anti-clockwise rotation with

half speed

1 0 50% duty cycle clockwise rotation with half speed

3.4.2.3 ULN2003
The ULN2003 is a high voltage, high current Darlington array each containing seven open collector
Darlington pairs with common emitters. Each open collector Darlington is rated at 500 mA. It can accept
output voltages of up to 50V. Suppression diodes are included for inductive load driving so it used for
fan, buzzer and led.
Figure 3.4: ULN2003

Table 3.5: pin description of ULN2003

Pin Number Pin name Function Connected to

1 1B Input Pin C.7

2 2B Input Pin C.6

3 3B Input Pin C.5

4 4B Input Pin C.1

5 5B

6 6B

7 7B

9 COM

10 7C

11 6C

12 5C

13 4C Output Buzzer1/ LED

14 3C Output Buzzer2

15 2C Output
16 1C Output FAN

3.4.2.4 ICLM35
IC LM35 is a sensor use for detecting accurate centigrade temperature. LM35 is a thermometer on a
chip, designed by Semiconductor Instead of using mercury or another fluid; it relies on a property of
diodes that causes the breakdown voltage of the diode to increase with temperature. This relationship is
linear and predictable, making the LM35 a very accurate temperature sensor, with a voltage output that
is linearly proportional to temperature.

This sensor uses the fact that, as temperature increases, the voltage across a diode increases at a
known rate. When the temperature reach to 30 Centigrade the DC motor (fan) will run.

Figure 3.5: LM35

Table 3.6: connection of LM35

Pin Number Connected to

1 VCC

2 Pin A.0

3 Ground
3.4.2.5 DISPLAY UNIT
The monitoring element is the common LCD LM016L chip; it will display a number of messages to the
user. These messages include things such as, setting the clock, questions about entering new medication
data, which has 16 pins. This pin can be interfaced with microcontroller in 4 Bit or 8 Bit mode. These
differ in how data is sent to LCD.

In 8-bit mode to write a character, 8-bit ASCII data is sent through the data lines D0 – D7 and data strobe
is given through E of the LCD. LCD commands, which are also 8-bit, are written to LCD in similar way.

However, 4 Bit Mode uses only four data lines D4 – D7. In this mode 8-bit character ASCII data and
command data are divided into two parts and send sequentially through data lines. The idea of 4-bit
communication is used save pins of microcontroller. 4-bit communication is a bit slower than 8-bit
communication but this speed difference can be neglected since LCDs are slow speed devices. In this
project will use 4-bit mode connected as below:

Table 3.7: pin description of LCD

Pin Number Function Connected to

1 VSS

2 VDD

3 VEE

4 RS Pin B.0

5 RW GROUND

6 E Pin B.2

7 D0

8 D1

9 D2

10 D3

11 D4 Pin B.5

12 D5 Pin B.6

13 D6 Pin B.7
14 D7 Pin B.8

Figure 3.6: pin description of LCD

3.4.2.6 KEYPAD 4*4


A keypad is a set of buttons or keys bearing digits, symbols and/or alphabetical letters placed in order on
a pad, which can be used as an efficient input device. A keypad may be purely numeric, as that found on
a calculator or a digital door lock, or alphanumeric as those used on cellular phones.

Used for loading numeric into the microcontroller. It consists of 16 buttons arranged in a form of an
array containing four lines and four columns.

Figure 3.7: Keypad 4x4

GSM
To provide a type of communication between the medical dispenser system and the patient or a
guardian of the patient, the GSM circuit has been provided to remind the patient or the guardian of the
time of taking the particular medicine.

FIG SIM 900 GSM MODULE


Since I’m using the Atmega 16 AVR, the GSM module has a TTL based Serial Input and Serial Output. The
module has a +5V, a ground, Serial In (usually marked Rx or RxD) and Serial Out (usually marked Tx or
TxD).

3.4.2.7 ALARM CIRCUIT


The Automated Drug Dispenser has both audio and visual alarms because the user may have either a
hearing or sight impairment. When it is time to take the medication, a single LED will light up; the buzzer
of the device will sound. All alarms will cease once the dispense button is pressed. Voltage will be
supplied to the LED and to the buzzer when the ATMEGA 16-time clock reaches the programmed
dispense time. The voltage will cease once the user has pressed the dispense button.

3.5 SOFTWARE DOMAIN


All the code written for the ATmega16 AVR microcontroller for this project was done in C
program language. This was chosen for ease of programming, and because the microcontroller
contains enough program space to the point where code size does not become an issue on this
project. For the complete code please check the appendix.
 CODEVISIONAVR SOFTWARE:

Figure CODEVISIONAVR SOFTWARE.


Code-Vision-AVR is a C cross-compiler, Integrated Development Environment and Automatic
Program Generator designed for the Atmel AVR family of microcontrollers. The program can
run under all kind of windows operating systems.

 Proteus Professional Simulator:

Figure Proteus Professional Simulator.


Proteus Virtual System Modeling (VSM) combines mixed mode SPICE circuit simulation,
animated components and microprocessor models to facilitate co-simulation of complete
microcontroller-based designs. With this powerful simulator it is possible to develop and test
such designs before a physical prototype is constructed and you can interact with the design
using on screen indicators such as LED and LCD displays and actuators such as switches and
buttons. The simulation takes place in real time. Proteus VSM also provides extensive
debugging facilities including breakpoints, single stepping and variable display for both
assembly code and high-level language source.
 PonyProg Programmer

Figure PonyProg Programmer.


PonyProg is serial device programmer software with a user friendly GUI framework. Its purpose
is reading and writing every serial device. At the moment it supports I²C Bus, Micro wire, SPI
eeprom, the Atmel AVR and Microchip PIC micro. It can be used as a low cost starter kit for PIC
and AVR.
3.5.1 SYSTEM FLOW CHART
The AMDS will have two modes of operation, dispensing mode and programming mode. These will be
determined by the cascading technique. The first technique is the programming mode and the second
following technique is dispensing mode. Upon system power up the user will be asked to input the
patient information and lastly the time. When the system switch is set to programming mode the user
can program the device to dispense a medication. If the system switch is not in programming mode, the
system will constantly be checking to see if an MDT alarm time has been reached. If an MDT alarm time
had been reached the system goes into dispensing mode. Switching between these two modes is the
responsibility of the main, which can be shown in Figure
FIG switching dispensing mode

The AMDS can be programmed when the system is switched on beginning the program mode. After the
name has been inputted the user is asked to enter the password of the user which his name was
entered before.

Then, the user’s telephone number is asked for to help in remember the patient to be around by
sending him a massage before ten minute to take the medication.

Also the user is asked to enter the present number of medication which are going to be inputted to
visual each tray information separately. The user is first asked to enter the MDT user name whose
medication for. The user then prompted to enter the medication name. After the name has been
inputted it is redisplayed to the user for correctness the name is not correct the user must input it again.
The user can select the wished tray from the five existing MDT by entering its number, when it is
involved with some medication, he can select another MDT. The user is then prompted for the times per
day, these times are used to calculate the intervals between the dispensing process, so the device can
forecast the next dispensing. The start time is the first time to be entered which is the first time the
user should take his or her medication, the next time of dispensing is the first time plus the time of the
interval, the interval time is the time in between when a tablet is taken and when it should be taken
next. The user is then asked to input the total number of the tablets to know the time of stopping when
there are no more tablets to dispense. In addition, the tablets per dispense were asked to be entered to
ensure the correct dosage.

Now the role of time setting is come. the first asking is about first hour Note this interval can only be
inputted in as hours. The user is then asked to enter the first minute of the interval time. Also this
interval can only be inputted in as minutes. After that, the user is prompted for the actual time now. The
actual time is the time consists of the actual time hour, the actual time minute and the actual time
seconds. After programming one MDT the user has the option to program another, if it is entered extra
medications. By this last step the programming mode is logged of and the dispensing mode is started.
Once an MDT alarm time has been reached the system goes into dispensing mode. First the alarms will
go off alerting the user that it is time to take his or her medication. The alarms will not cease until the
dispense button is pressed. During this time the buzzer sounds, the LED lights up, and the motor rotate.
Once the dispense button is pressed the
medication name, and dosage start are written to the
backlit screen. The program will then wait for the
bush button to close assuming the user has take his
or her medication and is now Set accurate
closing the alarms.
The system will then check to see time if another MDT alarm
time has been reached, dispensing mode will
be repeated all over again. If no other medication is
to be taken the time is then redisplayed on the
LCD and the program returns to Accurate time = main. Dispensing
mode can be better visualized dispensing time ? using Figure

LED

BUZZER

Display medication name


& dosage

Switch
button

Rotate
motor

Off LED&
buzzer

Display the
next time

Another
MDT?

end
Figure The schematic of the integrated system

Atmega 16 AVR is the systems controller and is powered by a 12v supply and it is programmed with the
medication information through the keypad and displays information like medication name, dosage,
dispensing time through the LM016L display unit. The controller receives temperature reading through
the ICLM35 and sends a signal to the ULN203 to supply 12v to the fan to start running and to the Alarm
module to ring when its time to take medication. 10 mins before dispensing time the controller sends a
signal to the GSM module to send an SMS to the patient or caregiver as a reminder. And 10 mins after
dispensing time another SMS is sent to the caregiver stating whether the patient took the pill or not. The
GSM module is connected to the controller through the RS-232. When its dispensing time the controller
sends a signal to the servo motor to rotate through the Drive L293D IC which enable the motor to rotate
in both forward and reverse directions.
3.6 DESIGN VALIDATION
In this section, a checklist is made to verify if the system design satisfies the various requirements made
in the requirements section.

Minimum cost The cost is the essential factor in


projects and it determines the
failure or the success of the
project. The design of the
system should maintain the
minimum cost for the 
implementation accompanied
with the high quality of the
product.

Simplicity of use Many users tend to dislike


several steps-based interfaces.
Consequently, the design should
provide a friendly interface that
can be easily accessed with least
complexity for both users and

administrator

Ease of configuration In normal conditions, the


operators of this system are not
professionals, so the design has
to ensure that installation,
distributing the medications and
adding information to the 
system are carried out with
minimum effort whenever it is
needed.
Modular design It is a design approach in which
the system is subdivided into
smaller modules. Each module is
designed and configured to carry 
out certain tasks and specific
medication. They are integrated
together to perform
functionalities required by the
system. Such an approach
provides design flexibility.

Security The system is controlling


dispensing process, which is a
critical application that should
be authenticated against any
unauthorized user or children.
Therefore, the facial recognition

technique is used to ensure that
our system is secure against any
interventions of unauthorized
users.

Accessibility and reliability The design should ensure the


perfectness in use, and the user
should move the device with
ease. This requires that the 
device should have a small size
and should be light in weight.

Weight The device should be light in


weight with weight <2.0kg 

Material Material to be used should be


rust free and of light weight 

Alarm and LEDs 45-120dB speaker and the


buzzer should sound
simultaneously with the blinking
of the LED (3volts) 

Table The Checklist table for verifying the design


3.7 PRODUCT SECTION

3.7.1 CONCEPT GENERATION


CONCEPT 1

You might also like