Real World Control on the HP-71B Tom Sibert <19> Have you ever wanted to be able control external devices with your Hewlett-Packard HP-71B? Sure, you can turn the tape drive on and off, or read in a voltage from one of the HP-IL voltmeters, but how about getting the ’71 to turn on your attic fan when the attic gets too hot? Or using it to remotely collect & store data (which it can do already), and act on the data it is collecting? Obviously, with a real-world interface, the possibilities are near endless. InterLoop of California has introduced the second version of their Interloop IL-210-1 HP-IL control board. This device allows HP-IL users to control 32 digital outputs, an 8-bit parallel port, 8 8- bit analog inputs, and a user defineable 8-bit DIP switch. One simple application of the Interloop board might be to control a digital state device, such as a relay, solenoid, air cylinder, motor, or lamp. These devices have only two states - they’re either on or off. This kind of application is ideal for computer control, since at its most elementary level all computers deal with entities (bits) that are binary in nature. An example of this type of application was built by two graduate students at the School of Mechanical Engineering at the Georgia Institute of Technology. A proof-of-principle prototype of a three-legged robot was built using the IL-210-1 board. This robot was built to prove that three-legged mobility is possible and it did just that at the NASA/University Advanced Missions Space Design Program conference held in June in Washington, D.C. It has also been demonstrated at NASA’s Kennedy Space Center in Florida and will be demonstrated at NASA’s Johnson Space Center in Houston in August. Structurally, the robot consists of a main body, three legs at 120 degree intervals, with each leg having a "femur" which is attached to the body and a "tibia" attached to the femur. Each joint is powered by two air cylinders mounted in series, giving each foot a total of 16 possible positions (figure 1). This paper describes a complete HP-71B to air cylinder control system. The robot is just one of the many possible applications of such a system. The Hardware Functionally, the system is quite simple, as only seven components are involved: the HP-71B, the HP 82401A HP-IL interface, the InterLoop IL-210-1 control board, a custom current boosting circuit, a solenoid valve, and the air cylinder (figure 2). The ’71 is, of course, the controller, and the IL-210 board is the "interpreter", if you will, telling the external world what to do according to what the ’71 tells it to do. The reason we call it a "board" (as opposed to a "module") is because that’s exactly how it comes - as a bare printed circuit board. On the board are all the necessary hardware and the connectors. There is the familiar dual "D" shaped holes of the HP- IL connector, a two wire terminal block for power input, and I/O in the form of six ten-pin DIP headers. Pin 10 is clipped on every connector, giving you eight I/O channels plus ground. The robot used the output ports, OUT 0 through OUT 3. These are eight-bit digital outputs, each bit capable of driving one standard TTL level load. To control the board, plug two HP-IL cables into the HP-IL connectors and into the HP-IL ports on your ’71 (or whatever HP-IL computer you want to use). You may now control the board by sending commands to it via the HP-IL command OUTPUT. More on that in the Software section. The IL-210-1 board is connected to the custom current boosting circuit by way of a cable from the header (the ribbon cable type was used) to the circuit. Contrary to what was expected, one standard TTL level load isn’t very much. It was measured to be about 700 microamps, or .7 mA. That will just barely light up an LED, and it won’t budge even a low-current solid state relay. Since the solenoids operated at 24VDC, the voltage from the output port needed to be boosted too. As it turns out, .7 mA is enough to saturate the base of a common NPN transistor, therefore allowing it to act as a switch. We choose a 2N3904, which as shown in figure 3 was connected to an output bit (pin) of the IL-210-1 board. The emitter is tied to ground, and the collector was connected to one side of the solenoid valve. The other side of the solenoid was connected to the positive side of 24VDC, and a 1N4004 diode was placed across the solenoid to prevent any induced voltage spikes from damaging the 2N3904 transistor. Thus, when the bit driving the transistor goes high, it saturates the base, allowing current to flow through the solenoid, energizing it, down through the transistor to ground. That solenoid/24VDC combination can be replaced by any of the above-mentioned applications. As long as your application doesn’t push more current through the transistor than it will take, it can be turned off and on via the IL-210- 1 board. The power to the robot’s cylinders was provided from a 2000 PSI SCUBA tank, which was regulated down to 125 PSI. Air at that pressure was tee’d to a manifold. Each line of the manifold’s output went to a two position spring return solenoid valve. The valves had two lines running to the cylinders from the CYL A and CYL B ports (figure 3). The other side of the tee went to a secondary 60 PSI regulator. This lower pressure air, in turn, went to another manifold, whose output lines went to the check valves and then to the pilot sections of the solenoid valves. The check valve prevents load overrunning of each cylinder as others are operated. Pilot-operated valves were used because only a small amount of current is required to move a lot of air. In a portable application, low power consumption is essential. Oddly enough, the only thing preventing this system from being ideal for remote data collecting/controlling was the power necessary to drive the IL-210 board. It allows power input of either 12 or 24VDC. The project called for 24V since the solenoids were of that voltage, but surprisingly, the board drew 500 mA at standby, and slightly more during operation. Not suprisingly, a great deal of that power is wasted through the heat sink. This will obviously put some constraints on the system’s portability. The two twelve-volt lantern batteries providing the robot’s power only lasted a couple of hours. The Software The program was designed to provide an easy means for someone to tell the robot which leg(s) to move, and where to move it (them) to. The legs on the robot are labeled A, B, and C. To get the proper cylinders to extend or retract, the IL-210-1 board must set the appropriate bits in the appropriate output port. This can be done in several ways. One would be to tell the board to set or clear each bit as needed, but a more efficient way would be to send to the board the value of the byte to store into the port. This is done with the Byte command. The command is of the form "Bnxxx" where n is the number of the port (0-3), and xxx is the decimal value of the byte (0-255). To send a character string over HP-IL to any device on the loop, the command is OUTPUT:1;"character string", assuming the device’s ID number is 1, i.e., the device is the first one on the loop. This is the format of the commands used to control the board. If on the HP-71B, for example, you typed OUTPUT:1;"B2255" [ENDLINE] then all eight bits on output port 2 would go high. If you then typed OUTPUT:1;"B2010" [ENDLINE] then all bits except 1 and 3 (pins 2 and 4) would go low. Notice that the "B", as with all commands for the board, must be uppercase. If you wish to change the state of more than one port at a time, just enter the command for that port after a semicolon following the first command, inside the quotes. For example, typing OUTPUT:1;"B1000;B2255;B3128" then port 1 would have all its bits cleared, port 2 would have all its bits set, and port 3 would get bit 7 set and all the rest cleared. To make the robot walk, a sequence of actuator operations must be sent not only in the proper order but also at the proper time. Thus a method of storing the proper data to be sent and the time at which it must be sent had to be devised. A convenient method of editing would also be preferable, but not absolutely necessary. Early on in the design phase of the sofware, it was decided that the maximum time the robot would take to demonstrate the walking mode was 30 seconds. A small loop was written to simulate what would have to be done as the program ran, and it was discovered that the fastest rate data could be sent to the IL-210-1 board was approximately 10 Hertz. This meant that any actuator or set of actuators could change position up to 10 times in one second. This was adequate for the application. It saved on memory requirements, too: only a maximum of 300 character strings representing the actuator changes had to be stored for any given sequence, (i.e., one string for each 1/10 second). There are three main parts of the program running the robot, each of which is accessed from the main menu. These are the editor, the compiler, and the runner. To create a file to contain the leg manipulation data the editor must be entered. This creates a data file with 300 records, one for each time interval. During this phase, each time interval is prompted for in sequence, with the present time displayed at the left side of the HP-71B’s 22 character display. As it turns out, for most of the sequences, only a few changes are made over a relatively short period of time. Somewhat lengthier periods of no activity then occur between these change periods. To accomodate this, the program will allow a numeric input between .1 and 30.0, and will jump to that time slot, and allow an entry. Entries are of the form xnnn, where n is the leg designator, either A, B, or C, and xxx is an integer from 1 to 16 denoting the position of the leg. The prompt is of the form t=yy.y? where yy.y is the time slot for which the prompt is made. At this point the leg changes are input, seperated by commas. As stated previously, any or all legs can be changed at a given time slot. Other commands available from the editor are N, P, and E. An entry of N or P at this point will cause the program to find the Next or Previous entries, if any. An entry of E will end the Editor and return to the menu. After the sequences have been entered in the editor, the datafile must be compiled, wherein another file is created to hold the actual data that will be output to the IL-210-1 board during the running phase. This module takes the editted file and looks at each time slice. When it finds data, it translates the leg/position designators into the appropriate output bytes from a string array. It then calculates how many time slices have passed since the last data-bearing slice, and writes that to the file. After it has found as many slices as the edit file says exists, it closes and secures the file and returns to the menu. Compiled files have the same name as the editted files except they end in "RN" (as opposed to ".RN", since the HP-71B doesn’t allow filename extensions). They also tend to be much smaller in size since they only contain data to be sent over the loop. After compilation, the program is ready to run the robot. The R command will prompt for a filename (the one just compiled is the default) and begin executing the data therein. This is the simplest of the three main routines: all it has to do is read the first command string and the first delay period, output the string to the IL board, wait for the specified delay, check for a keypress (this would abort the execution), and then branch back to the top and do it again. Before beginning to execute the data, it waits a user-definable time (minimum if five seconds), and then sounds an audible warning tone twice before actually commanding any cylinders to move. Upon completion of the sequence, it returns to the main menu. Another command available from the menu is W, or Waiting period. The original intent of this command was to allow a long period of time to elapse between when the execution was run and when the robot would actually start to move. It allows a waiting period to be specified (in seconds) between 0 and thousands of years - the largest number the computer can use, i.e., 9.9999999E499. The minimum waiting period actually used is 5 seconds, even when the prompt is responded to with 0. During the waiting period, a clock is displayed (reset to 12:00:00) to inform the user of the elapsed time. Other commands available from the menu are e (exit), H (Help), and S (Setup). Exit does just that - terminates the program. H displays another menu wherein the commands are displayed in their entirety. Setup repositions the robot’s legs to position 1, all cylinders retracted. Since accidently pushing this button could cause injury to someone working on the robot, the routine firsts asks, "All clear (Y/N)?" and if anything but "Y" is pressed, it aborts the setup. If all is clear and "Y" is pressed, five short beeps at one second intervals are sounded followed by a higherpitched, longer duration beep, after which the command to position the legs is sent. This is the same position as is obtained by turning the power to the board off with air still supplied to the cylinders. Listing 1 is the program in its entirety; most line labels are at least vaguely relevant to the routine they precede. Note that several LEX files are used, including ADVPRLEX, KEYWAIT, and CLOCKLEX. Listing 2 is a data table for a typical demonstration. The time slice is given on the right, followed by the codes to change certain leg’s positions at that time. Since for each demonstration of the robot a file must, at some time, be written and compiled, a faster way of "randomly" accessing the cylinder motion was desired. The HP-71B made it easy with USER mode. Each key on the HP-71’s keyboard was defined to be an output command. For example, DEF KEY "S","OUTPUT:1,’B1000;B2000;B3000'" would setup the robot to its intial position by pressing the "R" key with USER mode on. Other keys were defined to other positions to acheive various movements one increment at a time. In a later article the IL-210-1 board will be reviewed in greater detail. Time Leg Changes __________________ 0.1 A05,B05,C05 5.0 A14 5.2 C14 5.3 C13 5.6 B15 5.7 B13 7.0 B14,C14 8.0 A05,B05,C05 Listing 2. Data File for LEAN Tom Sibert graduated from Georgia Tech in 1983 with a degree in Mechanical Engineering. Tom Sibert <19> 4280 Village Square Lane Stone Mountain, GA 30083 (404) 299-5482 H