A microprocessor-based animal monitoring system

A microprocessor-based animal monitoring system

A Microprocessor-Based Monitoring Animal System KANJI NAKATSU AND JAMES A. OWEN The construction of many sampling For the The detection us...

705KB Sizes 0 Downloads 108 Views

A Microprocessor-Based

Monitoring

Animal

System

KANJI NAKATSU AND JAMES A. OWEN

The construction of

many

sampling

For

the

The

detection

used.

by a novice

take approximately

activity

monitoring

scores,

limited

of electronics.

of the activity

a microprocessor diodes

technical

A system

and would

Animal-monitoring;

to control

keep time,

light-emitting

With

3 wk to build

Microprocessor;

Key Words:

uses

infrared

units, were

automatic

system

box, accumulate

phototransistors

can be constructed would

for continuous,

is described.

of each animal

printout. sensitive

of a system

animals

and control

and

infrared-

advice the system

to monitor

40 animals

cost about $700. Automation;

Inexpensive

INTRODUCTION In the

taken

course

in which

The treatment ance,

and

for each

was

mouse,

reasonable

box. This could

an individual

motor

to such

a system

are:

done

the

activity;

monitor

animal

would

dollars

be required.

to transfer

in the laboratory.

a light beam

to simply

in the mouse

the

a counter

and

The disadvantages

data

from

the

system taking

counter

could

that the costs of parts and labor

was to build

As it did

it was decided

counter.

a

a monitoring

that even the level of noise of the counter

method would be high. A second method considered

on

apparent

each box with a light source

into a mechanical

and the realization

perform-

activity

to purchase

the system

passed through

easily by wiring

enzymes.

muscular

It was immediately

of animals.

was to construct

requirement

the possibility

longevity,

was to be evaluated,

the output

trial was under-

of proteolytic

to evaluate

thousand

each animal

have been

and then feeding

weight,

activity

several

activity

of times

detector,

periodically;

number

a therapeutic

with inhibitors

necessary

to this problem

only gross

the number

unnatural

therefore

to spend

the solution

Because count

It

dystrophy,

by monitoring

basis and for a large

not seem system,

on muscular

mice were treated

was evaluated

activity.

continuous that,

of studies dystrophic

cause

using this

advantage

of

the low costs and high performance of integrated circuits. This alternative, per se, was discarded because of the complexity and rigidity of the final product. The best solution

was to assemble

the system using integrated

and transformation

into digital

storage,

and control

From

keep time,

the Department

Address Kingston, Received

reprint Ont., April

format,

the print out automatically.

of Pharmacology,

requests

to:

Dr.

circuits

Kanji

for signal generation

and to use a microprocessor

Queen’s Nakatsu,

University, Department

Kingston,

to handle

Below we describe Ont.

data the

Canada.

of Pharmacology,

Queen’s

University,

Canada K7L 3N6. 2, 1979;

revised

and accepted May 4, 1979. 71

0 Elsev,er North Holland,

Inc., 1980, Journal of Pharmacolog,cal

Methods

3, 71-82 (1980)

72

Kanji Nakatsu and James A. Owen construction sembled

of a microprocessor-based

animal

monitoring

system

which

was as-

for less than $700.

METHODS Materials The

microprocessor,

was purchased manufacturer U.S.A.

The

is Motorola remaining

1110 Gordon Functional The with

MEK 6800 D2, with two optional

as a kit and assembled

Baker

electronic

from

Products,

components

Rd., Willowdale,

system

Inc.,

access memories,

Phoenix,

are available from

Ontario,

consists

data routing

The activity transducer of the mouse

Semiconductor

random

by the instruction

sheets;

Arizona,

the

85036,

Electrosonic

Inc.,

Canada.

Plan

monitoring program,

as indicated

unit,

consists

of essentially and detection

of a solid-state

three units

units;

the microprocessor

as shown

light source

into the light beam, the voltage of the phototransistor

approximately

1 to 4 V. This

is because the resistance

in Figures

and sensor.

1 and 2.

Upon

output

entry

changes

of the phototransistor

is light dependent and the voltage measured is a function of this resistance. The signal from each phototransistor is made compatible with the multiplexer’ elec-

3llllll

IIII~IIIIllllI~‘~,

;i

V

V MPX

I

MPX

MPX

I

h

BOXES

6-39

BOXES

1

O-5

FIGURE 1. General plan of monitoring system. MPU, microprocessor including peripheral interface adapter; MPX, multiplexer National Semiconductor DM 74150; buffers A-G, RCA CD 4050; buffer H, two National Semiconductor DM 7404 inverters connected in series.

‘A multiplexer placing

is used to select

the appropriate

electrical

one code

data line from

several

on the data select

data lines.

lines.

The selection

is controlled

by

Automated

Animal Monitor

73

l

FIGURE 2. Schematic diagram of detection unit. Power supply was +5 V. Connections for the phototransistor, PT, were emitter to ground, collector to R, and base not connected. The resistance of R2 was 100 ohms and R, was set as described in the text between 470 KS2 and 10 MSL.

tronics by buffers A to C. Since the microprocessor is capable of checking only one animal box at a time, a box selection system consisting of the four multiplexers is used to sample lines.

The

the appropriate

microprocessor

number

in binary

adapter

register

sequential

box by selecting

controls

code

on address

B. Boxes

are

Upon

receipt

fashion.

(select)

microprocessor

then

the results of the last check. examination mouse counted. interval

is one activity

has remained

addressed

repeatedly

of a box address,

depends

cage number ferred

examines Only

upon

the numbers

to the printer

beam

since

interval

loaded record.

memory the

output box

interface timesisecf

units route adapter

cycle

it to

since the last

for that animal.

last check,

If the

no activity

is initiated;

are sequentially

is this

into the 2”, 3”, and 4” counters. memory

the

register

and compares

the beam

the print

of each cage activity

for a permanent

(4000

interface

has entered

to the activity

of a predetermined

and the contents

in a rapid

the state of the sensor

of the

buffer

the appropriate

the multiplexer

peripheral

if the mouse

unit added

in or out

At the end

by placing

lines 0 to 5 of the peripheral

signal of that box to bit 0 of the microprocessor A. The

the corresponding

box selection

The trans-

With the values listed in the program,

a printout occurs every 2 hr. After the print cycle is finished, all memories cleared and the system commences another 2-hr monitoring cycle. Detection

are

Units

Each mouse

box had a detection

nix IRL-60) and phototransistor

unit made of a light-emitting

(Motorola

Photo

Darlington

diode

2N5777).

(LED) (LitroBoth devices

operate in the infrared range. The LED and phototransistor were mounted in black Plexiglass @ holders with 4-mm diameter holes drilled to allow light passage. This arrangement

made

it possible

under full illumination The circuit diagram convenient

to solder

for the

units

of fluorescent lights. for the detection unit resistor

R, directly

to operate is shown

to the positive

in complete in Figure terminal

darkness

2. We

found

or it

of the LED. Each

74

Kanji Nakatsu and James A. Owen animal box was connected to the data routing inclusive, the power supply, and multiplexers) and plug (Armaco to the animal

3 WJB and 3WP).

box while

box (which housed buffers A to G with an in-line stereo phone-jack

As a safety precaution,

the jack was attached

the plug was attached

to the multiplexer

box and power

was supplied through the tip contact of the plug. Resistor R, was soldered in the phone jack. It was found that the value of this resistor varied from one animal box to another the

and,

consequently,

use of a resistance

voltage

applied

to the buffer

high (4 V) when Peripheral

value

was chosen

The circuit

was low (1 V) when

empirically

was designed

with

so that

the

the light path was clear and was

the light path was obstructed.

Electronics

The exact wiring The reader handbooks

the appropriate

box and voltmeter.

for all the components

is referred for exact

data routing

to the National pin connections

box was simplified

in the data routing

box is not shown.

Semiconductor CMOS(1976a) and TTL (1976b) and specifications. The actual wiring of the

by placing

it on two small

printed

circuit

boards

(Radio Shack 276-153) which were later plugged into edge connectors. The edge connectors were mounted on the front panel of the box, then the wires interconnecting wires

the circuit leading

bring them

from

boards

in through

The output

from

and the boxes were

the animal three

boxes

soldered

in place.

to the data routing

50 pin connectors

the microprocessor

(Amphenol

unit to buffer

As there are many

box it was necessary 57-30500,

H originates

from

of the peripheral interface adapter (PIA) register B. Bit 6 was connected the printer. Data input from the data routing box to the microprocessor 0 of PIA register

to

57-40500). bits 0 to 5 directly to was via bit

A.

Program The program Consequently,

was written it is made

so that the monitoring of a number

of closed

system would loops.

The major

run continuously. loop sets up the

instrument. Thus, it clears the appropriate memories, sets the condition codes for the peripheral interface adapter, and coordinates the minor loops. Table 1 shows the complete the program

program and describes in diagrammatic form.

RESULTS AND The

system

As the components

has run

reliably

are electronic,

of operatimg for many years if necessary. humidity, which caused the microprocessor a failure

performed.

Figures 3 and 4 show

DISCUSSION

monitoring

arising.

the function

to print.

In the

course

with

only

it is expected

two

unforeseen

problems

that the system is capable

One of the problems encountered was to malfunction; this was manifested as

of cleaning

the

mouse

room,

the

animal-care

technicians wash the floor using water from a pressurized hose. Consequently, the humidity of the room rises to high levels rapidly. Ideally, the electronics and printer should solution

be located

in a separate

room

was to place the microprocessor

but in our case this was not possible. in a large plastic

bag with

dessicant.

The To

Automated eliminate

printer

noise,

away from

the mouse

The second

problem

taken

residence

function

sampling buffer

be noted

each moves

slowly

by a nondystrophic

microprocessor upon.

unit.

The

into the light beam the trigger

mouse

with

This could because

voltage

wires

unit

After a thorough

box 4000 times/set.

around

in a separate

of connecting

that the microprocessor

mouse

can fluctuate

was located

This length

was caused

in the

after it was urinated

restored. It should animal

the printer room.

Animal Monitor

room which caused

that had escaped

apparently

started

cleaning,

normal

614.4-KHz

clock

the analog

input

voltage output

SET CUUITION CODES OF PIA *

WAD

TER

INCRI:MLNT LONG-TERH HEMXY IF INTE,WEI~IATETERM MEORY > II

COUN-

2. DECRElENT

ADD VALIII: TO I NTERJ4EDIATE TERM HliMORY

ADDRESS AND SAJQLE BOX

T, II III.CRI:MENT

FIGURE 3.

Main loop of program.

was

is capable

give rise to problems

and cause the buffer

and

to mal-

function

CLliAR P(FNon I ES

LOAD 29.3*.49 CanmEnS

was 15 m

no problems.

of

if the to the voltage

75

76

Kanji Nakatsu and James A. Owen TABLE 1 Program. Each Step Number Beginning with a Zero Represents an Instruction. The Other Steps Represent Data or Addresses. Instruction Key: l_DX, Load Index Register; CLR, Clear; DEX, Decrement Index Register; BNE; Branch If Not Equal: LDA, Load; STA, Store; DEC, Decrement; JSR, Jump to Subroutine; BRA, Branch; CMP, Compare; BEQ, Branch If Equal; ADD, Add; TST, Test; INC, Increment; RTS, Return from Subroutine; SUB, Subtract; BLS, Branch If Less than; NOP, No Operation STEP

CODE

0’100

CE

101

00

INSTRUCTION

LDX

‘I 02

8F

0103

6F

IO4

00

0105

09

DEX

0106

26

BNE

-107

86

109

FF

01 DA

B7

IOB

80

IOC

05

O’lOD

B7

lot

80 87

III

80

l ‘I 2

07

0113

86

.I 14

60

116 0117 ‘1 18 0119

Clear

memories

0000 to 008F

LDA ~ STA

STA

Set condition interface

06

OllO

OlI5

CLR

FB

0108

1OF

FUNCTION

97

LDA STA

IIA

a2

0118

86

.I IC

01

01 ‘I D

97

IIE

83

OIIF

7A

‘120

00

221

8-l

O’i 22

26

123

3C

0124

86

125

60

0126

97

127

82

Load 2” counter

in memory

0082

Load 3” counter

in memory

0082

Load 4” counter

in memory

0083

j LDA

tF 97

of peripheral

~

81 86

codes

adapter

STA j, LDA STA I DEC

BNt

Decrement

2” counter

is not

branch

zero

and

if result

to step 0160

I LDA STA

Load 2” counter

in memory

0081

Automated TABLE

1

(cont.)

STEP

CODE

0128

7A

129

00

12A

82

0128

26

12c

33

012D

86

12E

EF

012F

97

130

82

0131

7A

132

00

133

83

0134

26

135

2A

0136

C6

137

27

0138

D7

139

8F

013A

96

13B

8F

013c

BD

13D

00

13E

BO

013F

DE

140

8E

0141

A6

142 0143

00

145

BO

0146

86

147

59

0148

87

149

80

0148

INSTRUCTION

FUNCTION

DEC

BNE

Decrement

3” counter

is not zero

branch to step 0160.

and if result

LDA Load 3” counter

STA

in memory

0082

I DEC Decrement not zero

BNE

4” counter

and if result

branch to step 0160

I LDA

Start

print

sub routine

Load number

STA i LDA > JSR

memory

of animal

in

Load box number

Jump to hexadecimal i

boxes

008F

conversion

routine

to decimal at step OOBO

LDX Load activity LDA

00 BD

144

14A

Animal Monitor

value for box number

loaded at step 013A 1

ISR

Jump to hexadecimal 1

conversion

routine

to decimal at step OOBO

LDA Instruct

STA

printer

to print

out

06 BD

14c

00

ISR

Jump to delay subroutine

at step

OOAO

14D

A0

014E

7A

14F

00

150

8F

0151

26

152

E7

0153

20

Return

154

AB

again

I 1 DEC

Decrement i

BNE >

address

memory

008F,

to next animal

changes

box

If all boxes

have not been printed

out,

to step 013A and print

return

next box to step 0100,

start

program

if

77

78

Kanji Nakatsu and James A. Owen TABLE 1 STEP

(cont.) CODE

0160

86

161

AA

0162

97

163

85

0164

86

165

27

0166

CE

167

00

168

27

0169

87

16A

80

16B

06

016C

F6

16D

80

16E

04

016F

El

~NSlRUCTiON

LDA Start box sampling 1

Load number

LDX ~ STA

Address

LDA

06

BEQ i

0173

E7

STA

174

50

E7 27

017A

09

DEX

0178

26

BNE

17c

EC

017D

7A 00

0180

26

181

E2

0182

CE

183

00

of box sampled

with

if same go ahead to step 0179

new status

in short-term

and add action to

intermediate-term

memory

i

4A

85

status

at last sampling

memory

ST-A

178

17E

status

Store

ADD

0179

17F

box and sample

Compare

27

27

animal

I CMP

172

176

of boxes to be

sampled

0171

0177

Load I’

LDA

50

EL3

loop,

counter

STA

170

0175

FUNCTION

DEC

I

Change address tf result

to next animal

is not zero

box.

go to step 0169

I DEC

BNE

Decrement

1” counter

If not zero,

go back to step 0164

Load index

register

~

LDX

with

number

of

boxes

184

27

0185

6D

186

27

see if animal

0187

27

sampling

I%8

02

no movement,

0189

6C

018B.

18A

00

1 Test

intermediate-term

memory

specified

by 1” counter.

go ahead to step

If there was movement

increment

to

moved during

long-term

memory

If

Automated TASLE 1

fcont.)

STEP

CODE

018B

6F

18C

27

INSTRUCTION

09

DEX

018E

26

BNE

18F

F5

Clear intermediate-term Change address

0190

20

191

8D

BRA _

OOEO

D6

LDA

El

81

E3 OOE4

CB F7

STA I

OOE7

BD

JSR

A0

EB OOEC ED

CB F7 06 BD

FO

00

F1

A0

OOFZ

7F

F3

80

F4

06 BD

F6

00

F7

A0 7F

F9

00

FA

81

OOFB

39

OOAO

CE

Al

18

A2

00

00A3

09

OOA4

26

A5

to

Jump to delay subroutine Allows 1

time for printer

to accept

digit.

ADD STA

instructs

printer

to accept digit.

I ISR Lump to deiay subroutine } CLR

Clear entry printer

i

informs

lump

to delay subroutine

‘! CLR

Clear memory

0081 to prepare

for

next digit.

1 RTS

Return

from

printer

to hexadecimal

LDX

load subroutine

to decimal

Start delay subroutine. of delay loops

i DEX

FD 39

to printer,

that digit has been entered.

LSR

i

OOA6

interface

electronics

80

EE

OOF8

activates

10

OOEF

OOF5

to digit to be entered

printer.

06

E9

go to step 0185.

go to step OIIF

load subroutine

adapter. This

E6

00

is zero,

and put out on peripheral

80

E8

is not zero,

If result

Add 60 (Hex)

60

memory.

to next box. If box

address

Start printer ADD

E5

OOEA

FUNCTION

CLR

018D

OOE2

Animal Monitor

} RTS

-

index

until

register

index

Load number

into index

Decrement

routine

register,

register

repeat

equals zero

Return

from

printer

load subroutine

delay subroutine

to

79

BO

Kanji Nakatsu and James A. Owen TABLE 1

(cont.)

STEP

CODE

INSTRUCTION

Ft~hic~10N -

CMP

OOBO RI 0082 83

81

0084 BS

SUB

0086 87 88

80 64 7C 00 81

0089 BA

20 F5

BRA

OOBB ac a0

BD 00 EO

JSR

OOBE BF ooco cl

81 09 23 07

CMP

oOC2 C3 ooc4 C5 CG

80 OA 7C 00 81

SUB

ooc7 C8

20 F5

BRA

oOC9 CA CB

BD 00 EO

ISR

oocc OCD CE OOCF DO 01

01 97 81 BD 00 EO

NOP STA

OOD2

39

63 23 07

Start Hexadecimal conversion.

BLS !

smaller

is 99 (Dee)

or

go to step OOBB

Subtract

INC

to Decimal

If number

100 (Dee)

increment

from

100 (Dee)

number

and

counter

) >

Return

to step 0082

Jump to printer

i

toad hundreds

If number

BLS

toad subroutine

to

digit

is 9 (Dee)

or smaller

go to

step OOC9

1

Subtract

INC

IO (Dee)

increment

from

10 (Dee)

number

and

counter

1 Return

to step OOCO

} Jump to printer

i

load subroutine

Take ones digit and jump

ISR

to

load tens digit

to printer

load subroutine

I Return

from

conversion of print

hexadecimal routine

to decimal

to primary

loop

routine

to change state several times. This of course leads to falsely high counts of passage through the beam. The program from step 0164 to 0172 allows the microprocessor to sample each mouse box at high frequency but only adds to printout memory once in 170 samplings. This effectively slows the sampling rate down from 4000 Hz to 23 Hz without through the light

sacrificing detection of high-speed events. A mouse passing beam in half a millisecond would still be detected. While per-

Automated Animal Monitor

FIGURE 4.

formance illustrate

such high speed is not required

at

the flexibility

to the present purposes.

and potential

application,

This would

replacement logical

Print subroutine.

the monitoring

probably

of the detection

action

require unit with

into an electrical

in the present

application,

of microprocessor-based system rewriting

could

systems.

be used for many

(or altering)

an appropriate

it serves to In addition

the

program,

unit to transduce

other and

the bio-

signal.

Printer To fully appreciate themselves in which

familiar a printer

the printer

set-up it may be necessary

with the function uses binary-coded

of a peripheral decimal

for readers

interface

signals.

to first make

adapter

and the way

For the printer

we used an

Olivetti Logos after removing the keyboard. There was no technical advantage in using this printer; it was used simply because it was available. Any printer which accepts binary-coded decimal (BCD) digits should serve the same purpose. Bits 0 to 5 of peripheral

interface

adapter

register

B were

common

to both

the printer

81

82

Kanji Nakatsu and James A. Owen and the animal printer

could

box selection

lines.

only be activated

Bit 6 was connected

by placing

only to the printer

and the

the digit one on this line. This arrange-

ment prevented activation of the printer every time an animal box was selected. When a number was printed, the relevant digits were transferred from the microprocessor

to the printer

digit to the printer, in question,

we placed

digit to the printer. to a one. adapter;

via bits 0 to 3. In order By adding

70 (hexadecimal)

the printer

it was necessary

this informed

subroutine which

code used.

was necessary

to accept

could

After

by clearing

overloading

deliver

in bit 4; this presented

the digit.

that the number

to prevent

the microprocessor

the

to the digit the

to the digit, bit 4 was now converted

to clear the entry

the printer

to present

60 (hexadecimal)

a one in bits 5 and 6, and a zero

By adding

This instructed

the printer,

in binary

bits 4 to 6 were

entering

a digit into

the peripheral

had been the printer

digits was far greater

interface

entered.

The delay

because

the rate at

than that which

could

be printed. After all the digits of a number were entered, the printer was instructed to print the complete number by delivering the hexadecimal number 59 to the printer. It should

be noted

that the digit 5 of 59 placed

5. Again bits 4 and printing mechanism. number activity. single

printed

was

Accordingly, memory

the

animal

the largest

limiting,

the user has two options. by changing

be altered

work

number

code)

was supported

memory

by the Muscular

First, the printout

last 3 digits

If memory interval

3°counters.

capacity Dystrophy

the

units that could

was 255.

the values of the 2’and increase

and

of activity

so that each box was assigned

16 bits. This would This

box

number

(in 8 bits of binary

frequent could

a one in bits 4 and 6, and a zero in bit

6 were used to activate the system and bit 5 activated the The program was written so that the first portion of each

capacity

could

locations

in a

becomes

be made

Alternatively,

two memory

represented be stored

more

the program for a total of

to over 65,000. Association

of Canada.

REFERENCES National Book.

Semiconductor

Corp

(1976a) CMOS

Data

National Book.

Semiconductor

Corp

(1976b)

7-U

Data