My third project undertaken with Jeff was done for Dr. Bob Montgomerie (homepage), another researcher in Jeff’s department at Queen’s University title=”Queen’s University”. Dr. Montgomerie’s research interest is sexual selection. The research in this case involved the mating habits of birds. They were interested in what characteristics of the male birds the female birds used to select their mate. They built cross-shaped cages, separated into five compartments: a middle compartment, which housed a female finch and four perches close to each side, and four outer compartments, each with a male finch.
Micoswitches on the four perches of the female bird allow a computer to record how much time the female spends with each male. The researcher would dress the male finches up in the bird-equivalent of nerdy clothes, and measure how much their social lives suffered. Presumably the nerdiest males would enjoy the company of the female bird less frequently (if at all).
Cages were built to conduct eight such experiments simultaneously. A computer was used to record the activity levels (as determined by reading the microswitches) over a period of time. An interface to the computer was needed to access the four microswitch outputs for all eight cages. That’s a total of 32 digital inputs.
I built a simple 64-to-1 multiplexer, which interfaced to a standard PC parallel printer port. The computer would output a 6-bit binary value to select which input to read, and then read back the 1-bit digital value. The 64-to-1 multiplexer was implemented as two levels of 74LS151 8-to-1 TTL multiplexers chips. Eight ‘151s formed the first level (providing 64 inputs total), and one more ‘151 formed the second level (selecting the output of one of the first level ‘151s.)
I provided a socket for a SIP resistor pack for each group of eight inputs, which could be inserted so as to pull the inputs up or down when if the input pin was open. Each group of eight inputs was on a single ribbon-cable connector. The idea was that a single 10-conductor ribbon cable would be run to each cage. I provided terminal boards for each cage which split the ribbon cable up into individual screw terminals for easy interfacing to the microswitches. Each ribbon also provided ground and +5V power.
Software
Reading the multiplexer requires a fair bit of work from the computer. The design only allows a single input to be read at a time, so software must continuously cycle through the inputs.
Direct access to the parallel-port registers is not possible for applications under newer Windows operating systems (NT, 2000 or XP). I only provided software support for Windows 98 and earlier systems. Device drivers can be written (and I believe are available from hobbiests on the internet) to support direct parallel-port register access on the newer protected systems.
It’s fairly straightforward to program in C or C++. The Microsoft 16-bit C runtime libraries provide inp() and outp() functions that can access the parallel-port hardware. For VisualBasic programmers, it’s a little harder. VisualBasic does not have any equivalent of the inp() and outp() functions. I provided a simple DLL (written in C) that can be called from VisualBasic to provide this ability.
I also wrote a simple “DIN-64 Monitor” application in Visual Basic, both as a useful tool to view the status of all 64 inputs, and also provided the source for it, as a programming sample.
Documentation
I wrote a fairly detailed User’s Guide for the device.
Papers
The following academic papers have been written based on experiments using the input device.
- Doucet, S. M., Yezerinac, S. M., and Montgomerie, R. (2004) Do female zebra finches (Taeniopygia guttata) copy each other’s mate preferences? Canadian Journal of Zoology, 82:1-7
Links
- The student in Dr. Montgomerie’s lab that worked on this project has moved on to another university. Here is her description of the research.