The precise timing and sequencing of events is of paramount importance in the laboratory of an experimental psychologist. These events often consist of the controlled presentation of some stimulus to one or more of the five senses (most often the stimulus will be visual or auditory) and then some measurement of a behavioral change which results.
One simple chain of events consists of presenting a lever (stimulus) to a white rat, allowing the rat to press the lever (behavior), and immediately providing a pellet of food as a reward.
During the course of a training session the rat will press the lever more and more frequently (behavioral change) to obtain food. In the early days of psychology this whole chain of events was controlled by a human observer who would feed the rat whenever it pressed the lever, record the time of the lever press, and prepare for the next press. Humans are quite easily fatigued by such strenuous regimens, however, and devices which would automate the data recording process were soon invented.
One of the first solutions was the use of electromechanical control equipment. This was just what the name suggests, electrically powered equipment which operated by means of mechanical relay closures and rachet systems. Simple logic circuits could be created with combinations of such equipment and quite sophisticated experiments could be conducted if one had access to enough relay gear.
Still, there were difficulties. Most bothersome was that electromechanical equipment was tedious to “program.” Relays were wired together to create the necessary logic circuits and the number of connections needed soon became unreasonably large. As many days of work were often required to set up the equipment for a single experiment, researchers were known to become quite possessive of their racks of relay gear. A fast way to lose a friend was to borrow a bit of equipment from the middle of a rack that was not being used at the moment.
A second problem was that the equipment was only slightly more reliable than the human observer, although much more expensive. Relays stick, counters and clocks jam, and faulty connections appear, seemingly out of nowhere. This last is not as unlikely as it might seem, as the connections on this type of equipment were designed to be easily altered. This made rewiring as painless as could be expected, but frequently led to situations where accidental wiring alterations could occur. A careless movement or even the normal operation of the relays could easily break a connection.
A final problem was inherent in the electromechanical equipment itself. Relays operate quite slowly while experimental subjects can respond quite quickly. At times the subject would have to learn both the experimental task and the operating limitations of the equipment.
It is little wonder that psychologists were among the first scientists to adopt the use of microcomputers for controlling equipment and collection of data. Fast, tireless, easy to program, and exceptionally accurate, microcomputers provide solutions for many of the traditional problems of the behavioral laboratory. The remaining portion of this article describes a system, based on the ZX81 and the Byte Back BB-1 control module which we use to automate the study of learning in white rats. We find the system to be useful in a variety of situations in our laboratory and, because of its low cost, particularly adaptable to use by students.
A Simple Model of the Learning Process
Much of what we learn can be explained in very simple terms. We are more likely to repeat those behaviors which are rewarded than those which go unrewarded. In addition, we are more likely to use a behavior which has been frequently practised than one which has been used only rarely. In terms of these two facts we can see a close parallel between simple learning situations and those which are more complex.
While there are undeniable differences between a rat’s behavior in learning to press a lever for food and our own in learning to write a Basic program, there are also many similarites. Correct behavior is rewarded by food in the one case and a successful run in the other, while incorrect behavior goes unrewarded. Many computers, including the ZX81, go one step farther and adminster a mild punishment, a syntax error, for an incorrect response.
Some psychologists have chosen to study rats rather than humans because studying a simple behavior such as the lever press and using a simple reward such as food may help us better to understand more complex, but conceptually similar learning situations, including human learning.
A generalized learning situation can be easily described. A subject is placed in a conditioning chamber, called a Skinner box after its inventor B. F. Skinner, and is trained to perform a simple task to obtain a reward. The lever press mentioned previously is a good example. The lever causes a feeder to operate, which in turn delivers a small amount of food to the rat as a reward. Rats quickly adapt to this regimen, and most often this pre-training phase is accomplished by the old reliable, but weary, human observer before the experiment actually begins.
In the next phase of training the ZX81 and BB-1 can be put to use. During this phase it is common to train the rat on a reward schedule which requires more effort than the simple one response/one reward situation we have been considering. Some schedules require that the lever be pressed a certain number of times before a reward is given while others require a certain amount of time to ellapse between rewards. While such schedules are difficult to set up using relay control equipment, it is quite easy to manage most any schedule using the ZX81 and a controller such as the BB-1.
The BB-1 plugs directly into the expansion port at the back of the eight inputs and eight outputs. The BB-1 operates by POKEing values into memory locations 32766 and 32767 for output purposes and PEEKing locations 32764 and 32765 to read inputs. Up to eight independent inputs and outputs can be selected, and with the addition of user-built external logic up to 256 each of input and output lines may be used. The BB-1 provides a 44 pin card edge connector with which to make external connections.
Laboratory Example and Program Notes
Controlling a conditioning apparatus with the Sinclair ZX81 and the BB-1 is very easily accomplished by connecting the lever (which is really a double throw microswitch) and pellet feeder (a 24VDC device) to the edge connector of the BB-1. To use the program given in this article, connect the microswitch’s common pole to input 22B, which is the ground for the BB-1. Next connect the normally open pole to input 7B and the normally closed pole to input 4B. For all connections, “A” refers to the component side of the BB-1 and “B” to the circuit side. Finally, connect a 24VDC power supply through outputs 2A and 2B to the pellet feeder. The BB-1 manual provides information, including a schematic and an assembly drawing, to understand the configuration of inputs and outputs for these as well as other relay operations.
Listing 1.
10 REM OPERANT CONTROL PROGRAM
40 REM FILLER
60 LET A=PEEK (32765)
80 IF A=1 THEN GOTO 100
90 GOTO 60
100 LET A=PEEK (32765)
120 IF A=2 THEN GOTO 140
130 GOTO 100
140 REM FILLER
150 POKE 32766,128
160 PAUSE 3
170 POKE 32766,0
200 GOTO 40
210 STOP
The program in Listing 1, which should be run in the FAST mode, is a simple operations program for the system. Each press of the lever will produce a single food pellet reward. Lines 60 through 90 scan the BB-1 input lines for a value of 1. If the animal is not pressing the bar, the program will cycle immediately to the second program loop. If the rat holds the bar down after receiving a pellet, however, this loop prevents the delivery of any more rewards until the lever is released.
Listing 2. Insert the following lines into Listing 1.
20 PRINT "WHAT NUMBER OF PRESSES?"
30 INPUT R
50 FOR C=1 TO R
140 NEXT C
Lines 100 through 130 scan the inputs for a value of 2, which indicates that the lever has been pressed, and send the program into the third loop which operates the feeder mechanism. Line 150 closes the relay which operates the feeder, 160 simply holds the relay long enough for the mechanism to operate, and 170 turns the feeder mechanism off. Line 200 returns the program to the first loop.
Since rats will quickly fill up on food pellets if given the opportunity, we can modify the program slightly to require more than one bar press to obtain a food pellet. Listing 2 shows the additions necessary to accomplish this change. Lines 20 and 40 allow the experimenter to choose the number of lever presses necessary to obtain a reward while lines 50 and 140 count bar presses until the required number have occurred. As an example, if the number “4” was input at line 30, the rat would have to press the lever four times before the program would reach line 150 and operate the feeder.
While the ZX81 lacks a real time clock, the insertion of a few lines into the program provides for precise timing of the interval between the delivery of food pellets. Listing 3 shows the necessary additions and changes. The new line 40 simply initializes the timing variable, while lines 70 and 110 increment the value each time the machine goes through one of the holding loops. Line 180 calculates the time in seconds by dividing the count by a constant. The value 92 was arrived at by trial and error and may be slightly different on different machines. It will almost certainly be different with other programs. Once calculated, however, timing constants seem to be quite accurate. Sample runs of this program produce time values almost perfectly correlating with an external .01 second stopclick. One important consideration in producing consistant time values is to equalize run times for each loop of the program. This program happens to have equivalent loops, but in other situations REM statements may be added to equalize the loops.
Listing 3. Insert the following lines into Listing 2.
40 LET T=0
70 LET T=T+1
110 LET T=T+1
180 LET S=T/92
190 PRINT S;"#";
In order to keep the memory requirements as small as possible, we chose to use the display file as a storage area for computed time values. If you have more than 1K RAM, it is probably best to dimension a variable to hold output values. In this way data could be SAVEd at the end of a session without having to be copied from the screen.
Control of equipment using the ZX81 and the BB-1 is obviously not limited to the simple situations presented here nor exclusively to laboratory applications. Many control tasks, from laboratory applications to the operation of devices in the home to hobby uses can be accomplished using computer controllers. The ZX81 and BB-1 are an excellent combination, offering flexibility and low cost when used in replacement of older equipment in the laboratory and can provide considerable control options in home or hobby use.