Monday, March 4, 2019

Building test tool to put the DSKY substitute through its paces


Test Tool development

Once the DSKY Substitute is complete, it will have several cables coming out of it that need to be hooked up to something to work properly. Rather than trying to debug this directly on the Apollo Guidance Computer, I designed a tool that will check out everything with a reasonably convenient user interface.

This is built around an Arduino Uno which controls the 23 signals that are inbound to the DSKY. The AGC provides these with 28V signalling levels, the standard for the spacecraft. My tool has to deal with those levels, something that is not directly compatible with an Arduino.

Those inbound circuits are fed 28V from the spacecraft (i.e. from my bench power supply) and are logically off unless the input is pulled down to ground through a 2K resistor, turning it logically on. I used a relay module in the test tool with 2K resistors wired to ground, so that whenever I fire the relay, it will turn the attached inbound line logically on.

To drive the relays, I use a combination of I2C serial bus attached expander boards and direct attachments to Arduino pins. I don't have enough pins to handle all 31 input/output connections with an Uno model, thus the expanders.

The boards are based on the PCF8574 expander chip, providing eight outputs per board. These are individually addressable on the I2C chain, with mine set to 0x20 and 0x21 addresses. I chose a 16 relay board to drive with these two expander boards. It will implement the main DSKY inputs M1 to M15, which are wired to channel 10 of the AGC. The remaining signal for relay 16 drives the COMP ACTY light which indicates computer activity in the AGC.

In addition to the 15 bit word from channel 10, the DSKY has seven inbound signals coming from other locations in the AGC channel space. These are implemented with 7 relays in a 8-relay module board, also pulling down to ground through 2K resistors. This relay board is driven by Arduino pins 7 to 13.

One control signal in that group causes the VERB and NOUN digit displays to flash on and off. The other cause lamps to illuminate on the lefthand indicator panel of the DSKY. The indicator panel implements 14 warning lights, but they are not all controlled the same way.

Six of them are controlled by the direct signals hooked to the 8-relay module, while the remaining 8 are set by special codes sent to the DSKY on channel 10 (bits M1 to M15 hooked to the larger relay board). The direct lamps are STANDBY, RESTART, TEMP, KEY REL, UPLINK ACTY, and OPR ERR. The other direct signal will cause the VERB and NOUN displays to flash.

The channel 10 data consists of a four bit bank number, two 5 bit digit codes and a sign bit. Banks 1 to 8 are used to set the digits in the three 5-digit register displays (R1, R2 and R3), as well as the plus or minus signs in front of those register displays. Banks  9, 10 and 11 are used to set the 2 digit PROG, VERB, and NOUN areas.

Bank 12 is used to turn on eight of the indicator lamps. The lights controlled by bank 12 are PRIO DISP, NO DAP, VEL, NO ATT, ALT, GIMBAL LOCK, TRACKER, and PROG.

There are eight signals that are outbound from the DSKY, generated by the keyboard. Keys are assigned to a five digit keycode, which is delivered with inverted logic to the AGC. That is, the AGC circuits watching this deliver 28V to the outbound wires; when the DSKY pulls those down to ground with internal relays and internal 2K resistors, the AGC detects that as logically ON, otherwise they are logically OFF.

Our keyboard has 19 keys, consisting of ten digits, + and - signs, and some control keys. These are VERB, NOUN, KEY REL, RSET, PRO, ENTR, and CLR. Every key except for PRO will produce a 5 bit keycode. The PRO key has its own direct signal wire to the AGC.

In addition, the RSET key has a direct signal wire which is activated in parallel with the keycode when it is depressed. The last of the eight outbound signals is logically OFF when any of the keys is depressed, otherwise it sits at logical ON state. It is used for the DSKY to know when the keyboard is idle.

For my testing purposes, I will not feed 28V to the outbound 8 DSKY lines. Instead, I will use Arduino pins with internal pull-up resistors so that they can be pulled down to ground with the relays in the DSKY when a signal is logically activated. This operates these signals on 5V signalling voltages.

I don't have quite enough digital pins on the Arduino for this, so I will make use of three analog input pins to monitor the PRO key line, the RSET direct line and the keyboard idle wire, with an external pullup resistor to 5V at the Arduino.

The code in the Arduino uses a simple text based interface to issue controlling commands. A one character command, a position number and a value are entered as a simple three character string terminated with a CR/NL. The position number depends on the command - there are only two digits in display areas such as VERB, five digits in R1, R2 or R3 areas, 8 controllable lights or flashing control via direct signal wires and 8 controllable lights through bank 12 of channel 10.

Command k00 will read and report on the eight outbound values - keycode, PRO, RSET and keyboard idle. Another command, s, sets the sign for R1, R2 or R3 to +, - or off. Commands p, v and n set the digits of the PROG, VERB and NOUN displays. Commands 1, 2 or 3 set the digits of the R1, R2 or R3 areas.

Finally, code l controls the seven direct lights and VERB/NOUN flashing, while code w affects the eight lights implemented on bank 12 of channel 10.

I have tested the components, written and debugged the Arduino codes, and will be wiring this all up around a breadboard to allow each interfacing between the DSKY Substitute cables and my test tool wires.


  1. You may find the inputs using internal pull-up resistors do not work reliably with relay contacts, especially after some time has passed. The reason is that a small current ("wetting current") is required to keep the contacts clean. I suggest external pull-ups (say 2.2 KΩ)) to provide this current. The internal pull-ups are of the order of tens of KΩ. This also applies to switches. I have had trouble with both in the past for this reason.

  2. I will be installing external 2K for the other signals so might as well do a pullup with externals.