вторник, 13 марта 2012 г.

ELOPTA: A novel microcontroller-based operant device

Operant devices have been used for many years in animal behavior research, yet such devices are generally highly specialized and quite expensive. Although commercial models are somewhat adaptable and resilient, they are also extremely expensive and are controlled by difficult to learn proprietary software. As an alternative to commercial devices, we have designed and produced a fully functional, programmable operant device, using a PICmicro microcontroller (Microchip Technology, Inc.). The electronic operant testing apparatus (ELOPTA) is designed to deliver food when a study animal, in this case a bird, successfully depresses the correct sequence of illuminated keys. The device logs each keypress and can detect and log whenever a test animal is positioned at the device. Data can be easily transferred to a computer and imported into any statistical analysis software. At about 3% the cost of a commercial device, ELOPTA will advance behavioral sciences, including behavioral ecology, animal learning and cognition, and ethology.

Operant procedures are a fruitful way to study behavior in animals. Researchers can measure factors that alter response rate, success rate, latency to respond, and so on, and devices can be used to mimic natural challenges that an animal might face. Our goal was to facilitate behavioral research by producing an inexpensive device that could control any of a flexible array of experiments and automatically and precisely record data.

Computer controlled operant devices have been in common use since the late 1960s (e.g., Moise & Jarrard, 1969). The configurations have varied considerably, each device matching the set of experiments for which it was developed, and have included mechanical (e.g., Logan & Logan, 1970) or electronic (e.g., Leber, 1978) means of reinforcement and recording of data. The vast majority of such devices have required a master computer to control them; only a few are designed to operate independently (e.g., Hoeksma et al., 2000; Pamment & Stephens, 1981; Redmond & Hegge, 1985).

Some specialty companies, such as Coulbourn Instruments (Allentown, PA), Med Associates (St. Albans, VT), and Cambridge University Technical Services Ltd., make modular systems for any number of purposes in animal research, from activity monitoring to physiology to behavior. While these commercial operant devices are capable of a wide array of tests, there are a number of issues that keep these devices rather uncommon in most research laboratories. First and foremost, these systems tend to be quite expensive. For example, a complete Habitest setup from Coulbourn Instruments, of similar capability to four of the devices described below, would cost at least US$20,000, and a similar Whisker (Cambridge University Technical Services) system would cost about US$10,000. In addition to a considerable financial investment, setting up such a system requires a significant investment of time. Programming a Habitest system is done entirely through proprietary software, which can run complex experiments but requires that the user learn an idiosyncratic software environment.

We wished to produce an operant device that is comparable to commercial systems but avoids these difficulties. Our requirements for the device were that it must (1) automatically control all procedures; (2) log data; (3) be easily reprogrammable (making it usable for multiple experiments); (4) be easy to use; (5) be portable, durable, and resistant to failure; and (6) fall within a reasonable price range.

OPERANT APPARATUS

We constructed an apparatus that features three illuminated keys, a perch, a reward delivery system, and a numeric display (Figure 1). The keys are made of translucent acrylic hinged with sheet aluminum (Figure 2). Pressure on the key depresses a tactile microswitch through a lever, and sensitivity of the switch can be calibrated by turning a screw on the back. The ability to calibrate switches allows the device to be configured for different species which might exert greater or lesser amounts of pressure on a key. Key pecks are debounced in software by a 1-msec delay in the interrupt function, which ensures that each peck is registered only once.

Affixed to each key is a foil lined plastic cone containing a bicolor (red/green) light-emitting diode (LED). The cone serves to reflect the light, such that the LED can illuminate the entire key. (Replacement flashlight reflectors would be equally effective, though more expensive.) We applied course grain sandpaper to the keys and to the LEDs themselves to increase the diffusion of the light.

The perch is set in the center of the device. Behind the device, the end of the perch is affixed to another microswitch, which is held in the "on" position by small durable nylon bands. When sufficient weight (calibrated with a screw to be a little less than the typical weight of a target species) is applied to the perch, the switch is released, and this can be detected by a microcontroller. Due to the way this mechanism functions, an additional 30-msec delay is included in the interrupt function to debounce the signal when the perch switch changes state. For animals other than birds, this perch could quite simply be replaced by a more appropriate means of detecting the animals presence, such as a flat platform for rats or mice.

Rewards are delivered on a 17-cm diameter acrylic wheel, which contains 24 reward wells at regular intervals. The reward delivery area allows access to one well at a time. The wheel is mounted on a 48-step stepper motor (PF35T, Nippon Pulse). Sending the proper signals through the stepper motor driver (described below) causes the wheel to rotate exactly 15� (two steps), bringing a new reward into position. Above the reward area is an ultrabright (5,000 mcd) white LED to indicate that a reward is available. Although simpler methods of reward delivery exist, such as pellet dispensers or timed seed trays, this method allows the presentation of a reward suitable for insectivorous or frugivorous animals.

The front of the device also features a two-digit, sevensegment display, recessed such that it is not visible to an animal on the perch but is visible to an observer looking straight at the device. When the device is initially turned on, the user selects the values of various experimental parameters (such as date and time, subject number, retention interval, etc.), using this display to indicate the current values. The left, right, and center keys will decrease, increase, or accept the displayed value, respectively. During experiments, the display shows trial number. This display could be made visible to a camera, allowing one to synchronize the automatically logged data with video recordings.

Circuitry

Each apparatus contains a single custom built circuit board (8.0 � 9.2 cm), featuring a PIC16F877A microcontroller from Microchip Technology, Inc. (Figure 3). The 8-bit microcontroller has five I/O ports with up to 33 usable channels, 8 KB of program memory, three built-in timers, and support for writing to serial EEPROMs or to a serial port. In the ELOPTA, the crystal oscillator operates at 20 MHz (the fastest speed supported by the controller; while the processor can run at frequencies as low as 4 MHz, higher speeds produce greater accuracy in time measurements). The actual layout of the board will depend on the needs of the user. Our design was created using Proteus PCB Design (Grassington, North Yorkshire, England), and we can make available the CADCAM files or discuss other options for reproducing our PCB layout on request.

The circuit board contains a 5-V voltage regulator (LM7805, Fairchild Semiconductor), a socket for a single serial EEPROM for storing data (24LC256 or 24LC512, Microchip Technology, Inc), a MAX231 serial controller (Maxim) for serial communication with a personal computer (though this can easily be replaced by a UART-USB bridge chip such as one of Silicon Laboratories' CP210x series for USB communication), a complete stepper motor driver, and arrays for connecting the seven segment displays, the four microswitches, the reward LED, and the three bicolor LEDs. The circuit can be powered either by connecting a battery pack of four AA batteries or through a DC power supply.

To program the microcontroller, the circuit is connected to the in-circuit debugger and programmer, ICD 2 (Microchip Technology, Inc.) via a five-pin connector. The ICD 2 itself costs US$ 159.99 and is compatible with a wide array of microcontrollers produced by Microchip, including more advanced processors. The ICD 2 connects to a PC via a USB cable and interfaces with Microchips free integrated development environment for Microsoft Windows, called MPLAB IDE. The IDE supports programming in assembly language and can be fully integrated with compilers for other languages (such as the freeware C compiler, PIC-C Lite, produced by Hi-Tech Software). Programming a microcontroller thus involves writing a program using the IDE, compiling the program, connecting the microcontroller to the PC via the ICD 2, and allowing the ICD 2 to upload the program onto the microcontroller. The ICD 2 can also be used as a debugger to help isolate programming errors and to single step through the program.

Program

Although many programs could operate on this device, we designed several specific-purpose programs, such that the device could begin with a naive subject and train it through a series of successive approximations to full operation of a discrimination or delayed match-to-sample task. These programs are specific to our testing paradigms, but each program differs only in the logic which determines which keys will be lit, the delays involved, and the responses that will result in a reward. These contingencies are accomplished by a series of simple if/then type statements (e.g., if the subject is on the perch, light the center key; if the subject has pecked the key that matches the sample, deliver a reward; etc.). Figure 4 is a simplified flowchart of our main testing program.

The remainder of each program consists of the core components, a set of functions that allow the program to operate the hardware and perform common functions in the software. These include functions for reading and writing to an EEPROM, communicating with the PC through a serial port, stepping the motor, keeping track of the time, and detecting keypecks. These components could be used in any experiment Even if the code we have written is too specific to our experiment to be used unmodified, these programs can be easily adjusted to other paradigms with only a basic knowledge of C. Upon request, we will gladly distribute full copies of our source code.

Within our program, the controller increments a time counter every 10 msec. Whenever any key is pushed, whenever the perch switch changes state, and at the start and finish of every trial, the program generates a compressed data point indicating the trial number (8 bits), the category of data (2 bits), the type within a category (3 bits), and the current time (3 bytes, number of elapsed 10-msec intervals) since experiment start. These are transferred to the serial EEPROM at the end of each trial; writing takes about 10 msec, during which time interrupts are disabled. On the EEPROM, trial number, category, and type are stored as separate bytes, and time is stored in three separate bytes, so each data point uses 6 bytes of EEPROM storage. EEPROM memory is nonvolatile, so these data remain in storage until the chips are electronically erased by a special function in the reading program.

The reading program performs a sequential read on the EEPROM, outputting all data recorded on an EEPROM in ASCII format to the serial port Each data point is read as a number representing the trial number, a category/type code, and three decimal numbers (between 0 and 255) representing the time, all separated by commas. A serial port monitoring program, such as HyperTerminal (included in all Windows operating systems) is required to upload data to the PC. HyperTerminal will output a text file, which can be imported into Microsoft Excel as a comma delimited list

The data files produced by the reader program first report the date, subject ID, and light sequence of a session, then list all data points recorded during a session, starting with a summary data point indicating the total number of trials and the total time elapsed. We have developed a Microsoft Excel worksheet which translates this into a legible format for analyses, provides basic summary information (i.e., number of successes and errors, number of left and right keypecks, etc.), and produces a summary graph of the data (see Figure 5). Table 1 shows the beginning of a sample data file and the first two trials, as read from the EEPROM and translated by Microsoft Excel.

DISCUSSION

The total cost of producing four of these devices, including the price of the ICD 2, was approximately US$300, about 3% of the cost of a commercial device. Like the commercial devices, PIC microcontrollers are highly flexible, useful for any number of different experiments. With the programs we have written, one could run many types of operant experiments with little or no modification of the code. If adjustment is required for a particular experiment a basic knowledge of C will be sufficient to modify the ELOPTA source code or to write a new program. As everything in the device except the motor itself is solid state, the ELOPTA is highly resistant to failure.

A major advantage that the ELOPTA has over commercial systems is its portability. The commercial devices require a computer to control them at all times. While this allows data to be collected and viewed in real time, it also ties operant stations to a fixed location. The ELOPTA is compact and portable and can be powered by a small battery pack. All programmed contingencies and the resulting data are stored on the device itself, so the device is quite capable of operating independently. Thus, ELOPTAs are ideal for field work, where having a computer, even a laptop, would be inappropriate or inadvisable. Most of the components draw very little power, so the device can operate for extended periods. ELOPTAs are not individually expensive, so it would be conceivable to produce many of the devices to be placed in many locations in a field site.

The current ELOPTA design does not make full use of all of the PIC16F877A's available features. A number of the available I/O channels were not needed for the authors' current research, but this flexibility might allow some enhancements. For example, rather than using bicolor LEDs for the peck keys, one could use some of the currently available tricolor (red/green/blue) LEDs. These LEDs can generate a considerably larger number of colors by providing varying levels of current to each of the three light-emitting units. Thus, using a number of the PIC's digital outputs and an array of resistors, one could generate many more possible colors, increasing the difficulty or complexity of the task. Other possible enhancements might involve replacing the numerical display with a liquid crystal display, adding small speakers to be used as audio outputs to accompany or replace the visual outputs, or replacing the perch microswitch with an analog tension switch to measure a subject's weight while it is on the perch.

With the same basic design, a number of applications are possible for this device. The authors designed this device as a means to measure cognitive failure in birds. We intend to test birds in a delayed match-to-sample paradigm under a number of different conditions to determine how factors such as subjects' motivation or environment might affect their success rates. However, one could envision any number of other uses for a reprogrammable, low-cost operant controller. With minor modification of the code or circuitry, the ELOPTA can be used for studies of decision making, learning (social or nonsocial), discrimination, mate choice or other preferences, etc. Countless other applications may be possible using portions of this design in custom devices.

In conclusion, the ELOPTA is a novel operant device that can be used for any number of behavioral experiments, at a small fraction of the price of commercially available devices. The controller automatically presents stimuli and rewards to animals, recording data as it does so. It is easily reprogrammable, easy to use, portable, durable, and resistant to failure.

[Reference]

REFERENCES

HOEKSMA, J. B., SEP, S. M., VESTER, F. C, GROOT, P. F. C, SUMONS, R., & DE VRIES, J. (2000). The electronic mood device: Design, construction, and application. Behavior Research Methods, Instruments, & Computers, 32, 322-326.

LEBER, W. (1978). A microprocessor control and recording system for instrumental behavior research. Behavior Research Methods & Instrumentation, 10, 557-562.

LOGAN, F. A., & LOGAN, F. A., HI (1970). A simple, all-mechanical operant apparatus. Behavior Research Methods & Instrumentation, 2, 24.

MOISE, S. L., Jr., & JARRARD, L. E. (1969). A computer-controlled system for training and testing primates. Behavior Research Methods & Instrumentation, 1, 234-236.

PAMMENT, P. R., & STEPHENS, J. B. (1981). A multichannel, multiobserver portable event recorder. Behavior Research Methods & Instrumentation, 13, 732-734.

REDMOND, D. P., & HEGGE, F. W. (1985). Observations on the design and specification of a wrist-worn human activity monitoring system. Behavior Research Methods, Instruments, & Computers, 17, 659-669.

(Manuscript received April 3, 2006; revision accepted for publication September 8, 2006.)

[Author Affiliation]

ADAM M. HOFFMAN

Indiana State University, Terre Haute, Indiana

JIANJIAN SONG

Rose Hulman Institute ofTechnology, Terre Haute, Indiana

AND

ELAINA M. TUTTLE

Indiana State University, Terre Haute, Indiana

[Author Affiliation]

A. M. Hoffman, hoffman@mamaJndstate.edu

[Author Affiliation]

AUTHOR NOTE

This project was funded in part by the School of Graduate Studies and supported by the Department of Life Sciences at Indiana State University. The authors acknowledge M. Gauss, G. Burgess, G. Bakken, and C. Amlaner, whose material and logistical support made this project possible. Correspondence concerning this article should be addressed to A. M. Hoffman, Department of Life Sciences, Indiana State University, Terre Haute, IN 47809 (e-mail: hofiman@mama.indstate.edu).

Комментариев нет:

Отправить комментарий