12 (wro) dated 04 feb 2013 design and development of...

34
Dr. Rafiq Zakaria Campus Maulana Azad College of Arts, Science & Commerce, Aurangabad. Design and Development of Embedded System Based Flexible and User Friendly Iontophoresis Power Supply and Data Acquisition System Using AVR Microcontroller with Computer Interface Principal Investigator Ms. Shaikh Nazneen Akhter Dept. of Computer Science Submitted to UGC Western Regional office, Ganeshkhind Pune File No. 47-038/12 (WRO) Dated 04 Feb 2013

Upload: ngocong

Post on 29-May-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Dr. Rafiq Zakaria Campus

Maulana Azad College of Arts, Science

& Commerce, Aurangabad.

Design and Development of Embedded System Based

Flexible and User Friendly Iontophoresis Power Supply

and Data Acquisition System Using AVR Microcontroller

with Computer Interface

Principal Investigator

Ms. Shaikh Nazneen Akhter Dept. of Computer Science

Submitted

to

UGC Western Regional office, Ganeshkhind Pune

File No. 47-038/12 (WRO) Dated 04 Feb 2013

1

Design and Development of Embedded System Based Flexible and

User Friendly Iontophoresis Power Supply and Data Acquisition

System Using AVR Microcontroller with Computer Interface

1. Introduction

Iontophoresis is one of the areas with brisk research activity related to

pharmaceutics, medicine drug delivery and pharmacology. In science, technology and

health sciences where controlled experimentation had limitations due to constraints of

implementation and monitoring of the research processes advanced techniques are

sought for. One of such areas in the field of health sciences is at the focus of

researchers in new drug delivery systems, namely trans-dermal drug administration. In

this process medicinal patches are designed and stuck to the patients skin and the drug

is gradually absorbed through the skin of the patient. Different techniques are being

examined and studied for the administration of drug using this technique.

Iontophoresis is on of these techniques in which the drug transport across the skin is

enhanced using external stimuli like application of electrical pulses of short duration.

This approach makes use of repeated application of electric pulses which in turn

demands for a power supply capable of serving this requirement.

As an attempt to attend to the need of such an instrument capable of delivering

controlled electrical pulses, a microcontroller based power supply is designed and

constructed. The power supply with flexible design and user friendly features can be

easily adapted to Iontophoresis studies in different regimes. Pulse duration, duty cycle

can be controlled from the panel of the power supply that has three buttons and a

Liquid Crystal Display(LCD). The on time and off time can be individually set to the

desired value from 0 to 10 second, and this range can be suitably modified by minor

changes in the firmware of the microcontroller based power supply. Two terminals are

provided on the main panel for taking the output, a LED on the main panel shows the

ON or OFF state of the output.

2

Most of the Iontophoresis study experiments need monitoring of some

parameter like, conductivity, pH etc, to this effect the power supply is equipped with a

Data Acquisition System (DAS). For this purpose the 10 bit ADC from the

microcontroller used in the power supply is employed. On receipt of a sampling

demand from controlling computer side software, it carries out Analogue to digital

conversion at channel 0 and sends the 10 bit of data as two bytes to the controlling

program. The computer side program processes the incoming data and stores in

computer files for further use in suitable format. The microcontroller firmware has

provision to transmit the data at pre decided intervals of time like 5,10,20,30 or 60

seconds if needed.

The two way communication between the microcontroller and the computer

side controlling programme is implemented using serial port in RS232 configuration.

The 10 bit of ADC data is split into two parts 8 bit and 2 bit the two bytes are sent one

by one using serial communication. The 6 free bits from the MSB can be used for

tracking data consistency by appending suitable code. The serial communication is

implemented using 8 bit of data, one start bit, one stop bit and no parity at a baud rate

of 9600. Newer PC’s are not equipped with serial ports and laptops rarely have a

serial port, to this effect, a USB to serial converter is used so that the instrument can

directly be attached to USB port of a computer or laptop for control and data

acquisition.

2. Microcontroller Atmega32

The ATmega32 is a low-power CMOS 8-bit microcontroller based on the AVR

enhanced RISC architecture from Atmel corporation. By executing powerful

instructions in a single clock cycle, the ATmega32 achieves throughputs approaching

1 MIPS per MHz allowing the system designer to optimize power consumption versus

processing speed.

3

The main features that make this microcontroller a component of choice for

this application are:

In system programmability.

Powerful instruction set.

On chip 10 bit ADC.

On chip serial port.

Availability of powerful development environment IDE’s.

High level language programming support.

2.1 Salient Features

Some of the salient features of AVR family microcontroller Atmega32 are

listed below.

High-performance, Low-power AVR® 8-bit Microcontroller

Advanced RISC Architecture

131 Powerful Instructions – Most Single-clock Cycle Execution.

32 x 8 General Purpose Working Registers.

Fully Static Operation 0 – 16 MHz.

High speed of up to 16 MIPS Throughput at 16 MHz.

High Endurance Non-volatile Memory segments.

32K Bytes of In-System Self-programmable Flash program memory

1024 Bytes EEPROM

2K Byte Internal SRAM

Write/Erase Cycles: 10,000 Flash/100,000 EEPROM

Data retention: 20 years at 85°C/100 years at 25°C(1)

Optional Boot Code Section with Independent Lock Bits

In-System Programming by On-chip Boot Program

True Read-While-Write Operation

Programming Lock for Software Security

Peripheral Features

Two 8-bit Timer/Counters with Separate Prescalers and Compare

Modes

One 16-bit Timer/Counter with Separate Prescaler, Compare Mode,

and Capture Mode

Real Time Counter with Separate Oscillator

Four PWM Channels

8-channel, 10-bit ADC

4

8 Single-ended hannels

2 Differential Channels with Programmable Gain at 1x, 10x, or

200x

Byte-oriented Two-wire Serial Interface

Programmable Serial USART

Master/Slave SPI Serial Interface

Programmable Watchdog Timer with Separate On-chip Oscillator

On-chip Analog Comparator

2.2 Pin Configuration

The ATmega32 is a low-power CMOS 8-bit microcontroller based on the

AVR enhanced RISC architecture. By executing powerful instructions in a

single clock cycle, the ATmega32 achieves throughputs approaching 1 MIPS

per MHz allowing the system designer to optimize power consumption versus

processing speed.

Fig.1 Pin diagram of

Atmega32 in 40 pin

PDIP package.

5

2.3 Block Diagram of ATmega32

6

The AVR core of microcontroller combines a rich instruction set with 32 general

purpose working registers. All the 32 registers are directly connected to the

Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in

one single instruction executed in one clock cycle. The resulting architecture is

more code efficient while achieving throughputs up to ten times faster than

conventional CISC microcontrollers.

The ATmega32 provides the following features: 32K bytes of In-System

Programmable Flash Program memory with Read-While-Write capabilities, 1024

bytes EEPROM, 2K byte SRAM, 32 general purpose I/O lines, 32 general purpose

working registers. Three flexible Timer/Counters with compare modes, Internal

and External Interrupts, a serial programmable USART, a byte oriented Two-wire

Serial Interface, an 8-channel, 10-bit ADC, a programmable Watchdog Timer with

Internal Oscillator, an SPI serial port, and six software selectable power saving

modes. The Idle mode stops the CPU while allowing the USART, Two-wire

interface, A/D Converter, SRAM, Timer/Counters, SPI port, and interrupt system

to continue functioning. The Power-down mode saves the register contents but

freezes the Oscillator, disabling all other chip functions until the next External

Interrupt or Hardware Reset. In Power-save mode, the Asynchronous Timer

continues to run, allowing the user to maintain a timer base while the rest of the

device is sleeping.

The ADC Noise Reduction mode stops the CPU and all I/O modules except

Asynchronous Timer and ADC, to minimize switching noise during ADC

conversions. In Standby mode, the crystal/resonator Oscillator is running while the

rest of the device is sleeping. This allows very fast start-up combined with low-

power consumption. In Extended Standby mode, both the main Oscillator and the

Asynchronous Timer continue to run. The device is manufactured using Atmel’s

7

high density nonvolatile memory technology. The On chip ISP Flash allows the

program memory to be reprogrammed in-system through an SPI serial interface, by

a conventional nonvolatile memory programmer, or by an On-chip Boot program

running on the AVR core. The boot program can use any interface to download the

application program in the Application Flash memory. Software in the Boot Flash

section will continue to run while the Application Flash section is updated,

providing true Read-While-Write operation. By combining an 8-bit RISC CPU

with In-System Self-Programmable Flash on a monolithic chip, the Atmel

ATmega32 is a powerful microcontroller that provides a highly-flexible and cost-

effective solution to many embedded control applications.

The ATmega32 AVR is supported with a full suite of program and system

development tools including: C compilers, macro assemblers, program debugger /

simulators, in-circuit emulators, and evaluation kits.

3. Methods & Materials

The microcontroller used, i.e. Atmega32 belongs to the AVR family of

microcontrollers with advanced features and resources. The implementation of the

Iontophoresis power supply and data acquisition involved the utilization few of its

most important capabilities like Analogue to Digital Conversion (ADC), serial

communication etc. The actual implementation techniques of some of the vital

components is presented in the following section.

3.1 I/O Ports

Atmega32 has four bidirectional ports i.e. in all 8 × 4 = 32 lines that can be used

either as input lines or as output lines depending on the requirement. The four 8 bit

wide ports of Atmega32 are named as PORTA, PORTB PORTC and PORTD. For

the purpose of configuring these ports as input or output there are four registers

DDRA, DDRB, DDRC AND DDRT corresponding to the four ports A, B, C and D

respectively. When 0x00 is written to a register (Data Direction Register) DDRB

8

the port B is configured as input port whereas writing 0xFF to DDRB configures

the port B as output port. When a port is configured as input port it is customary to

activate the pull-ups associated with that port. It is to be noted that all the port pins

are individually addressable and can be individually configured as input or output

line. Same logic applies to the port pins when a certain pin from a port is to be

configured as input line, the corresponding bit in the respective DDR register is

reset to a LOW by making that bit ‘0’ and vice versa.

3.2 Driving Relay.

The four ports of the microcontroller are not intended for high current application

and rather are intended for driving logic circuitry. Commonly used relays working

at 12V DC have resistance in the range of few tens of Ohms to few hundreds of

Ohms thus requiring currents to the tune of few tens on milliamperes to few

hundred milliampere. Thus to drive a relay a simple technique is to use a NPN

transistor with base driven by the port via a resistance of say 1KΩ and collector

connected to the supply via relay winding and emitter connected to ground.

3.3 Serial Communication.

The Universal Synchronous and Asynchronous serial Receiver and Transmitter

(USART) is a highly flexible serial communication device. The main features are:

9

• Full Duplex Operation (Independent Serial Receive and Transmit

Registers)

• Asynchronous or Synchronous Operation

• Master or Slave Clocked Synchronous Operation

• High Resolution Baud Rate Generator

• Supports Serial Frames with 5, 6, 7, 8, or 9 Data Bits and 1 or 2 Stop

Bits

• Odd or Even Parity Generation and Parity Check Supported by

Hardware

• Data OverRun Detection

• Framing Error Detection

• Noise Filtering Includes False Start Bit Detection and Digital Low Pass

Filter

• Three Separate Interrupts on TX Complete, TX Data Register Empty,

and RX Complete

• Multi-processor Communication Mode

• Double Speed Asynchronous Communication Mode

The entire functioning a bit complex and configuration of the port requires

addressing several things, however for general standard use the only concern is to

properly initialize the UBRR register. The value that is to be loaded in to UBRR

register can be calculated from the desired baud rate (bits per second to be

transmitted) and the frequency of the oscillator used.

116

baudrate

fUBRR osc

UBRR is the value to be loaded in the UBRR register, fosc is the oscillator

frequency i.e. the crystal frequency and the baudrate is the rate at which bits will be

serially transmitted. All the framing etc. is taken care by the microcontroller itself,

10

using structured programming language like C or C++ simplifies many

programming issues.

3.4 LCD display.

Standard LCD display i.e. 2 line and 4 line with 16 characters in a row or 4 line and

20 characters in a row has the following pin configuration. These displays are

sufficiently complex in their operation and have their own onboard microprocessors

for the implementation of built in function.

Pin description of LCD display

The LCD display module has 14 or 16 pins and the Pin 4 or RS tells the LCD

display whether the incoming byte is an instruction or data, pin 5 determines read

11

or write operation and Enable pin 6 has to be given a pulse after valid data is

present at the input of LCD. Pins 7 to 14 are 8 data lines and function as input or

output depending on the function and operation used. Pins 15 and 16 are for back

light LEDs used to illuminate the LCD from behind. The LCD module can be used

with 8 bit wide data bus or nibble (4 bit) wide data bus by appropriate mode

selection. Implementation of LCD display in assembly is a lengthy task whereas C

or C++ compilers have built in functions for various operations like writing text or

numbers to the display or moving of cursor to a specified location.

3.5 Onchip ADC.

The ATmega32 features a 10-bit successive approximation ADC. The ADC is

connected to an 8-channel Analog Multiplexer which allows 8 single-ended voltage

inputs constructed from the pins of Port A. The single-ended voltage inputs refer to

0V (GND). The device also supports 16 differential voltage input combinations.

Two of the differential inputs (ADC1, ADC0 and ADC3, ADC2) are equipped with

a programmable gain stage, providing amplification steps of 0 dB (1x), 20 dB

(10x), or 46 dB (200x) on the differential input voltage before the A/D conversion.

Seven differential analog input channels share a common negative terminal

(ADC1), while any other ADC input can be selected as the positive input terminal.

If 1x or 10x gain is used, 8-bit resolution can be expected. If 200x gain is used, 7-

bit resolution can be expected.

The ADC contains a Sample and Hold circuit which ensures that the input voltage

to the ADC is held at a constant level during conversion. The ADC has a separate

analog supply voltage pin, AVCC. AVCC must not differ more than ±0.3 V from

VCC. See the paragraph “ADC Noise Canceler” on page 208 in datasheet on how

to connect this pin. Internal reference voltages of nominally 2.56V or AVCC are

provided On-chip. The voltage reference may be externally decoupled at the AREF

pin by a capacitor for better noise performance.

12

A single conversion is started by writing a logical one to the ADC Start Conversion

bit, ADSC. This bit stays high as long as the conversion is in progress and will be

cleared by hardware when the conversion is completed. If a different data channel

is selected while a conversion is in progress, the ADC will finish the current

conversion before performing the channel change. In actual implementation the pin

32 i.e. AREF is connected to a reference voltage say +5V and at the end of

conversion the result is sent to the desired output.

4. Design Consideration

The Iontophoresis power supply and data acquisition system was designed keeping

in view the requirements of researchers studying Iontophoresis through bio

membranes. The power supply part basically is a controlled pulse generator that

can provide electrical pulses of the desired duration. The data acquisition part has

to monitor an analogue input under program control and then send the resulting

data to the controlling program. The Analogue input monitoring is implemented

using the built in 10 bit ADC of the microcontroller and the communication is

implemented using the on chip USART for serial communication. For ease of

operation a LCD display is provided that displays the current setting of the duration

and interval between two consecutive pulses. The power on task of the instrument

is to initialize all the ports and peripherals attached including the serial port, LCD

display and the input keys.

13

4.1 Circuit Diagram

Fig. 2 Detailed circuit Diagram of Iontophoresis Power supply and data acquisition

system.

At power on the yellow power indicator LED glows and the instrument displays

basic information on the LCD displays along with the default values of ON and

OFF times (1s each). There are two buttons on the panel that allow choice of ON

time and OFF time, on pressing the corresponding button the time is incremented

by one unit and when it reaches the maximum programmed limit it rolls back to

initial default value. This allows for the control and adjustment of the duration for

which the supply is in ON state and the duration between two consecutive pulses

namely the OFF time.

14

4.2 Front Panel

The third button is the ‘GO’ button which is to be pressed after setting the timings,

on pressing of this button the pulse generation of the instrument begins and based

of the selected ON and OFF time, it keeps on generating pulses of pulses of

duration equal to the selected ON time separated by in interval of OFF time. This

feature makes the power supply highly flexible in that the experimenter can have

the time schedule of his choice to study the Iontophoresis. The three buttons, the

15

ON, OFF and GO buttons are connected to port bits PC4, PC5 and PC7

respectively that are already configured as input pins whereas the pin PC6 is used

as an output pin to drive a relay switching the power ON and OFF.

4.3 Components Layout

The current sourced by the microcontroller port pins is not sufficient to drive a

relay so a NPN transistor BC147 was used to switch the relay. A red LED on the

panel shows the ON of OFF state (glows when the output is ON or high) and the

yellow LED is the power indicator and glows when the instrument is powered up.

Fig. 3 Electromagnetic relay connected to port Pin PC6 using NPN transistor

BC147

The micro controller based data acquisition system was constructed on a standard

AVR board fitted with minimum required system, IC bases, crystal etc. and ISP

port for in system programming. The circuit was carefully constructed using

necessary decoupling and taking care of stray pickups. The complete assembled

circuit is shown in Fig. 4 below, the circuit board is placed in a plastic housing.

16

Fig. 4 Microcontroller based power supply and data acquisition system placed in

housing

The top cover of this plastic casing serves as the main panel shown in earlier

Figure. The switches, the terminals, the LCD and the LED’s are mounted on this

panel and necessary connecting leads are routed to their respective port pins using

suitable connectors, the back view of this cover panel is shown in Fig. 4. The entire

assembly is fixed in a plastic casing and connections are brought out for Power

supply and serial port or the USB to serial converter. The analogue input for the

ADC is taken out using a coaxial cable and the leads are left for direct connections

with the input signal source.

17

The system was thoroughly tested for performance and the performance evaluated

over prolonged period of time to check the timings. As is expected by a

microcontroller based system the timing was found to be accurate for over several

hours of continuous operation. The performance of ADC was also tested by giving

standard input voltages and measuring corresponding ADC output, the results were

very much in agreement, too close comparison was not found necessary as the

functions implemented by the microcontroller were highly reliable.

The Iontophoresis power supply and DAS functions under the control of computer

side controlling program, necessary computer software is developed, debugged and

implemented in visual basic to make it user friendly with the help of powerful GUI

interface. When switched on the hardware prompts for setting the ON and OFF

time and at the press of the GO button it starts the timing and generation of the

output voltage pulses at the set timings. The voltage can be adjusted using an

external potential divider to obtain the desired output current. The computer side

controlling program initializes the ports and sends a signal to the DAS to sample

the input and convert it to digital form and send back to the controlling program.

On receipt of the request, the DAS converts the input into digital form and sends it

18

over the serial port at a baud rate of 9600. The ADC output is 10 bit therefore two

bytes of data is transmitted to the controlling program. The controlling program

displays the incoming data both graphically and numerically on the computer

screen as shown in the screenshot shown in Fig. 6. To track the functioning serial

number of readings being received is also shown on the screen. The observations

are recorded at preset time interval and after the preset number of observations is

reached, the data is saved in a file for future use, processing and analysis.

4.4 Iontophoresis Cell (Franz Cell)

As the instrument has to go with Iontophoresis experiment, the live testing of the

instrument was done using an Iontophoresis cell shown in Fig. 5. The Iontophoresis

cell (the Franz cell) has two compartments, the donor and acceptor compartments

and the acceptor compartment is provided with an outer jacket for water circulation

to maintain temperature.

Fig. 5 Typical Iontophoresis (Franz) cell used during study.

For the purpose of measuring extent of permeation through the bio-membrane a

custom made conductivity cell was used. The cell was kept in the lower part of the

cell i.e. the acceptor compartment and the leads of the conductivity cell were

19

brought out through the side limb of the cell. These leads connect to the measuring

circuitry of the data acquisition system.

4.5 Bio Membrane

To study the permeation of chemical through biological membrane, for testing and

evaluation purpose we used two types of bio membranes, the hen egg membrane

and onion membrane. The egg membrane was obtained from egg by dissolving the

outer shell in dilute hydrochloric acid and removing the egg white and yoke from

the membrane. Egg membrane kept in distilled water is shown below and the other

image show egg membrane mounted in the cell paper clamps are used to hold the

two compartments together.

Distilled water was used in the acceptor compartment and sodium chloride (NaCl)

solution was kept in the donor compartment. To estimate the extent of transport we

used conductivity cell to measure the conductivity in the accepter compartment.

The conductivity probe was placed in the acceptor compartment and magnetic

stirrer pin was also placed in this compartment. The conductivity cell was not

calibrated as arbitrary readings and the performance of the system was of interest,

calibration of the cell would yield actual values. The experiment was set to record

readings every 10 seconds.

20

4.6 Data Acquisition software (Controlling Program)

The controlling program was developed in visual basic to keep it user friendly and

easily deployable. The main opening screen shows three buttons namely, GO,

TEST and END, the Go button is to start a sequence of measurements at preset

intervals of time, the test button is for testing a single observation and the end

button is to stop the program. The main screen displays some static information and

in addition to this there are two text boxes in the left hand side panel. These two

boxes show the serial number of the reading being processed and recorded the box

is labeled accordingly. The other text box shows the actual value of ADC value

read from the microcontroller based data acquisition circuitry.

The ADC value can be stored in a computer file for further processing or it can

be pre-processed to calculate desired parameter based on the cell constant etc and

stored for further processing, in the present setup the ADC values are stored and

rest of the processing is implemented separately. The important features of the

computer side controlling program include the use of MSComm controlled that

provides interface for serial communication with the external hardware. The

hardware used implemented the serial communication with 8 data bits, one start bit,

one stop bit and no parity therefore, the MSComm was also configured

accordingly.

The experiment was designed to collect readings every 10 seconds therefore the

program sends request to the hardware to sample the incoming data every 10

seconds and send back the result. For timing purpose timer control was used, this

timer control is capable of providing 1 ms time steps, for 10 s the timer was

initialized accordingly by setting the respective property to appropriate value. After

every 10 seconds the program sends a ASCII character the request code to the

microcontroller, as soon as the microcontroller receives this codes it starts

converting the input at ADC0 and the converted value i.e. the digital equivalent of

21

the input analogue signal is split into two bytes and sent back to the controlling

program using serial port. This data is then received by the controlling program and

decoded back to calculate the ADC value and displays the result in the second text

box marked as (ADC / Resistance), for finding of the resistance from ADC value

the cell constant is also needed. The duration after which the readings are sampled

was 10 seconds, however it is not rigid as the initiation of the readings is done by

this program, if the timer is configured to take readings after say 5 seconds, the

timer property timer.interval can be set accordingly. To change this duration a text

is provided in the revised version of the program to read in the timing interval and

set the timer property timer.interval accordingly. This makes it highly flexible and

practically any interval can be selected.

A typical screenshot while the experiment was in progress is shown in Fig. 6 the

performance of the Iontophoresis power supply and data acquisition system was

found to be satisfactory and consistent with the expectations.

Fig. 6 Screen of Data Acquisition Software while recording resistance of the cell

22

0

200

400

600

800

0 50 100 150 200 250 300 350

Reading No

Resis

tivit

y K

oh

m-c

m Set - I

Set - II

0

100

200

300

400

500

600

700

0 50 100 150 200 250 300 350

Reading No

Re

sis

tiv

ity

KO

hm

-cm

Set - A

Set - B

Set - C

Set - D

5. Results & Discussions

Typical resistivity versus time graph plotted in excel using the data file from the

setup designed is shown in Fig. 7.

Fig. 7 Resistivity vs time graph for data from fig 6 compared with another data

The plot shown as set – I corresponds to the screenshot taken after 200 points

shown in fig. 7, however here 300 points are plotted, whereas the other line marked

Set – II corresponds to a different set of observations taken with solution of higher

concentration in the donor compartment. The effect of higher concentration in the

donor compartment is clearly seen as a reduced resistivity or increased

conductivity.

23

Set – A, C, D are for egg membrane with different concentrations in donor

compartment and Set – B uses Onion membrane, with donor concentration same as

that in Set – D. It is seen that the rate of transport depends on donor compartment

concentration in addition to the membrane properties. Plot B shows that the

permeation is faster in onion membrane which can be seen from the comparison of

plots B and D.

Further quantitative measurements were not aimed at and thus the work was not

extended along those lines, however one of researchers working under the guidance

of the co-investigator is extending this work for more quantitative information and

improvement. During the course of implementation of this project few points were

noticed, improvements and additions of few features will make the system more

effective and useful. As an example, a more interactive four line LCD display with

prompt will be more user friendly. The process of permeation and diffusion of

compounds across bio membranes and the optimum operating conditions for

efficient transport under different conditions is also a point worth exploring.

6. Findings and Conclusion

The Iontophoresis power supply and data acquisition was designed and developed

based on need of researchers working on drug transport across bio-membrane using

Iontophoresis technique. The instrument developed contained features of

Iontophoresis power supply as well as data acquisition system. For controlling the

instrument and for data acquisition system serial communication was implemented

using AVR microcontroller Atmega32 from Atmel Corporation. The advantage of

using a microcontroller based power supply is that the timing scheme of the pulse

train required to be applied to the bio-membrane can easily be modified by

changing the firmware. Additionally for data acquisition that the microcontroller

24

has built in (on chip) Analogue to Digital Converter (ADC) with 10 bit resolution.

This makes it possible to have a measuring accuracy of one part in 1024. Further

advantage is that the measuring system, under program control keeps on monitoring

the analogue inputs and makes the digital equivalent available on the selected ports.

The controlling program can read this input at pre-decided time intervals. This

approach substantially reduced the burden on the processor of the controlling

program as the ADC is implemented externally in the present design, the ADC

conversion is controlled by the computer side controlling program. The firmware in

the instrument starts the ADC cycle on receipt of a request via serial port and at the

end of conversion send the reading in the form of two bytes to the controlling

program.

The system was constructed using a general purpose low cost AVR development

board using a crystal frequency of 16MHz. The microcontroller program was

developed to monitor the analogue input (i.e. voltage from conductivity cell or pH

meter etc.)

The switching ON and OFF of the Iontophoresis power supply was implemented

using output pin from Port C namely PC6. The relay connected to port pin PC6 was

driven by a general purpose NPN transistor BC147. The power supply allows

setting of the duration of ON time and OFF time from the panel. Two push buttons

are provided on the panel to select the ON time and the OFF time. On pressing of

the buttons the corresponding time duration is incremented and displayed on the

LCD display. After setting the ON time and OFF time when the third push button

(Done / Go) is pressed, the power supply starts sending the selected pulses to the

output and the output is also indicated by blinking of the green LED on the panel.

The switches were interfaced to the microcontroller port pins PC5, PC6 and PC7.

The LCD display was configured in nibble mode with 4 bit data port to reduce the

hardware complexity. Both data and control signals for LCD were also derived

from Port B using pins PB0 to PB5, in all six lines were used.

25

The instrument has in system programming port so that for minor changes or

radical modification, modified firmware can easily be downloaded into the

microcontroller. The entire system was assembled in suitable enclosure and

repeatedly tested and modified to suit the requirements. For initial testing it was

connected to a conductivity cell placed in the Iontophoresis (Franz) cell and

preliminary experiments conducted. The performance is fully satisfactory in terms

of the timing sequence of output pulses and the working of the ADC circuitry and

associated data acquisition software. A screenshot of the actual working of the

Iontophoresis power supply and data acquisition system and related plots are shown

above. A copy of the instrument is presented and handed over to one of Pharmacy

College in Sawarde where work on Iontophoresis is going on, the device is working

satisfactorily.

PRINCIPAL INVESTIGATOR C0-INVESTIGATOR

Ms. Shaikh Nazneen Akhter Dr. Yusuf Hanif Shaikh

26

Reference

1. Microdialysis and Delivery of lontophoresis-Driven Lidocaine Into the Human

Gastrocnemius Muscle. , Coglianese M, Draper DO, Shurtz J, Mark G. J Athl

Train. 2011;46(3):270-6., http://www.ncbi.nlm.nih.gov/pubmed/21669096

2. Absorption of Iontophoresis-Driven 2% Lidocaine With Epinephrine in the

Tissues at 5 mm Below the Surface of the Skin. , Draper DO, Coglianese M, Castel

C. J Athl Train. 2011;46(3):277-81.,

http://www.ncbi.nlm.nih.gov/pubmed/21669097

3. Transdermal Delivery of Heparin Using Pulsed Current Iontophoresis

Stefania Pacini, Tiziana Punzi, Massimo Gulisano, Fabiola Cecchi, Simonetta

Vannucchi, and Marco Ruggiero.

Pharmaceutical Research, oct 2005, 1095, 1-7

4. Artusi M, Nicoli S, Colombo P, Bettini R, Sacchi A, and Sanli P. Effect of

chemical enhancers and iontophoresis on thiocolchicoside permeation across rabbit

and human skin invitro. J Pharm Sci. 2004; 93: 2431-2438.

5. Delgado-Charro MB, Guy RH. Transdermal iontophoresis for controlled drug

delivery and non-invasive monitoring. STP Pharma Sci. 2001; 11: 403-414.

6. Low cost iontophoresis devices for transdermal drug delivery by T S S Ching, P

Connolly, I Camilleri IEE Seminar Digests (2004) Volume: 2004, Issue: 10408,

Publisher: IEE, Pages: 17-17

7. Mudry B, Carrupt PA, Guy RH, Delgado-Charro MB., Quantitative structure-

permeation relationship for iontophoretic transport across the skin. J Cont Rel.

2007; 122: 165-172.

8. Bayon Rodriguez AM, Corish J, Corrigan OI. In vitro passive and

iontophoretically assisted transport of salbutamol sulphate across synthetic

membranes. Drug Dev Ind Pharm. 1993; 19:1169-1181.

9. Droog EJ, Sjoberg F. Non specific vasodilation during transdermal

iontophoresis. Microvascular Res. 2003; 65: 172-178.

10. Bose S, Ravis WR, Lin YJ, Zhang L, Hofmann GA, Banga AK. Electrically-

assisted transdermal delivery of buprenorphine. J Cont Rel. 2001; 73: 197-203.

27

11. Iontophoretic transdermal permeation of verapamil (III): Effect of binding and

concentration gradient on reversibility of skin permeation rate Lorraine L.

Wearley and Yie W. Chien, International Journal of Pharmaceutics Volume 59,

Issue 2, 20 March 1990, Pages 87–94

12. Rudolf F. Graf ‘The encyclopedia of Electronic circuits’ (BPB Publication:

New Delhi) (First Indian Edition) (1989).

13. The 8051 Microcontroller And Embedded Systems, Muhammad Ali Mazidi

and Janice Giilispie Mazidi, Second Edition, 2005, Prentice Hall, Upper Saddle

River, New Jersey Columbus, Ohio.

28

Appendix I

C program for Microcontroller Atmega32.

#include <util/delay.h>

#include <avr/io.h>

#include <util/delay_basic.h>

#include "lcdfourline.c"

#include <string.h>

#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))

#define CLEARBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))

#define FLIPBIT(ADDRESS,BIT) (ADDRESS ^= (1<<BIT))

#define CHECKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT))

#define WRITEBIT(RADDRESS,RBIT,WADDRESS,WBIT) (CHECKBIT(RADDRESS,RBIT)

? SETBIT(WADDRESS,WBIT) : CLEARBIT(WADDRESS,WBIT))

void InitADC()

{

ADMUX=(1<<REFS0); // For Aref=AVcc;

ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); //Rrescalar

div factor =128

}

uint16_t ReadADC(uint8_t ch)

{

//Select ADC Channel ch must be 0-7

ch=(ch && 0b00000111);

ADMUX&=0b11111000;

ADMUX|=ch;

//Start Single conversion

29

ADCSRA|=(1<<ADSC);

//Wait for conversion to complete

while(!(ADCSRA & (1<<ADIF)));

//Clear ADIF by writing one to it

ADCSRA|=(1<<ADIF);

return(ADC);

}

//This function is used to initialize the USART

//at a given UBRR value

void USARTInit(uint16_t ubrr_value)

{

//Set Baud rate

UBRRL = ubrr_value;

UBRRH = (ubrr_value>>8);

UCSRC=(1<<URSEL)|(3<<UCSZ0);

//Enable The receiver and transmitter

UCSRB=(1<<RXEN)|(1<<TXEN);

}

char USARTReadChar()

{

//Wait untill a data is available

while(!(UCSRA & (1<<RXC)))

{

//Do nothing

}

return UDR;

}

void USARTWriteChar(char data)

30

{

//Wait until the transmitter is ready

while(!(UCSRA & (1<<UDRE)))

{

//Do nothing

}

//Now write the data to USART buffer

UDR=data;

}

void wt(int ii)

{

for(ii=0;ii<ii;ii++) //200

_delay_loop_2(0);

}

void send_data()

{

uint16_t adc;

uint8_t ub,lb;

adc=ReadADC(0b00000000);

lb=(adc % 256);

ub=((adc/256)& 7);

USARTWriteChar(ub);

USARTWriteChar(lb);

}

int main()

{

int ONT=1,OFT=1,ij;

uint8_t data_tim=10,tim=0,ii;

DDRA=0b00000000;

31

DDRB=0B11111111; // all bit as OUTPUT

DDRD=0B11111111; // all bit as OUTPUT

DDRC =0b01001111;

PORTC=0b10110000;

SETBIT(PORTA,PA0);

InitADC();

USARTInit(71); //UBRR = 71 FOR 9600 AT 11.0592 MHz

LCDInit(LS_BLINK|LS_ULINE);

LCDClear();

Myprint(0,0,"UGC Minor Proj. "); wt(10);

Myprint(0,1,"ON= s:: OFF= s"); wt(10);

while(CHECKBIT(PINC,7))

{

// update(ONT,OFT);

// ONT=1; OFT=1;

if(!CHECKBIT(PINC,5))

{

ONT=ONT+1;

if (ONT>10)

{

ONT=1;

}

_delay_ms(200);

}

if(!CHECKBIT(PINC,4))

{

OFT=OFT+1;

if (OFT>10)

{

OFT=0;

}

32

_delay_ms(200);

}

LCDWriteIntXY(03,1,ONT,2);

LCDWriteIntXY(13,1,OFT,2);

}

while(1)

{

//LCDWriteIntXY(13,1,OFT,2);

for(ii=0;ii<ONT;ii++) // ONT Loop

{

SETBIT(PORTC,PC6);

_delay_ms(1000);

ij=ii;

// LCDWriteIntXY(03,1,ij,2);

tim=tim+1;

if (tim==data_tim)

{

CLEARBIT(PORTC,PC6);

tim=0;

_delay_ms(100);

send_data();

SETBIT(PORTC,PC6);

}

}

for(ii=0;ii<OFT;ii++) // OFT Loop

{

CLEARBIT(PORTC,PC6);

_delay_ms(1000);

tim=tim+1;

33

if (tim==data_tim)

{

tim=0;

_delay_ms(100);

send_data();

}

}

}

}